Skip to content
Prev 315219 / 398503 Next

random effects model

HI,

I think I mentioned to you before that when you reshape the 
columns excluding the response variable, response variable gets repeated
(in this case hibp14 or hibp21) and creates the error"


I run your code, there are obvious problems in the code so I didn't reach up to BP.gee

BP_2b<-read.csv("BP_2b.csv",sep="\t")
BP.stack3 <- reshape(BP_2b,idvar="CODEA",timevar="time",sep="_",varying=list(c("Obese14","Obese21"),c("Overweight14","Overweight21")),v.names=c("Obese","Overweight"),times=factor(c(1,2)),direction="long")

BP.stack3 <- transform(BP.stack3,CODEA=factor(CODEA),Sex=factor(Sex,labels=c("Male","Female")),MaternalAge=factor(MaternalAge,labels=c("39years or less","40-49 years","50 years or older")),Education=factor(Education,labels=c("Primary/special","Started secondary","Completed grade10", "Completed grade12", "College","University")),Birthplace=factor(Birthplace,labels=c("Australia","Other English-speaking","Other")))
?BP.stack3$Sex <- factor(BP.stack3$Sex,levels=levels(BP.stack3$Sex)[c(2,1)]) 
?BP.sub3a <-? subset(BP.stack3,subset=!(is.na(Sex)| is.na(Education)|is.na(Birthplace)|is.na(Education)|is.na(hibp14)| is.na(hibp21)))?? 
?nrow(BP.sub3a)
#[1] 3364
?BP.sub5a <- BP.sub3a[order(BP.sub3a$CODEA),] # your code was BP.sub5a <- BP.sub3a[order(BP.sub5a$CODEA),]? 
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ^^^^^ was not defined before
#Next line
BPsub3$Categ[BPsub6$Overweight==1&BPsub3$time==1&BPsub3$Obese==0]<- "Overweight14"? #It should be BP.sub3 and what is BPsub6, it was not defined previously.
#Error in BPsub3$Categ[BPsub6$Overweight == 1 & BPsub3$time == 1 & BPsub3$Obese ==? : 
? #object 'BPsub3' not found






A.K.