Hi all,
I'm trying to estimate a simple auto-regressive model with SEM command, using both long and wide data formats, but I can't seem to get it to be identical as I think it should be.
Here's a simple code, where I use the web-data of nlswork, limiting it to only 3 years of data (1968 to 1970):
In the wide format I need to be more explicit in constraining some of the paramters to be equal (I think). For that I constrained the AR coefficients to be identical (lag), the intercepts to be identical (cons) and the error terms to be identical (E).
Here's the output, very similar coefficients but not identical:
long:
wide
Any guidance would be greatly appreciated!
I'm trying to estimate a simple auto-regressive model with SEM command, using both long and wide data formats, but I can't seem to get it to be identical as I think it should be.
Here's a simple code, where I use the web-data of nlswork, limiting it to only 3 years of data (1968 to 1970):
Code:
clear all webuse nlswork, clear keep idcode year ln_wage keep if year <= 70 * SEM in long format sem (ln_wage <- l1.ln_wage) * SEM in wide format reshape wide ln_wage, i(idcode) j(year) sem (ln_wage68@lag _cons@cons -> ln_wage69, ) (ln_wage69@lag _cons@cons -> ln_wage70, ) , /// var(e.ln_wage69@E e.ln_wage70@E) nocapslatent
Here's the output, very similar coefficients but not identical:
long:
Code:
Endogenous variables Observed: ln_wage Exogenous variables Observed: L.ln_wage Fitting target model: Iteration 0: log likelihood = -794.93331 Iteration 1: log likelihood = -794.93331 Structural equation model Number of obs = 1,852 Estimation method: ml Log likelihood = -794.93331 ------------------------------------------------------------------------------- | OIM | Coefficient std. err. z P>|z| [95% conf. interval] --------------+---------------------------------------------------------------- Structural | ln_wage | ln_wage | L1. | .7021511 .0160968 43.62 0.000 .670602 .7337002 _cons | .5145363 .0251871 20.43 0.000 .4651705 .5639021 --------------+---------------------------------------------------------------- var(e.ln_wage)| .0623013 .0020473 .0584151 .0664461 ------------------------------------------------------------------------------- LR test of model vs. saturated: chi2(0) = 0.00 Prob > chi2 = .
Code:
(1513 observations with missing values excluded) Endogenous variables Observed: ln_wage69 ln_wage70 Exogenous variables Observed: ln_wage68 Fitting target model: Iteration 0: log likelihood = -261.74268 Iteration 1: log likelihood = -260.83664 Iteration 2: log likelihood = -260.83456 Iteration 3: log likelihood = -260.83456 Structural equation model Number of obs = 719 Estimation method: ml Log likelihood = -260.83456 ( 1) - [ln_wage69]ln_wage68 + [ln_wage70]ln_wage69 = 0 ( 2) [/]var(e.ln_wage69) - [/]var(e.ln_wage70) = 0 ( 3) [ln_wage69]_cons - [ln_wage70]_cons = 0 --------------------------------------------------------------------------------- | OIM | Coefficient std. err. z P>|z| [95% conf. interval] ----------------+---------------------------------------------------------------- Structural | ln_wage69 | ln_wage68 | .6771415 .0183876 36.83 0.000 .6411025 .7131806 _cons | .5610107 .0293061 19.14 0.000 .5035719 .6184496 --------------+---------------------------------------------------------------- ln_wage70 | ln_wage69 | .6771415 .0183876 36.83 0.000 .6411025 .7131806 _cons | .5610107 .0293061 19.14 0.000 .5035719 .6184496 ----------------+---------------------------------------------------------------- var(e.ln_wage69)| .0578137 .0021561 .0537386 .0621979 var(e.ln_wage70)| .0578137 .0021561 .0537386 .0621979 --------------------------------------------------------------------------------- LR test of model vs. saturated: chi2(4) = 97.42 Prob > chi2 = 0.0000
Comment