[R-sig-ME] Fitting random intercept model in R?

Emmanuel Curis curis at pharmacie.univ-paris5.fr
Sat Jun 23 08:56:35 CEST 2012


Hello,

Your model will be a random intercept model if you assume that the
group is a random effect factor; typically, that you have observed
only a few levels of the "infinite" possible levels of the groups (for
instance, if group is a town, a school...). It will be a fixed effect
model if you assume that the group is a fixed effects factor;
typically, that you have observed all possible levels of the groups
(for instance, if group is sex, treatment...)

If I correctly understood both linear mixed models and your problem,
the equation for a single observation (groupe f, individual i) would
be something like

y(f, i) = mu0 + beta_1 F1(f,i) + sum_{k=1 to m} alpha_k 1(F2==m_k)
        + Sum_{k = 1 to f} u_k 1(F0==k)   ] random part
        + epsilon( f, i )                 ]

with 1(f) the indicator variable, that is 1(a) equals 1 if a is true,
0 otherwise; u_f a realisation of a random variable ; mu0 the average
intercept in the whole population ; beta_1 the commun slope ; F1(f,i)
the value of F1 for individual i of group f. This is assuming that F2
as k levels, m_1 to m_k.

Be writing such lines for each observation, you can get the X and Z
matrices.

b is the vector of the u_k above and Z is a matrix of indicators of
the groups, which allows to use the correct b for a given individual,
according to the group he belongs to.

The exact form of X will depend on the way you decide to code the
different levels of F2 ("contrasts"); by default in R, would be
alpha_1=0 and all others alpha_k free, leading to a column of 0 in the
X matrix which is in fact removed together with the alpha_1
coefficient.

For more precise answer, if think you should give more informations,
like the number of levels for F2, the nature of "groups"...

On Fri, Jun 22, 2012 at 06:47:42PM -0500, Michael wrote:
« Hi all,
« 
« Could anybody please shed some light on me?
« 
« N individuals, divided into K groups. N>K.
« 
« Some groups have 1 individuals only, some other groups have more
« individuals.
« 
« Each individual has 4 features (4 variables): F0, F1, F2, and F3, where F0
« is simply the group indicator.
« 
« Therefore the data matrix is of size N x 4.
« 
« There is also a weight vector w, which is of length N, which gives the
« weights for each of the N individuals in the regression.
« 
« May I ask if the following model is a random-intercept model?
« 
« 1. There is a common beta for all N individuals.
« 2. Each group has a different within group regression line (same slope but
« different intercepts).
« 3. The regression line within each group crosses the "cloud" consisting of
« the group members. And the individual residuals scatter around the
« regression line, within each group.
« 
« This sounds like a "random-intercept" model to me.
« 
« However, how do I explicitly write out the equation?
« 
« y = X * beta + Z * b + eps
« 
« More specifically, with the three feature variables F1, F2 and F3 and the
« group indicator variable F0,
« 
« I am having difficulty writing out X and Z explicitly.
« 
« Moreover, my F2 is a factor variable.
« 
« Could anybody please show me how the X and Z matrices look like explicitly?
« And what do the "b"'s represent here?
« 
« And how do I set up the weights in LME in R? If I would like to have
« "group"-weights and "individual"-weights, how shall I do it?
« 
« Thank you!
« 
« 	[[alternative HTML version deleted]]
« 
« _______________________________________________
« R-sig-mixed-models at r-project.org mailing list
« https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-- 
                                Emmanuel CURIS
                                emmanuel.curis at univ-paris5.fr

Page WWW: http://emmanuel.curis.online.fr/index.html



More information about the R-sig-mixed-models mailing list