Bruno L. Giordano
2006-Jul-03 21:56 UTC
[R] analogue of group option of SAS MIXED/random in R
Dear list, I am trying to use lme to build the analogue of the following SAS MIXED random specification: random int+Variable1+Variable2 /subject = Subject group=Condition type=vc; which gives a Condition-blocked heterogeneity in the random effects variance-covariance matrix. Needless to say, I have a hard time in specifying Condition-specific heterogeneities in the variance-covariance parameters. I initially tried the following commands (without Condition-heterogeneity in the random effects): G.Data<-groupedData(Response~1|Subject,data=In.Data) Fit1<-lme(Response~1+Variable1+Variable2*Condition,random=pdDiag(~1+Variable1+Variable2),method="REML",data=G.Data) but have no idea about where to go from here (note that I don't want to nest Subject in Condition). Thanks!! Bruno
Bruno L. Giordano
2006-Jul-04 05:30 UTC
[R] analogue of group option of SAS MIXED/random in R
Well, just in case somebody is interested, the following R code gives the same estimates as the SAS code below: ######R code########### G.Data<-groupedData(Response~1|Subject,data=In.Data) G.Data$Condition<-as.ordered(G.Data$Condition) G.Data$Const<-rep(1,length(Variable1)) tmp<-pdDiag(~Condition:Const+Condition:Variable1+Condition:Variable2-1) Fit1<-lme(Response~1+Variable1+Variable2*Condition, random=tmp, method="REML",data=G.Data) ########SAS code######## proc mixed data=InData;class Subject Condition; model Response=Variable1 Variable2 Condition Variable2*Condition; random int Variable1 Variable2/subject = Subject group=Condition type=vc; run; Bruno ----- Original Message ----- From: "Bruno L. Giordano" <bruno.giordano at music.mcgill.ca> To: <r-help at stat.math.ethz.ch> Sent: Monday, July 03, 2006 5:56 PM Subject: [R] analogue of group option of SAS MIXED/random in R> Dear list, > > I am trying to use lme to build the analogue of the following SAS MIXED > random specification: > > random int+Variable1+Variable2 /subject = Subject group=Condition type=vc; > > which gives a Condition-blocked heterogeneity in the random effects > variance-covariance matrix. > > Needless to say, I have a hard time in specifying Condition-specific > heterogeneities in the variance-covariance parameters. > > I initially tried the following commands (without Condition-heterogeneity > in > the random effects): > > G.Data<-groupedData(Response~1|Subject,data=In.Data) > Fit1<-lme(Response~1+Variable1+Variable2*Condition,random=pdDiag(~1+Variable1+Variable2),method="REML",data=G.Data) > > but have no idea about where to go from here (note that I don't want to > nest > Subject in Condition). > > Thanks!! > > Bruno > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bruno L. Giordano, PhD CIRMMT Schulich School of Music, McGill University 555 Sherbrooke Street West Montr?al, QC H3A 1E3 Canada http://www.music.mcgill.ca/~bruno/