Variance of L2-factor? PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
Message/Author
 Student 09 posted on Thursday, October 13, 2011 - 7:07 am
Hello,

I'd like to use the variance of a Level-2 factor as Level-2 covariate in a twolevel analysis.

I tried to create a new variable measuring the Level-2 variance of the factor using "Model constraint", but did not succeed.

Can anyone post me a syntax example how to put the variance of a L2-factor into an independent variable?

many thanks!
 Bengt O. Muthen posted on Thursday, October 13, 2011 - 1:22 pm
The variance of a Level-2 factor is a constant and does not vary over the Level-2 units (the clusters). Therefore it is not a variable and cannot be a covariate.

Perhaps you are thinking of within-level variance that varies over the level-2 units.
 Student 09 posted on Friday, October 14, 2011 - 12:45 am
you are rigth - sorry for my error. It is indeed the within-group variance of a factor I'd like to use as variable (presuming different variance per l2 unit). How would one create such a variable?

Please note it is the variance(s) of the factor itself, not the variance of a slope which is of interest here.
 Tihomir Asparouhov posted on Friday, October 14, 2011 - 11:26 am
If you just want to model the variance and you are able to reformulate your two-level model as a single level multivariate model you can use the constraint feature, see example 5.23 in the user's guide.

Another approach is to use mixtures with a level 2 class variable and allow the variance to take different values across class.

The third approach (probably the best) is illustrated in this montecarlo example - however I did this for an observed variable rather than a factor for simplicity. You can see I used a constant of 0.1 to avoid singularity issues. This method gives you an actual variable on the between level that is not the variance but the square root of the variance. Run this example in Mplus to see the details.

montecarlo:
names are y;
nobservations = 10000;
nreps = 1;
CSIZES = 500(20);
ncsize = 1;

ANALYSIS: TYPE = twolevel random; estimator=ml; algo=int;

model population:
%within%
s | y on e;
y@0.1; e@1;
e by;

%between%
s*1;
y*1; [y*1];
s with y*0.2;
[s*2];

model:
%within%
s | y on e;
y@0.1; e@1;
e by;

%between%
s*1;
y*1; [y*1];
s with y*0.2;
[s*2];
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: