Closed FelixLaliberte closed 1 year ago
I recommend using Python markdown for code! It helps with readability. Like this:
print("Python is great")
I edited your question to include this.
Back to your issue, can you provide the code you used to conclude that the models were different? You inspected the measurement parameters?
Sorry for the confusion. I guess you looked at the print statements of the verbose output and saw differences in the measurement models. I can reproduce and will look into this.
I think I understand what's up. After testing, this only happens if the structural model is covariate
. gaussian_unit
for example behaves as expected.
The issue is a consequence of the likelihood we optimize for. In the second model, StepMix detects the presence of a covariate and switches to the conditional likelihood perspective for the entire estimation. See page 4 in the preprint. This means that the marginal over latent classes P(X) is omitted from likelihood computations, including during the first step where we fit the measurement model during 3-step estimation. Here we only maximize P(Y|X).
This explains the difference with your first model without covariates, which uses the generative perspective and therefore includes P(X) to maximize the joint P(X, Y), leading to different final parameters.
I agree this is a bit strange, but I'm not sure it's a bug. Let's see what @robinlegault thinks
The question boils down to this. During 3-step estimation with covariates, should the first step use the conditional likelihood P(Y|X) or the joint likelihood P(X, Y)=P(Y|X)P(X)?
Reviewing the paper, it seems we should always be using P(X,Y) during the first step, regardless of covariates. Would appreciate someone else's input here.
I agree we should always use P(X,Y) during the first step of stepwise approaches, as we want to keep the estimators of the MM parameters independent from the SM (including the covariates).
I have indeed looked at the classes’ prevalence and conditional probabilities using the verbose output.
Thank you for the information you have provided. The issue has indeed been resolved.
Hi,
It seems that there is an issue with the models estimated with covariates. The measurement models are different from the models estimated without covariates. Here is a simple example :
Thank you!