[R-sig-ME] Is it right to specify a random slope for the dummy variables
Reinhold Kliegl
reinhold.kliegl at gmail.com
Wed Dec 31 12:35:21 CET 2008
By default, a categorical variable (factor) with n levels comes with
n-1 treatment contrasts. Therefore, in the fixed-effect part of the
model the intercept represents the reference level and the n-1
contrasts represent the mean differences between the other levels and
the reference level, assuming a balanced design. You can check your
specification with contrasts(factor). Of course, you should change
from treatment to other contrasts as required by your hypotheses. See
?contrasts.
Now suppose you have the variable group as random factor in the model
and you include the variable factor also in the random effects part:
lmer(y ~ factor + (factor|group))
Then, you can estimate the variance of the intercept (i.e., variance
of reference level for groups), variances of the n-1 difference
scores for group, and correlations between intercept and difference
scores as random effects (i.e., you estimate varying intercepts and
varying differences and the correlations between them).
Thus, with categorical variables you are mostly looking at the
variance and correlation of difference scores between levels of a
factor rather than variance and correlation of slopes (which are also
a kind of difference score, of course).
Reinhold Kliegl
On Wed, Dec 31, 2008 at 9:45 AM, zhijie zhang <epistat at gmail.com> wrote:
> Dear all,
> Today, i was thinking the following question.
> We know the variables may be classified into continuous, ordinal, and
> categorical variables. I was confused about how to handle with
> the categorical variables in the multi-level models.
> For fixed effects, the categorical variables were always treated as dummy
> variables, my questions are:
> 1. Could the random slope be specified for categorical variables that was
> always changed into the form of dummy variables?
> 2. If the random slope could be specified for categorical variables, how to
> explain it? It seems a little different from the continuous variables.
> I tried the GLIMMIX Procedure in SAS. It seems that SAS treats categorical
> variables as continuous variables. While in MLWin, it seems that random
> slope could be specified for the dummy variables .
> Any ideas on it are greatly appreciated.
>
> --
> 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 at gmail.com <Email%3Aepistat at gmail.com>
> Website: www.statABC.com
> [***********************************************************************]
> oooO:::::::::
> (..):::::::::
> :\.(:::Oooo::
> ::\_)::(..)::
> :::::::)./:::
> ::::::(_/::::
> :::::::::::::
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list