Dear all,
Hi~ I am Frederick, and currently I'm learning SEM and lavaan, also using available dataset to do some preliminary pathway analysis for type 2 diabetes.
The model is in the pic, a big one, with categorical var edu (low, mid, high) / income (low, mid, high) / smoking (current, ex, non) / t2dm(if having t2dm or not).
Since the dataset is remote access and protected, so I provide screen shot here.
Other var can be seen as intermediators or mediators, sex / age are two exogenous variables that used for adjusting other variables.
I've done this mainly in three steps, as only one latent variable diet I used.
(1) Test Diet latent variable by WLS estimation
(2) Build up whole model without categorical variable by WLS estimation , while the outcome (instead of t2dm) I used HbA1c or fasting glucose
(3) and then, I added education, income and smoking, and changed outcome variable to t2dm (having diabetes or not), by using WLSMV
* I didn't put income and education into one latent variable (issues for formative and reflective), but linked them with covariance ~~
sample sizes 80000+ , actually analyzed 60000+ (default setting for missing value), for (2) and (3) basically the same sample sizes
*some of the NA I put there is a reminder and habit for myself...
While before (3), until 2, the model was well-fitted with reasonable estimates without categorical variables.
But after introducing categorical variable, after estimation I received this warning
not all element of the gradient are (near) zero;
the optimizer may not have found a location solution;
...
I think it might indicate a false positive convergence....
then I used lavInspect(fit, "optim.gradient") to check, and did found several numbers (sorry i don't know how to call them) are above 0.01, and indeed , most of the larger numbers are related to categorical variables introduced, but also some non-categorical var appeared larger numbers as well, among them 8 were larger then 0.01, one larger than 0.1
then I tried to introduce (test) these categorical variables one by one, while for any of them, once introduced , it gave this warning...
Hope someone could help with this!~ Or any suggestions for model itself that can cause this error. Currenlty I'm kind of trapped here, while previous literature using similar method for this topic all used MPlus and didn't give any specific details...
Thanks~!