我正在进行逻辑回归的生物相互作用分析,并将其应用于加法模型,如Hosmer and Lemeshow (1992)所示。但我从epi.interaction function | R Documentation学到了代码。它仅说明RERI,AP和S的置信区间的计算,但是如何得到p值?
举个例子:
### Construct the data
Cohort <- function(a,b,c,d){
n <- a+b+c+d
Pre <- sample(c(rep(1,a),rep(2,b),rep(3,c),rep(4,d)),n)
ID <- c(1:n)
DF <- data.frame(ID=ID,Pre=Pre)
DF$A <- rep(NA,n)
DF$A[DF$Pre==1 | DF$Pre==3] <- 0
DF$A[DF$Pre==2 | DF$Pre==4] <- 1
DF$B <- rep(NA,n)
DF$B[DF$Pre==1 | DF$Pre==2] <- 0
DF$B[DF$Pre==3 | DF$Pre==4] <- 1
DF <- data.frame(ID=DF$ID,A=DF$A,B=DF$B)
return(DF)
}
Com <- function(D,C){
Disease <- c(rep(1,nrow(D)),rep(0,nrow(C)))
ID <- c(1:(nrow(D)+nrow(C)))
Pooled <- rbind(D,C)
Pooled <- cbind(ID,Disease,Pooled[,2:3])
return(Pooled)
}
DataCase <- Cohort(1180,340,540,120)
DataControl <- Cohort(2240,230,460,30)
Data <- as.data.frame(Com(DataCase,DataControl))
## Set the dummy variable
Data$Dum <- NULL
Data$Dum[Data$A==0 & Data$B==0] <- 0
Data$Dum[Data$A==1 & Data$B==0] <- 1
Data$Dum[Data$A==0 & Data$B==1] <- 2
Data$Dum[Data$A==1 & Data$B==1] <- 3
Data$Dum <- factor(Data$Dum)
## Fit the Regression Model
Data.glm <- glm(Disease ~ Dum, family = binomial, data = Data)
summary(Data.glm)
## Calculate RERI, AP and S along with confidence interval
epi.interaction(model = Data.glm, coeff = c(2,3,4), type = "RERI", conf.level = 0.95)
epi.interaction(model = Data.glm, coeff = c(2,3,4), type = "APAB", conf.level = 0.95)
epi.interaction(model = Data.glm, coeff = c(2,3,4), type = "S", conf.level = 0.95)
那么,如何用R计算这个模型的p值? OR或RR怎么样?