# # hivnet-CDA-glmm.q # # ------------------------------------------------------------ # # PURPOSE: analysis of IC data # # AUTHOR: P. Heagerty # # DATE: 07Mar2007 # # ------------------------------------------------------------ # data <- read.table( "/Users/heagerty/Courses/571/GLMM/HivnetWide.dat", header=F ) # vps.data <- data.frame( id = data[,1], risk.group = factor( data[,2], levels=1:4, labels=c("MSM","MaleIDU","WAHR","WAHR+IDU") ), education = factor( data[,3], levels=1:6, labels=c(" 0 ) # # ################################################## # Longitudinal Analysis of 0, 6, and 12 # ################################################## # ##### glmm analysis # library(lme4) # ##### ID needs to be a factor for GLMM() # vps.stacked$id <- factor( vps.stacked$id ) # ##### call GLMM from lme4 library # sink("/Users/heagerty/Courses/571/GLMM/hivnet-CDA-glmm.out") # pMethod1 <- F if( pMethod1 ){ fit1a <- GLMM( formula = y ~ visit6 + visit12 + ICgroup + visit6*ICgroup + visit12*ICgroup, random = ~1 | id, family = binomial, method = "PQL", data=vps.stacked ) summary( fit1a ) # fit1b <- GLMM( formula = y ~ visit6 + visit12 + ICgroup + visit6*ICgroup + visit12*ICgroup, random = ~1 | id, family = binomial, method = "Laplace", data=vps.stacked ) summary( fit1b ) }else{ # ##### alternative parameterization # fit2a <- GLMM( formula = y ~ post + visit12 + ICgroup + post*ICgroup + visit12*ICgroup, random = ~1 | id, family = binomial, method = "PQL", data=vps.stacked ) summary( fit2a ) # fit2b <- GLMM( formula = y ~ post + visit12 + ICgroup + post*ICgroup + visit12*ICgroup, random = ~1 | id, family = binomial, method = "Laplace", data=vps.stacked ) summary( fit2b ) } # sink() # # end-of-file...