 Threshold for multilevel simulation    Message/Author  Jenny Chang posted on Friday, July 02, 2010 - 8:47 am
Hi there! Iam trying to simulate a multilevel latent class model, in which latent class prosibilities vary across L2 latent class.
I can calculate the threshold of conditional prosibility correctly,however, I have no idea how to calculate the threshold of the latent class prosibilities for L1 across L2. I read the simulation sentence in Mplus guide exp10.7, I don't know how the follow sentence comes out.
" %between%
%overall%
cw#1 on cb#1*.75 cb#2*-.75 cb#3*0.3 cb#4*0.7;
cw#2 on cb#1*.5 cb#2*-1.75 cb#3*0.8 cb#4*-0.8;
cw#3 on cb#1*-.8 cb#2*-1.0 cb#3*1.2 cb#4*1.5;"
Thanks very much for your help!  Bengt O. Muthen posted on Friday, July 02, 2010 - 4:48 pm
The between-level statements you give show how the random means of cw vary cross the cb classes - these are linear regressions because the DVs are continuous (latent) variables.

The class probabilities for cw are calculated by integrating over the random means. Is your question how to calculate the cw class probabilities for different cb classes? So getting the conditional instead of marginal probabilities. Or is it some other question?  Jenny Chang posted on Tuesday, July 06, 2010 - 5:28 pm
Thank you for your timely reply. I would like to know how to get the between-level statements, when conditional probabilities of cw conditioned on cb, Pr(cw|cb),are known. Example as follow,
cw1 cw2 cw3
cb1 0.3 0.3 0.4
cb2 0.6 0.2 0.2
besides, the probabilities of cb1 and cb2 are repectively 0.4 and 0.6.
Thank you again!  Bengt O. Muthen posted on Wednesday, July 07, 2010 - 9:48 am
I am not clear on what you are asking. Can we talk in terms of the output of ex 10.7 which you referred to earlier and which you find on our website? I have questions like where do you get the probability table you show above, and what do you mean by "how to get the between-level statements"?  Jenny Chang posted on Wednesday, July 07, 2010 - 5:10 pm
Thank you. The probability table I mentioned before is the expected value of probability in my simulation condition, which I decided by myself. In simulation, between-level statements is determined by conditional probability of cw on cb and the marginal probabilities of cb, right? If so, how to calculate the specific figure in these between-level statements so as to realize the my simulation condition?

In another word, in ex 10.7, how can I calculate the conditional probability of cw on cb according to the between-level statements? If I understand it, I could turn the probability I expect into between-level statements by reverse thinking.
Many thanks! Best wishes!  Bengt O. Muthen posted on Thursday, July 08, 2010 - 6:41 pm

%between%
%overall%
cw#1 on cb#1*.75 cb#2*-.75 cb#3*0.3 cb#4*0.7;
cw#2 on cb#1*.5 cb#2*-1.75 cb#3*0.8 cb#4*-0.8;
cw#3 on cb#1*-.8 cb#2*-1.0 cb#3*1.2 cb#4*1.5;"

the between-level cw variables are 3 continuous latent variables so these are linear regressions. The residuals are zero which implies that the statements give the means for the cw variables.

On the within level cw is a categorical variable. For this non-parametric model you compute the conditional within-level cw class probabilities as in (6) of Henry & Muthen (2010) on our website where the above ON statements give the gamma coefficients. To go the reverse direction to get the gamma values from your conditional probabilities you consider

log(P_t /P_T | cb=m )

where t is the particular cw class and T is the last cw class.  Jenny Chang posted on Saturday, September 04, 2010 - 5:02 pm
Thank you, and appologize for a late reply.
What about the gamma for within and between latent class.

As you can see in the statement of ex10.7:
%within%
%overall%
[cw#1*0.2 cw#2*0.4 cw#3*0.6];
%between%
%overall%
[cb#1*-0.2 cb#2*-0.4 cb#3*-0.6 cb#4*-0.8];

As to [cb#1*-0.2 cb#2*-0.4 cb#3*-0.6 cb#4*-0.8], in my understanding, the gamma for cb in the between level can simularily get from log(P_t /P_T | cb=m ), if the latent class probabilities in between level are known. Is it right?

Then how should I get the gamma for latent class in within level ([cw#1*0.2 cw#2*0.4 cw#3*0.6])?
Is it a posterior mean for gamma, which is the mean of gammas in conditional within-level cw weighted by posterior latent class probability in between level, P(Wj=m| Yj) (see Vermunt, 2003, Page 226). If so, how to calculate posterior latent class probability.
Or is there any other simple way to get the gamma for latent class in within level?

Million thanks!  Bengt O. Muthen posted on Sunday, September 05, 2010 - 10:21 am
You refer to a mean statement for cw on Within:

%within%
%overall%
[cw#1*0.2 cw#2*0.4 cw#3*0.6];

but ex 10.7 does not have such a statement. It is not part of this type of model.  Jenny Chang posted on Sunday, September 05, 2010 - 4:19 pm
To be more specific, I found the montecarlo simulation sentence for ex10.7 data in the file "mcex10.7.inp", which is downloaded in your website:
montecarlo:
names are u1-u10;
generate = u1-u10(2);
categorical = u1-u10;
genclasses = cb(5 b) cw(4);
classes = cb(5) cw(4);
nobservations = 10000;
ncsizes = 1;
csizes = 200 (50);
between = cb;
within=u1-u10;
nrep = 1;
save = ex10.7.dat;

ANALYSIS: TYPE = twolevel MIXTURE;

MODEL population:

%within%
%overall%
[cw#1*0.2 cw#2*0.4 cw#3*0.6];

%between%
%overall%
cw#1 on cb#1*.75 cb#2*-.75 cb#3*0.3 cb#4*0.7;
cw#2 on cb#1*.5 cb#2*-1.75 cb#3*0.8 cb#4*-0.8;
cw#3 on cb#1*-.8 cb#2*-1.0 cb#3*1.2 cb#4*1.5;
[cb#1*-0.2 cb#2*-0.4 cb#3*-0.6 cb#4*-0.8];
......
My questions as before: how to set the value in the statement"[cw#1*0.2 cw#2*0.4 cw#3*0.6]" and "[cb#1*-0.2 cb#2*-0.4 cb#3*-0.6 cb#4*-0.8]", what kind of parameter should be known in this calcultation?  Bengt O. Muthen posted on Monday, September 06, 2010 - 8:30 am
My mistake. These two statements are related to the class probabilities for c w and for cb. The statements give logit values.

For cb you simply use the multinomial regression-based formula to go from hypothesized cb class probabilities to the cb logits in the input:

logit_c = log (P_c/P_C)

where c is a category of cb and C is the last category of cb. (If you want to know that probabilities a certain choice of logits gives you do the reverse, using the multinomial logistic regression formula.)

For cw things are more complex because you regress cw on cb. The cw logits are the intercepts in this regression and are the cw logits when cb is in its last class. So you can compute the cw logits from these intercepts and the cw on cb logits. Again, going from logits to probabilities or from probabilities to logits is done as mentioned above.  Jenny Chang posted on Thursday, September 09, 2010 - 3:58 pm
Thank you.
I get to understand about cb statement. However,I get a little confused about cw. Could I make it more clear?

The cw logits in the between level (cw#1 on cb#1*.75 cb#2*-.75 cb#3*0.3 cb#4*0.7; etc.) is cw on cb logits which can be calculated according to the cw conditional probability, by log(P_t /P_T | cb=m ) where t is the particular cw class and T is the last cw class.

And the cw logits in the within level ( %within% %overall% [cw#1*0.2 cw#2*0.4 cw#3*0.6]) are the intercepts in the cw-on-cb regression, in other word, the cw logits when cb is in its last class. We get the gamma values also by log(P_t /P_T | cb=m ), where t is the particular cw class and T is the last cw class, m is the last cb class.

Is it what you mean��I really appreciate your time and patience.  Bengt O. Muthen posted on Thursday, September 09, 2010 - 4:06 pm
Yes, you got it. Try it out.  Jenny Chang posted on Saturday, September 11, 2010 - 4:50 pm
So in exp10.7, the L2 latent class probability are expected to be 0.23 0.19 0.16 0.13 0.29 , and the L1 latent class probability conditional on L2 should be
cb1 cb2 cb3 cb4 cb5
cw1 0.41 0.18 0.17 0.25 0.22
cw2 0.32 0.31 0.28 0.06 0.27
cw3 0.09 0.14 0.42 0.56 0.33
cw4 0.19 0.38 0.13 0.13 0.18

I tried the exp10.7 simulation, however I found all the probabilities not quite consistent with what we expect from the gamma (even with a large sample size��say, 1000*20). For example, the L2 latent class probabilities are 0.22981��0.41848��0.01992��0.21082��0.12097. Is there some way to solve the problem?
Another two questions:
1�� There is no results about the conditional probabilities for L1 indicators in analysis output, how can I get them?
2�� The model in Exp10.7 is a model simular to that presented in figure 4 of f Henry & Muthen (2010), and conditional item probabilities should be the same across L2 latent classes, right? However, the output shows the thresholds of Latent Class Pattern 1 1 and 2 1 very different. Why?

Thank you.  Bengt O. Muthen posted on Sunday, September 12, 2010 - 12:58 pm
You are right that the cb probabilities are 0.23 0.19 0.16 0.13 0.29. In the Mplus Monte Carlo output from ex10.7, called mcx10.7.out on our web site, you see that estimated probabilities (going by the posterior probabilities) are: 0.27, 0.21, 0.14, 0.12, 0.26. That's reasonably close to the population values given that the number of clusters is only 200.

Note also that the output from the non-Monte Carlo ("real-data") counterpart, called ex10.7.out, gives the classes in a different order as you see in the output: 0.27, 0.26, 0.14, 0.12, 0.21. The two solutions have the same loglikelihood but just a different cb class order.

You may consider this for the run you did. But if things are still unclear, you need to send your output to support with the usual information.

1. You can compute them from the estimated thresholds.

2. In these 2 outputs I don't see thresholds being different in Patterns 1 1 and 2 1.    Topics | Tree View | Search | Help/Instructions | Program Credits Administration