Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: How to Compare the Coefficients of Specific Variable where Each Group is Estimated Separately
From
Yuval Arbel <[email protected]>
To
statalist <[email protected]>
Subject
st: How to Compare the Coefficients of Specific Variable where Each Group is Estimated Separately
Date
Tue, 18 Dec 2012 22:16:33 -0800
Dear Statalisters,
I am running a -stcox- model on two groups, where my particular
interest is to compare the coefficients of the variable red_runmax1
The difference between the two coefficients is -0.0246686 and I would
like to show that this difference is significant
Below I'm attaching the full output
I tried to run the hausman test, and it worked fine.The problem is
that I need -suest- instead, and -suest- does not work with -stcox-
I also tried: "test
[eq1:_b[red_runmax1_down]]==[eq3:_b[red_runmax1_down]]" but I got an
error message.
Finally I tried to run the test on a model with interactions with the
dummy. The problem is that I don't get the estimated -0.0246686
difference of coefficients.
Any ideas will be highly appreciated.
P.S. If i don't have a choice I suppose I can construct the calculated
statistic manually. The question is whether stata has a shortcut
Here is the full output starting from the relevant part::
. stcox group2 runmax1_zero runmax1_down red_runmax1_down runmax1_zero2 runmax1
> _down2 red_runmax1_down2 if (group==0 | (group==1
> & group2==1)) & ref~=.,nohr
failure _d: fail == 1
analysis time _t: time_index
id: appt
Iteration 0: log likelihood = -52961.884
Iteration 1: log likelihood = -50674.015
Iteration 2: log likelihood = -50439.54
Iteration 3: log likelihood = -50404.933
Iteration 4: log likelihood = -50402.516
Iteration 5: log likelihood = -50402.474
Iteration 6: log likelihood = -50402.474
Iteration 7: log likelihood = -50402.474
Refining estimates:
Iteration 0: log likelihood = -50402.474
Cox regression -- Breslow method for ties
No. of subjects = 6738 Number of obs = 308083
No. of failures = 6738
Time at risk = 308491
LR chi2(7) = 5118.82
Log likelihood = -50402.474 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
> ----
_t | Coef. Std. Err. z P>|z| [95% Conf. Inter
> val]
------------------+------------------------------------------------------------
> ----
group2 | -1.754371 .3654717 -4.80 0.000 -2.470682 -1.0
> 3806
runmax1_zero | .0274737 .0006838 40.18 0.000 .0261334 .02
> 8814
runmax1_down | .029343 .0010589 27.71 0.000 .0272677 .031
> 4184
red_runmax1_down | -.0630043 .0029347 -21.47 0.000 -.0687562 -.057
> 2524
runmax1_zero2 | .011897 .0042914 2.77 0.006 .003486 .02
> 0308
runmax1_down2 | .0105009 .0049942 2.10 0.035 .0007125 .020
> 2892
red_runmax1_down2 | .0027031 .0165674 0.16 0.870 -.0297684 .035
> 1746
-------------------------------------------------------------------------------
> ----
. //outreg2 using "D:\kingston\public_housing\loss_aversion4.xls", replace tsta
> t asterisk(tstat) addstat(subjects, e(N_sub), fail
> ures, e(N_fail), Chi Square Statistics, e(chi2),log likelihood, e(ll) )
. nlcom _b[red_runmax1_down]+_b[red_runmax1_down2]
_nl_1: _b[red_runmax1_down]+_b[red_runmax1_down2]
------------------------------------------------------------------------------
_t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_nl_1 | -.0603012 .0163346 -3.69 0.000 -.0923165 -.028286
------------------------------------------------------------------------------
. //gen
. stcox runmax1_zero runmax1_down red_runmax1_down if (group==0 | (group==1 & g
> roup2==1)) & ref~=.,nohr
failure _d: fail == 1
analysis time _t: time_index
id: appt
Iteration 0: log likelihood = -52961.884
Iteration 1: log likelihood = -50735.416
Iteration 2: log likelihood = -50517.039
Iteration 3: log likelihood = -50486.867
Iteration 4: log likelihood = -50485.033
Iteration 5: log likelihood = -50485.023
Refining estimates:
Iteration 0: log likelihood = -50485.023
Cox regression -- Breslow method for ties
No. of subjects = 6738 Number of obs = 308083
No. of failures = 6738
Time at risk = 308491
LR chi2(3) = 4953.72
Log likelihood = -50485.023 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
> ---
_t | Coef. Std. Err. z P>|z| [95% Conf. Interv
> al]
-----------------+-------------------------------------------------------------
> ---
runmax1_zero | .0278138 .0006674 41.67 0.000 .0265057 .0291
> 219
runmax1_down | .0293033 .0010319 28.40 0.000 .0272808 .0313
> 257
red_runmax1_down | -.0626103 .002899 -21.60 0.000 -.0682921 -.0569
> 284
-------------------------------------------------------------------------------
> ---
. outreg2 using "D:\kingston\public_housing\loss_aversion4.xls", replace tstat
> asterisk(tstat) addstat(subjects, e(N_sub), failur
> es, e(N_fail), Chi Square Statistics, e(chi2),log likelihood, e(ll) )
D:\kingston\public_housing\loss_aversion4.xls
dir : seeout
. estimates store eq1
.
. stcox runmax1_zero runmax1_down red_runmax1_down if group==1 & ref~=.,nohr
failure _d: fail == 1
analysis time _t: time_index
id: appt
Iteration 0: log likelihood = -1485.5571
Iteration 1: log likelihood = -1371.0364
Iteration 2: log likelihood = -1369.2168
Iteration 3: log likelihood = -1369.1651
Iteration 4: log likelihood = -1369.165
Refining estimates:
Iteration 0: log likelihood = -1369.165
Cox regression -- Breslow method for ties
No. of subjects = 310 Number of obs = 23971
No. of failures = 310
Time at risk = 23995
LR chi2(3) = 232.78
Log likelihood = -1369.165 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
> ---
_t | Coef. Std. Err. z P>|z| [95% Conf. Interv
> al]
-----------------+-------------------------------------------------------------
> ---
runmax1_zero | .0309905 .0031046 9.98 0.000 .0249056 .0370
> 755
runmax1_down | .0225985 .0041437 5.45 0.000 .0144771 .0307
> 199
red_runmax1_down | -.0412099 .0112469 -3.66 0.000 -.0632535 -.0191
> 663
-------------------------------------------------------------------------------
> ---
. estimates store eq2
. outreg2 using "D:\kingston\public_housing\loss_aversion4.xls", tstat asterisk
> (tstat) addstat(subjects, e(N_sub), failures, e(N_
> fail), Chi Square Statistics, e(chi2),log likelihood, e(ll) )
D:\kingston\public_housing\loss_aversion4.xls
dir : seeout
.
. stcox runmax1_zero runmax1_down red_runmax1_down if ((group==1 & group2==1))
> & ref~=.,nohr
failure _d: fail == 1
analysis time _t: time_index
id: appt
Iteration 0: log likelihood = -846.98151
Iteration 1: log likelihood = -787.50564
Iteration 2: log likelihood = -786.90072
Iteration 3: log likelihood = -786.88341
Iteration 4: log likelihood = -786.88338
Refining estimates:
Iteration 0: log likelihood = -786.88338
Cox regression -- Breslow method for ties
No. of subjects = 195 Number of obs = 17214
No. of failures = 195
Time at risk = 17226
LR chi2(3) = 120.20
Log likelihood = -786.88338 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
> ---
_t | Coef. Std. Err. z P>|z| [95% Conf. Interv
> al]
-----------------+-------------------------------------------------------------
> ---
runmax1_zero | .0358589 .0054647 6.56 0.000 .0251483 .0465
> 696
runmax1_down | .0249492 .0062168 4.01 0.000 .0127646 .0371
> 338
red_runmax1_down | -.0379417 .0158971 -2.39 0.017 -.0690994 -.006
> 784
-------------------------------------------------------------------------------
> ---
. estimates store eq3
. outreg2 using "D:\kingston\public_housing\loss_aversion4.xls", tstat asterisk
> (tstat) addstat(subjects, e(N_sub), failures, e(N_
> fail), Chi Square Statistics, e(chi2),log likelihood, e(ll) )
D:\kingston\public_housing\loss_aversion4.xls
dir : seeout
. //testnl _b[eq1:red_runmax1_down]==_b[eq2:red_runmax1_down]
. //testnl [eq1]red_runmax1_down==[eq3]red_runmax1_down
. //gen
. //test [eq1:_b[red_runmax1_down]]==[eq3:_b[red_runmax1_down]]
. hausman eq1 eq2
---- Coefficients ----
| (b) (B) (b-B) sqrt(diag(V_b-V_B))
| eq1 eq2 Difference S.E.
-------------+----------------------------------------------------------------
runmax1_zero | .0278138 .0309905 -.0031767 .
runmax1_down | .0293033 .0225985 .0067048 .
red_runmax~n | -.0626103 -.0412099 -.0214004 .
------------------------------------------------------------------------------
b = consistent under Ho and Ha; obtained from stcox
B = inconsistent under Ha, efficient under Ho; obtained from stcox
Test: Ho: difference in coefficients not systematic
chi2(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= -13.52 chi2<0 ==> model fitted on these
data fails to meet the asymptotic
assumptions of the Hausman test;
see suest for a generalized test
. hausman eq1 eq3
---- Coefficients ----
| (b) (B) (b-B) sqrt(diag(V_b-V_B))
| eq1 eq3 Difference S.E.
-------------+----------------------------------------------------------------
runmax1_zero | .0278138 .0358589 -.0080451 .
runmax1_down | .0293033 .0249492 .0043541 .
red_runmax~n | -.0626103 -.0379417 -.0246686 .
------------------------------------------------------------------------------
b = consistent under Ho and Ha; obtained from stcox
B = inconsistent under Ha, efficient under Ho; obtained from stcox
Test: Ho: difference in coefficients not systematic
chi2(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= -16.10 chi2<0 ==> model fitted on these
data fails to meet the asymptotic
assumptions of the Hausman test;
see suest for a generalized test
.
. test [eq1:_b[red_runmax1_down]]==[eq3:_b[red_runmax1_down]]
eq1:_b invalid name
r(198);
end of do-file
--
Dr. Yuval Arbel
School of Business
Carmel Academic Center
4 Shaar Palmer Street,
Haifa 33031, Israel
e-mail1: [email protected]
e-mail2: [email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/