 I really mean "second level factor" not "two-level factor", thank you for
the correction.
 I think you have gave some good ideas on the Multilelvel models, but i
still have some confusions on specifying a model in R.
One fictitious example:
First level: students; Two independent variables for students are:sex, age;
Second level:class; One independent variable for second level:num;
Response variable:height
Are the following models right? what are the differences for the following
models? How to specify the variables for different level?
lmer(height ~ sex+age+(1|class))
lmer(height ~ (1|sex)+(1|age)+(1|class)
lmer(height ~ sex+age+(1+sex+age|class))
lmer(height ~ sex+age+num+(1|class))
lmer(height ~ sex+age+num+(1+num|class))
lmer(height ~ sex+age+num+(1+sex+age+num|class))
lmer(height ~ sex+age+(1|num)+(1|class))
lmer(height ~ sex+age+(1|num))
lmer(height ~ sex+age+(1+num|num))
  The above formulas are only part of the models. I think that it will be
better if the help in R can give some detailed explanation on how to specify
a model.
  How to specify a correct model in R is very important for the users. If
some person can give a good data example, we can deepen this discussion,
which will be definited helpful for users.
  Some recommended useful resources on specifying a model are welcome.

On Mon, Dec 15, 2008 at 11:19 PM, Douglas Bates <bates@stat.wisc.edu> wrote:

> On Mon, Dec 15, 2008 at 3:36 AM, Gorjanc Gregor
> <Gregor.Gorjanc@bfro.uni-lj.si> wrote:
> >> ## Fit the model
> >> fit9b <- lmer(tezaroj ~ pasma + roj2 + zj2 + spol + reja + jagLM +(1 |
> rejec) + (1 | hy) + (1 | hys), data=podatki)
> >> From your fitting, i wonder what your theoretical model is.
> >> y=b0+uj+b1*pasma + b2*roj2 + b3*zj2 + b4*spol + b5*reja +
> b6*jagLM+b7*rejec+b8*hy+b9*hys
> >> uj represents the random intercept effects for rejec,hy and hys?
> >> I cannot see how to write your model and explain it.
> >> It seems that you have fitted three random intercepts in your model
> (rejec,hy and hys), are they all two-level factor or first-level factor?
>
> I think you mean "second level factor" not "two-level factor", Zhijie.
>  I know it is confusing but "two-level factor" means a factor which
> has only two possible values, such as sex which has only two levels -
> male and female.  Two-level factorial designs, for example, are
> specialized experimental designs where all the experimental factors
> are restricted to only two levels.
>
> I believe you are using the terminology of multilevel modeling where
> one characterizes factors as being at the first level, the second
> level, etc.  One can fit multilevel models using lmer but one can also
> fit models that do not fit into the multilevel framework - models with
> crossed or partially crossed random effects.  Unfortunately, because
> the terminology of multilevel models (also called hierarchical linear
> models or HLMs) is so pervasive, many people believe that any model
> with random effects must be hierarchical.  That is not true and it
> leads to many misconceptions.
>
> Even worse, the emphasis on levels in model specification for software
> like MLWin and HLM causes confusion about fixed effects and random
> effects.  These is a widespread belief that the level of a variable
> affects its use in the fixed-effects specification, which is not true.
>
> Gorjanc is correct in what he writes below.  He has three random
> effects terms.  They are what I would call simple, scalar random
> effects ("scalar" because there is one random effect associated with
> each level of the factors rejec, hy and hys and "simple" because the
> term on the left side of the "|" is "1", which means that each term
> contributes a set of indicator columns to the model matrix for the
> random effects). Whether the factors rejec, hy and hys happen to form
> a nested sequence is irrelevant to the model specification and fitting
> in lmer.  In the multilevel world it is mandatory.
>
> >> What is your model formula?
> >
> > I simply have three random effects. The model specification (without
> indexes) would be
> >
> > y ~ N(mu, sigma^2_e)
> >
> > mu = alpha + ... + rejec + hy + hys
> >
> > rejec ~ N(0 sigma^2_r)
> >
> > hy ~ N(0 sigma^2_hy)
> >
> > hys ~ N(0 sigma^2_hys)
> >
> > gg
> >
>  > _______________________________________________
> > R-sig-mixed-models@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >
>



-- 
With Kind Regards,

oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[***********************************************************************]
ZhiJie Zhang ,PhD
Dept.of Epidemiology, School of Public Health,Fudan University
Office:Room 443, Building 8
Office Tel./Fax.:+86-21-54237410
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:epistat@gmail.com <Email%3Aepistat@gmail.com>
Website: www.statABC.com
[***********************************************************************]
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::

	[[alternative HTML version deleted]]


