Hi everybody,
I am doing a LCA with distal outcome. Here I would like to introduce a number of control variables. But I would like to use the distribution of the classes and item response probabilities for each class from the model without control variables, so that I have certainty regarding my classes (e.g. that class 2 is still "the concerned" in the same way as I found without control variables). The manifest items are binary.
In gsem, I think I succeeded by doing the following (though not with distal outcome):
With the docla function, my code looks like this, but I'm struggling with how exactly to code rhorestrict, rhostart, gammarestrict and gammastart.
When I write 0 in rhorestrict and gammarestrict, I get the error "Rho parameter restrictions for one or more parameters were fixed for all response categories; please free the rho parameters for at least one response category”. I've tried writing 1 in a few of the categories, which does not help. I have also writing 1 in all categories, but then I get the error "0; invalid name".
Anybody know how to use the rho and gammas from the model without covariates?
Best
Gustav
I am doing a LCA with distal outcome. Here I would like to introduce a number of control variables. But I would like to use the distribution of the classes and item response probabilities for each class from the model without control variables, so that I have certainty regarding my classes (e.g. that class 2 is still "the concerned" in the same way as I found without control variables). The manifest items are binary.
In gsem, I think I succeeded by doing the following (though not with distal outcome):
Code:
gsem (x1 x2 x3 x4 x5 x6 x7 x8 <- ), lclass(C 3) logit startvalues(randomid, draws(50)) mat b = e(b) gsem (x1 x2 x3 x4 x5 x6 x7 x8 <-) (C <- z1 z2 z3), lclass(C 3) from(b)
Code:
foreach num of numlist 5 {
di "***************************************************************************"
di "`num'"
doLCA menneskeskabt_2 korrekt_viden_2 løs_klima_2 Tænker_på_egen_påv_2 tilid1_3_dum_2 tilid1_4_dum_2 optimistisk bange skamfuld magtesløs handlekraftig, ///
nclass(`num') ///
id(pnr) ///
maxiter(5000) ///
categories(2 2 2 2 2 2 2 2 2 2 2) ///
criterion(0.000001) ///
weight(pervgt) ///
covariates(koen komgrupper hfaudd_forældre Negativt_påvirket) ///
gammastart(0.4409077 0.2544952 0.11901488 0.12255987 0.06302234) ///
gammarestrict(0 0 0 0 0) ///
rhostart(0.951555875 0.95372281 0.987995336 0.702136841 0.969710674 0.143143763 0.016806506 0.883058985 0.654075987 0.923486817 0.457669247 ///
0.797247257 0.891210853 0.867633324 0.429511808 0.934266666 0.122193795 0.118464952 0.120914174 0.098249964 0.450381481 0.064434742 ///
0.787191321 0.882354944 0.987296661 0.658290516 0.948432925 0.325147996 0.37007691 0.4200758 0.32105679 0.261133918 0.929506129 ///
0.235797526 0.333295668 0.329454904 0.349262742 0.516252777 0.092568451 0.326839042 0.020735387 0.014900558 0.113285278 0.153370128 ///
0.529466291 0.216094785 0.554414406 0.233397135 0.600590643 0.29822445 0.460326088 0.707227553 0.611296335 0.757343113 0.58910746 ///
0.048444125 0.04627719 0.012004664 0.297863159 0.030289326 0.856856237 0.983193494 0.116941015 0.345924013 0.076513183 0.542330753 ///
0.202752743 0.108789147 0.132366676 0.570488192 0.065733334 0.877806205 0.881535048 0.879085826 0.901750036 0.549618519 0.935565258 ///
0.212808679 0.117645056 0.012703339 0.341709484 0.051567075 0.674852004 0.62992309 0.5799242 0.67894321 0.738866082 0.070493871 ///
0.764202474 0.666704332 0.670545096 0.650737258 0.483747223 0.907431549 0.673160958 0.979264613 0.985099442 0.886714722 0.846629872 ///
0.470533709 0.783905215 0.445585594 0.766602865 0.399409357 0.70177555 0.539673912 0.292772447 0.388703665 0.242656887 0.41089254) ///
rhorestrict(0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0 ///
0 0 0 0 0 0 0 0 0 0 0) ///
rhoprior(1.0)
}
Anybody know how to use the rho and gammas from the model without covariates?
Best
Gustav
