On Jun 16, 2008, at 6:00 AM, [EMAIL PROTECTED] wrote: > From: eugen pircalabelu <[EMAIL PROTECTED]> > Date: June 15, 2008 7:16:09 PM EDT > To: R-help <[EMAIL PROTECTED]> > Subject: [R] R vs SAS and HLM on multilevel analysis- basic question > > > Hi R users! > > I am trying to learn some multilevel analysis, but unfortunately i > am now very confused. The > reason:http://www.ats.ucla.edu/stat/hlm/seminars/hlm_mlm/mlm_hlm_seminar.htm > http://www.ats.ucla.edu/stat/sas/seminars/sas_mlm/mlm_sas_seminar.htm > > and > MlmSoftRev. pdf from mlmRev package. > >> From what i see, the first two links seem to declare the level one >> variable as a random part (i don't know sas synthax, but i think i >> am right ) while Mr. Bates' pdf says that a grouping variable is >> the random part of the model, though both models, use roughly the >> same type of information, some characteristic of the school, along >> with individual characteristics in explaining individual achivement. > > Am i mistaken somehow? If not, could they both be valid models (i > presume) but each showing something else, in terms of connections > between this variables?
Yes, I believe you are mistaken, but I have only a rudimentary understanding of mixed effects modeling so I won't comment further except to say that I'm pretty sure both sources you listed above are talking about the same kinds of models. > > I don't know SAS at all, but I've used both HLM and R to run mixed effects models. Part of the confusion may be due to the different ways that R and HLM expect the input data to be formatted. To run a 2- level model in HLM you need two separate files corresponding to the two levels. When you input the data into HLM you specify the grouping factor that links the two files together. In R you can use a single data file and specify the grouping factor in the model syntax. I posted a similar question several months ago--see http://tolstoy.newcastle.edu.au/R/e4/help/08/02/3600.html I also received an off-list reply pointing me to http://www.ats.ucla.edu/stat/examples/alda.htm which gives both HLM and R syntax for the same models. One of the examples on the website is as follows: ################ HLM Level 1 Model COG = beta_0 + beta_1(TIME) + r Level 2 model: beta_0 = gamma_00 + gamma_01(PROGRAM) + mu_0 beta_1 = gamma_10 + gamma_11(PROGRAM) + mu_1 ################# Notice that no grouping factor is specified because this is done separately, in the data input stage. The corresponding R syntax is ################# R syntax: model1<- lmer(cog~time*program + (time | id), data=dataframe) ################# Notice that there is an extra term in the R syntax (id) that is not in the HLM syntax. Again, this is because you have to tell HLM what the grouping variable is when you input the data, while in R you specify the grouping variable in the model. I'm guessing this may be the source of some of your confusion. > Thank you and sorry for taking up your time. No problem, HTH. -Ista [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.