I recently did a latent class analysis with distal regression on a set of data, say A. The process was interesting and the results useful, so I decided to take the same approach on some new, unrelated data, B. Being new to this, I modified the code I'd used for A for my analysis of B. I was able to find a reasonably well fitting latent class model, and so attempted distal regression using this code:
This produced an r(111) error "variable C not found; Perhaps you meant 'C' to specify a latent variable. For 'C' to be a valid latent variable specification, 'C' must appear in the latent() option."
The reason I'm puzzled and not just figuring out how to specify the latent option is that this is almost exactly how I coded the analysis of A, and it worked perfectly.
Differences in code for the distal regression models between A and B are:
Code:
gsem (var1 var2 var 3 var4 <-,ologit) /// (var5 var6 var7 var8<-, mlogit) /// (C->var9, mlogit) /// [pweight=weight], iterate(100) /// from(final) difficult lclass(c 4) lcinvariant(none)
The reason I'm puzzled and not just figuring out how to specify the latent option is that this is almost exactly how I coded the analysis of A, and it worked perfectly.
Differences in code for the distal regression models between A and B are:
- Original analysis of A was using Stata 15.1; I'm now on 16.1. The original code runs fine on A using 16.1
- A contains a manifest linear variable, and so has a line (varX<-, reg)
- I had to constrain two parameters in A using code
Code:
(3:var1 <- _cons@-15) ///(3:var2 <- _cons@-15) ///
- The solution for A was three classes instead of four, and so the code for A is lclass(c 3)
Comment