Dear Stata Users,
I am getting my feet wet with Stata 15’s gsem suite. I am attempting to describe the relationship between asthma and school attendance using eight binary asthma variables for 1,496 students. My approach involves three steps that I would like to implement with gsem. They are:
. gsem ///
> (Asthma <- asthma1-asthma8) ///
> (absent2_y <- i.Asthma $cov, poisson), var(e.Asthma@1)
Fitting fixed-effects model:
Iteration 0: log likelihood = -9603.4555
Iteration 1: log likelihood = -7825.1506
Iteration 2: log likelihood = -7807.8119
Iteration 3: log likelihood = -7807.7992
Iteration 4: log likelihood = -7807.7992
Refining starting values:
Grid node 0: log likelihood = -5029.6035
Fitting full model:
Iteration 0: log likelihood = -5029.6035
Iteration 1: log likelihood = -4939.0293
Iteration 2: log likelihood = -4896.8314
Iteration 3: log likelihood = -4881.4963
Iteration 4: log likelihood = -4881.2745
Iteration 5: log likelihood = -4881.2746
Generalized structural equation model Number of obs = 1,496
Response : absent2_y
Family : Poisson
Link : log
Log likelihood = -4881.2746
( 1) [/]var(e.Asthma) = 1
----------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-----------------+----------------------------------------------------------------
absent2_y |
female |
Female | .0235471 .0460309 0.51 0.609 -.0666719 .1137661
|
grade |
1 | .1258281 .1262029 1.00 0.319 -.121525 .3731812
2 | .0765356 .1234674 0.62 0.535 -.165456 .3185273
3 | .1140317 .1202728 0.95 0.343 -.1216988 .3497621
4 | .0515892 .1250503 0.41 0.680 -.1935049 .2966834
5 | -.579284 .1184941 -4.89 0.000 -.8115281 -.3470398
6 | -.4856381 .1230282 -3.95 0.000 -.7267689 -.2445073
7 | -.3940879 .1272326 -3.10 0.002 -.6434593 -.1447165
8 | -1.13292 .1328692 -8.53 0.000 -1.393339 -.8725013
|
qob |
2 | .0444728 .0667551 0.67 0.505 -.0863648 .1753103
3 | -.066506 .0621175 -1.07 0.284 -.1882541 .0552422
4 | -.1014187 .0652931 -1.55 0.120 -.2293908 .0265533
|
tenure |
2+ Years | -.1819399 .0803638 -2.26 0.024 -.33945 -.0244298
1.hoauniverse | .3578143 .1210983 2.95 0.003 .1204661 .5951626
1.clf_foodDesert | -.0539854 .0505265 -1.07 0.285 -.1530155 .0450448
bfcluster3_any | .0507081 .0500948 1.01 0.311 -.047476 .1488922
bfcluster2_any | .1423138 .071538 1.99 0.047 .0021019 .2825257
bfcluster1_no | .0645889 .0281816 2.29 0.022 .0093539 .1198239
bmiz | -.0071974 .0146233 -0.49 0.623 -.0358586 .0214637
lnDist | .0534018 .0296226 1.80 0.071 -.0046576 .1114611
bg_hou_nocar | .0044374 .0014352 3.09 0.002 .0016246 .0072502
bg_pov_fam | .0000853 .0014438 0.06 0.953 -.0027445 .0029152
Asthma | .768883 .0191091 40.24 0.000 .7314299 .8063361
_cons | 2.093715 .1117106 18.74 0.000 1.874766 2.312663
-----------------+----------------------------------------------------------------
Asthma |
asthma1 | -.0946506 .0699218 -1.35 0.176 -.2316949 .0423937
asthma2 | .0719363 .0745035 0.97 0.334 -.074088 .2179605
asthma3 | -.043386 .0825359 -0.53 0.599 -.2051534 .1183814
asthma4 | .1359395 .0815909 1.67 0.096 -.0239758 .2958549
asthma5 | .0147389 .1025666 0.14 0.886 -.1862879 .2157657
asthma6 | .5695518 .1090366 5.22 0.000 .355844 .7832595
asthma7 | .2286916 .1157767 1.98 0.048 .0017734 .4556098
asthma8 | -.4843006 .1895517 -2.55 0.011 -.8558151 -.1127861
-----------------+----------------------------------------------------------------
var(e.Asthma)| 1 (constrained)
----------------------------------------------------------------------------------
However, when I include Step 1), I get an error:
. gsem (asthma1-asthma8 <- , logit lclass(C 3)) ///
> (Asthma <- asthma1-asthma8) ///
> (absent2_y <- i.Asthma $cov, poisson)
option lclass() not allowed;
option lclass() is not allowed with models specified with continuous latent variables
r(198);
end of do-file
r(198);
Given the error message, I tried specifying the second line as (Asthma <- asthma1-asthma8, logit), but the error remained.
I've spent time reading through the users forum and Stata manual but it's possible that I missed something. Any advice is appreciated.
Thank you,
Paul
I am getting my feet wet with Stata 15’s gsem suite. I am attempting to describe the relationship between asthma and school attendance using eight binary asthma variables for 1,496 students. My approach involves three steps that I would like to implement with gsem. They are:
- Characterize three classes of respondents based on the observed asthma responses: 1) low likelihood of asthma; 2) unmet asthma care needs; 3) managed asthma. These groups have been validated in a separate exploratory latent class analysis.
- Construct a latent indicator, L*, using the eight observed asthma indicators, which one might describe as being a person's probability of having a "true" asthma diagnosis.
- Examine the relationship between A* and attendance within each class, conditional on model covariates X
. gsem ///
> (Asthma <- asthma1-asthma8) ///
> (absent2_y <- i.Asthma $cov, poisson), var(e.Asthma@1)
Fitting fixed-effects model:
Iteration 0: log likelihood = -9603.4555
Iteration 1: log likelihood = -7825.1506
Iteration 2: log likelihood = -7807.8119
Iteration 3: log likelihood = -7807.7992
Iteration 4: log likelihood = -7807.7992
Refining starting values:
Grid node 0: log likelihood = -5029.6035
Fitting full model:
Iteration 0: log likelihood = -5029.6035
Iteration 1: log likelihood = -4939.0293
Iteration 2: log likelihood = -4896.8314
Iteration 3: log likelihood = -4881.4963
Iteration 4: log likelihood = -4881.2745
Iteration 5: log likelihood = -4881.2746
Generalized structural equation model Number of obs = 1,496
Response : absent2_y
Family : Poisson
Link : log
Log likelihood = -4881.2746
( 1) [/]var(e.Asthma) = 1
----------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-----------------+----------------------------------------------------------------
absent2_y |
female |
Female | .0235471 .0460309 0.51 0.609 -.0666719 .1137661
|
grade |
1 | .1258281 .1262029 1.00 0.319 -.121525 .3731812
2 | .0765356 .1234674 0.62 0.535 -.165456 .3185273
3 | .1140317 .1202728 0.95 0.343 -.1216988 .3497621
4 | .0515892 .1250503 0.41 0.680 -.1935049 .2966834
5 | -.579284 .1184941 -4.89 0.000 -.8115281 -.3470398
6 | -.4856381 .1230282 -3.95 0.000 -.7267689 -.2445073
7 | -.3940879 .1272326 -3.10 0.002 -.6434593 -.1447165
8 | -1.13292 .1328692 -8.53 0.000 -1.393339 -.8725013
|
qob |
2 | .0444728 .0667551 0.67 0.505 -.0863648 .1753103
3 | -.066506 .0621175 -1.07 0.284 -.1882541 .0552422
4 | -.1014187 .0652931 -1.55 0.120 -.2293908 .0265533
|
tenure |
2+ Years | -.1819399 .0803638 -2.26 0.024 -.33945 -.0244298
1.hoauniverse | .3578143 .1210983 2.95 0.003 .1204661 .5951626
1.clf_foodDesert | -.0539854 .0505265 -1.07 0.285 -.1530155 .0450448
bfcluster3_any | .0507081 .0500948 1.01 0.311 -.047476 .1488922
bfcluster2_any | .1423138 .071538 1.99 0.047 .0021019 .2825257
bfcluster1_no | .0645889 .0281816 2.29 0.022 .0093539 .1198239
bmiz | -.0071974 .0146233 -0.49 0.623 -.0358586 .0214637
lnDist | .0534018 .0296226 1.80 0.071 -.0046576 .1114611
bg_hou_nocar | .0044374 .0014352 3.09 0.002 .0016246 .0072502
bg_pov_fam | .0000853 .0014438 0.06 0.953 -.0027445 .0029152
Asthma | .768883 .0191091 40.24 0.000 .7314299 .8063361
_cons | 2.093715 .1117106 18.74 0.000 1.874766 2.312663
-----------------+----------------------------------------------------------------
Asthma |
asthma1 | -.0946506 .0699218 -1.35 0.176 -.2316949 .0423937
asthma2 | .0719363 .0745035 0.97 0.334 -.074088 .2179605
asthma3 | -.043386 .0825359 -0.53 0.599 -.2051534 .1183814
asthma4 | .1359395 .0815909 1.67 0.096 -.0239758 .2958549
asthma5 | .0147389 .1025666 0.14 0.886 -.1862879 .2157657
asthma6 | .5695518 .1090366 5.22 0.000 .355844 .7832595
asthma7 | .2286916 .1157767 1.98 0.048 .0017734 .4556098
asthma8 | -.4843006 .1895517 -2.55 0.011 -.8558151 -.1127861
-----------------+----------------------------------------------------------------
var(e.Asthma)| 1 (constrained)
----------------------------------------------------------------------------------
However, when I include Step 1), I get an error:
. gsem (asthma1-asthma8 <- , logit lclass(C 3)) ///
> (Asthma <- asthma1-asthma8) ///
> (absent2_y <- i.Asthma $cov, poisson)
option lclass() not allowed;
option lclass() is not allowed with models specified with continuous latent variables
r(198);
end of do-file
r(198);
Given the error message, I tried specifying the second line as (Asthma <- asthma1-asthma8, logit), but the error remained.
I've spent time reading through the users forum and Stata manual but it's possible that I missed something. Any advice is appreciated.
Thank you,
Paul
Comment