1

I'm doing an biological interaction analysis from logistic regression, and apply it to additive model, as suggested by Hosmer and Lemeshow (1992). But I learnt the code from the epi.interaction function | R Documentation. It tells only the calculation of confidence interval of RERI, AP and S, but how to have a p value?

Take this example:

### 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)

So, how to calculate the p value of this model with R? And how about the OR or RR?

Tyelcie
  • 48
  • 5
  • I am curious to know how did you get p.value then? and would you be kind to explain me how to interpret the outcome of epi.interaction while explaining in result section of your paper? – Aryh May 13 '20 at 09:32

0 Answers0