Dear Statalisters,
I need to estimate non-linear SURE models (Poisson, negative binomial, ordered probit, zero-inflated) in StataNow 18.5 but am stuck on how to do so. Stata’s -gsem- command seems the best option because it allows one to specify various non-linear SUREs and it reports the joint log-likelihood value. Within -gsem-, I seem incapable of specifying the cross-equation covariance when the disturbances are non-Gaussian. (I’m moderately well-versed in estimating linear SURE models and aware of the semantic difference between SURE and multivariate models.)
For the sake of argument, assume I wish to estimate a Poisson SURE model. This allows me to demonstrate my problem using the user-contributed -bivpoisson- command and its data. The SURE example in -bivpoisson- works well (btw, it does not report the joint log-likelihood):
If I ignore the cross-equation covariance, -gsem- can easily estimate the same two-equation system:
However, I’m stuck on how to use -gsem- to estimate the same system with cross-equation covariance. The following code does not work because of the constrained constants but it might include something useful:
How can I use the -gsem- command to get close to replicating the -bivpoisson- estimate above? I feel I'm nearly there, but just can't work out the exact -gsem- options.
I need to estimate non-linear SURE models (Poisson, negative binomial, ordered probit, zero-inflated) in StataNow 18.5 but am stuck on how to do so. Stata’s -gsem- command seems the best option because it allows one to specify various non-linear SUREs and it reports the joint log-likelihood value. Within -gsem-, I seem incapable of specifying the cross-equation covariance when the disturbances are non-Gaussian. (I’m moderately well-versed in estimating linear SURE models and aware of the semantic difference between SURE and multivariate models.)
For the sake of argument, assume I wish to estimate a Poisson SURE model. This allows me to demonstrate my problem using the user-contributed -bivpoisson- command and its data. The SURE example in -bivpoisson- works well (btw, it does not report the joint log-likelihood):
Code:
use "https://github.com/zhangyl334/bivpoisson/raw/main/Health_Data.dta", clear bivpoisson (ofp = privins black numchron) (ofnp = privins black numchron age) ... Iteration 9: f(p) = -832.69538 Number of obs = 207 ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- ofp | privins | .3997619 .1830324 2.18 0.029 .0410251 .7584988 black | -.1335777 .1905021 -0.70 0.483 -.5069549 .2397995 numchron | .2380122 .053071 4.48 0.000 .133995 .3420294 _cons | .6682984 .1939622 3.45 0.001 .2881395 1.048457 -------------+---------------------------------------------------------------- ofnp | privins | 1.305625 .4458126 2.93 0.003 .4318481 2.179401 black | -2.151162 .919045 -2.34 0.019 -3.952457 -.3498668 numchron | .2358258 .1392374 1.69 0.090 -.0370744 .5087261 age | -.0809188 .3125795 -0.26 0.796 -.6935634 .5317259 _cons | -2.271814 2.292566 -0.99 0.322 -6.765161 2.221533 -------------+---------------------------------------------------------------- sigmasq1 | _cons | .8514477 .130599 6.52 0.000 .5954784 1.107417 -------------+---------------------------------------------------------------- sigmasq2 | _cons | 3.47855 .6043017 5.76 0.000 2.29414 4.66296 -------------+---------------------------------------------------------------- sigma12 | _cons | .4178387 .2111369 1.98 0.048 .004018 .8316593 ------------------------------------------------------------------------------
Code:
gsem (ofp <- privins black numchron, family(poisson) link(log)) /// (ofnp <- privins black numchron age, family(poisson) link(log)) ... Iteration 5: Log likelihood = -1269.1883 Generalized structural equation model Number of obs = 207 Response: ofp Family: Poisson Link: Log Response: ofnp Family: Poisson Link: Log Log likelihood = -1269.1883 ------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- ofp | privins | .3544521 .0806143 4.40 0.000 .196451 .5124532 black | .2887277 .0998223 2.89 0.004 .0930796 .4843758 numchron | .1585311 .0197342 8.03 0.000 .1198528 .1972094 _cons | 1.171029 .083035 14.10 0.000 1.008283 1.333774 -------------+---------------------------------------------------------------- ofnp | privins | 1.283982 .2688524 4.78 0.000 .7570411 1.810923 black | -1.665092 .5855751 -2.84 0.004 -2.812798 -.5173859 numchron | .1740241 .041588 4.18 0.000 .0925131 .2555352 age | -.0513212 .1111205 -0.46 0.644 -.2691134 .1664709 _cons | -.7977588 .843642 -0.95 0.344 -2.451267 .8557492 ------------------------------------------------------------------------------
Code:
gsem (ofp <- _cons@0 privins black numchron Const1, family(poisson) link(log)) /// (ofnp <- _cons@0 privins black numchron age Const2, family(poisson) link(log)), /// vsquish covstruct(_lexogenous, diagonal) latent(Const1 Const2) cov(Const1*Const2) nocapslatent ... Iteration 9: Log likelihood = -835.80108 Generalized structural equation model Number of obs = 207 Response: ofp Family: Poisson Link: Log Response: ofnp Family: Poisson Link: Log Log likelihood = -835.80108 ( 1) [ofp]_cons = 0 ( 2) [ofp]Const1 = 1 ( 3) [ofnp]_cons = 0 ( 4) [ofnp]Const2 = 1 ------------------------------------------------------------------------------------ | Coefficient Std. err. z P>|z| [95% conf. interval] -------------------+---------------------------------------------------------------- ofp | privins | .9009955 .1267399 7.11 0.000 .6525899 1.149401 black | .3153675 .2670429 1.18 0.238 -.208027 .838762 numchron | .3150931 .0543793 5.79 0.000 .2085117 .4216746 Const1 | 1 (constrained) _cons | 0 (omitted) -------------------+---------------------------------------------------------------- ofnp | privins | 1.619999 .5899405 2.75 0.006 .4637373 2.776262 black | -2.312566 1.181007 -1.96 0.050 -4.627297 .0021655 numchron | .2799475 .1482755 1.89 0.059 -.0106672 .5705621 age | -.4640784 .0925598 -5.01 0.000 -.6454924 -.2826644 Const2 | 1 (constrained) _cons | 0 (omitted) -------------------+---------------------------------------------------------------- var(Const1)| .9947875 .1421176 .7518405 1.316239 var(Const2)| 4.505426 1.070492 2.828068 7.177644 -------------------+---------------------------------------------------------------- cov(Const1,Const2)| .5386765 .260694 2.07 0.039 .0277256 1.049627 ------------------------------------------------------------------------------------
How can I use the -gsem- command to get close to replicating the -bivpoisson- estimate above? I feel I'm nearly there, but just can't work out the exact -gsem- options.
Comment