I am using Stata/SE 15.1.
I have difficulties in running a post-estimation test using "test", comparing two reverse adjacent contrasts estimated using "contrast" following "mixed".
The dependent variable of interest is BMQappre
The factor time has three factors: 0, 1, 2 reflecting t0, t1, t2
The variables studySite, BPTgroup, LFD describe the structure of the data, modelled as random effects.
I want to test, whether the difference in BMQappre from t1 to t2 is equal to the difference from t0 to t1, but I have difficulties in correctly pulling out the reverse adjacent contrast parameters (see output below).
Here is the
Code:
*** ==> The mixed command runs the mixed model and works fine mixed BMQappre i.time if ${all_manuscript01A} || studySite: || BPTgroup: || LFD: , reml dfmethod(kroger, eim) *** ==> The contrast command contrasts t2 with t1 and t1 with t0 using the reverse adjacent contrast prefix "ar."; this also looks to me as working fine. contrast ar.time, pveffects post nofvlabel *** ==> Now, I want to compare these two reverse adjacent contrasts using "test", but apparently I do something wrong, when pulling out the parameters reflecting "2 vs 1" and "1 vs 0"; so there is an error message test ar2.time == ar1.time
Thank you very much in advance!
Gunther
HERE ARE SOME SNIPPETS OF SAMPLE DATA:
Code:
input double BMQappre float(time studySite) double(BPTgroup LFD) 29 0 1 1 1 27 1 1 1 1 32 2 1 1 1 32 0 1 1 2 37 1 1 1 2 42 2 1 1 2 36 0 1 1 3 30 1 1 1 3 40 2 1 1 3 36 0 1 1 4 32 1 1 1 4 42 2 1 1 4 34 1 1 2 5 37 2 1 2 5 40 0 1 2 5 41 1 1 2 6 41 2 1 2 6 33 0 1 2 6 17 0 1 2 7 23 1 1 2 7 23 2 1 2 7 35 0 2 5 8 32 1 2 5 8 35 2 2 5 8 18 0 2 5 9 15 1 2 5 9 16 2 2 5 9 end label values time label_time label def label_time 0 "t0", modify label def label_time 1 "t1", modify label def label_time 2 "t2", modify
HERE IS THE OUTPUT FROM THE COMPLETE DATA SET (NOT FROM SAMPLE DATASNIPPETS ABOVE):
. *** ==> The mixed command runs the mixed model and works fine
. mixed BMQappre i.time if ${all_manuscript01A} || studySite: || BPTgroup: || LFD: , reml dfmethod(kroger, eim)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -350.22414
Iteration 1: log restricted-likelihood = -350.19123
Iteration 2: log restricted-likelihood = -350.19098
Iteration 3: log restricted-likelihood = -350.19098
Computing standard errors:
Computing degrees of freedom:
Mixed-effects REML regression Number of obs = 113
-------------------------------------------------------------
| No. of Observations per Group
Group Variable | Groups Minimum Average Maximum
----------------+--------------------------------------------
studySite | 2 48 56.5 65
BPTgroup | 7 14 16.1 18
LFD | 38 2 3.0 3
-------------------------------------------------------------
DF method: Kenward-Roger DF: min = 1.12
avg = 49.08
max = 73.12
F(2, 73.08) = 18.49
Log restricted-likelihood = -350.19098 Prob > F = 0.0000
------------------------------------------------------------------------------
BMQappre | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
time |
t1 | -1.486842 .8458535 -1.76 0.083 -3.172625 .1989409
t2 | 3.576918 .8541278 4.19 0.000 1.874691 5.279146
|
_cons | 29.90408 1.621449 18.44 0.025 13.97035 45.83781
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studySite: Identity |
var(_cons) | 4.32e-19 . . .
-----------------------------+------------------------------------------------
BPTgroup: Identity |
var(_cons) | 6.114891 8.854323 .3579764 104.4535
-----------------------------+------------------------------------------------
LFD: Identity |
var(_cons) | 43.69086 12.24502 25.22485 75.67504
-----------------------------+------------------------------------------------
var(Residual) | 13.5939 2.248831 9.82947 18.8
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 78.57 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
.
. *** ==> The contrast command contrasts t2 with t1 and t1 with t0 using the reverse adjacent contrast prefix "ar."; this also looks to me as working fine.
. contrast ar.time, pveffects post nofvlabel
Contrasts of marginal linear predictions
Margins : asbalanced
------------------------------------------------
| df chi2 P>chi2
-------------+----------------------------------
BMQappre |
time |
(1 vs 0) | 1 3.09 0.0788
(2 vs 1) | 1 35.16 0.0000
Joint | 2 37.00 0.0000
------------------------------------------------
-----------------------------------------------------
| Contrast Std. Err. z P>|z|
-------------+---------------------------------------
BMQappre |
time |
(1 vs 0) | -1.486842 .8458535 -1.76 0.079
(2 vs 1) | 5.063761 .8540279 5.93 0.000
-----------------------------------------------------
.
. *** ==> Now, I want to compare these two reverse adjacent contrasts using "test", but apparently I do something wrong, when pulling out the parameters reflecting "2 vs 1" and "1 vs 0"; so there is an error message
. test ar2.time == ar1.time
variable time not found
r(111);
0 Response to how to use test postestimation after contrast with ar. following mixed
Post a Comment