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]
Re: st: How to apply and interpret lincom function as an additional analysis to xtmixed
From
Steve Samuels <[email protected]>
To
[email protected]
Subject
Re: st: How to apply and interpret lincom function as an additional analysis to xtmixed
Date
Wed, 8 Jan 2014 18:05:26 -0500
Jakob Nielsen has two groups, 4 time points in the first, and three in
the second group. He wants to use -lincom- to get some pre-specified
comparisons (if not pre-specified, then he needs a multiple comparison
correction).
What Jakob has "been told" to do is not correct. Here are solutions that
will do as he asked. Prefix all by -lincom-
Group 1
_Itime2 - _Itime3 /* compare 2 & 3 */
_Itime2 - _Itime4 /* compare 2 & 4 */
_Itime3 - _Itime4 /* 3 & 4 */
Group 2
_Itime_3 +_ItimXgro_3 _2 /* 3 and 1 */
_Itime_2 +_ItimXgro_2_2 /* 2 and 1 */
_Itime_3 +_ItimXgro_3 _2 - (_Itime_2 +_ItimXgro_2_2 ) /* 3 and 2 */
As Maarten points out this will be much easier with, -margins-, here
applied to -regress-
*******************START******************
sysuse auto, clear
gen group = foreign +1
recode rep78 1/2=3
qui reg mpg rep78##group
/* cell means and standard errors*/
margins rep78#group
/* repeat margins with -coeflegend-
to see coefficient names
& -post- results to use -lincom- */
margins rep78#group, coeflegend post
/* Compare rep78 = 3 to rep78 = 4 for groups = 1 & 2
Ignore the "bn" in the variable name*/
lincom _b[3.rep78#1.group] - _b[4.rep78#1.group]
lincom _b[3.rep78#2.group] -_b[4.rep78#2.group]
/* pwcompare: all pairwise comparisons: */
qui reg mpg rep78##group
margins rep78#group, pwcompare
********************STOP*****************
Steve
[email protected]
On Jan 3, 2014, at 11:02 AM, Jakob Nielsen wrote:
Im using tmixed and need to make a post estimation analysis (lincom) in
addition to the information I get from the xtmixed analysis. However, I
have doubt how to write the command correctly.
I am using Stata 12.1 for windows.
-----
Firstly,
my dataset consists of two groups performing two different
interventions. There is an uneven number of measurement points between
the groups (4 vs. 3), but the first three measurements have been
performed at the same time between the groups.
Group 1 Group 2
id Trial 1 Trial 2 Trial 3 Trial 4 Id Trial 1 Trial 2 Trial 3
FP1 x.xx x.xx x.xx x.xx FP13 x.xx x.xx x.xx
Fp2 x.xx x.xx x.xx x.xx Fp14 x.xx x.xx x.xx
FP3 x.xx x.xx x.xx x.xx FP15 x.xx x.xx x.xx
FP4 x.xx x.xx x.xx x.xx FP16 x.xx x.xx x.xx
FP5 x.xx x.xx x.xx x.xx FP19 x.xx x.xx x.xx
FP6 x.xx x.xx x.xx x.xx FP20 x.xx x.xx x.xx
FP7 x.xx x.xx x.xx x.xx FP21 x.xx x.xx x.xx
FP9 x.xx x.xx x.xx x.xx
FP10 x.xx x.xx x.xx x.xx
FP11 x.xx x.xx x.xx x.xx
When I compute the xtmixed analysis, I have the above data on the long format, and I get an output looking like this:
----
. xi: xtmixed measurement i.time*i.group || id: ,mle
i.time _Itime_1-4 (naturally coded; _Itime_1 omitted)
i.group _Igroup_1-2 (naturally coded; _Igroup_1 omitted)
i.time*i.group _ItimXgro_#_# (coded as above)
note: _ItimXgro_4_2 omitted because of collinearity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log likelihood = 68.201963
Iteration 1: log likelihood = 68.202082
Iteration 2: log likelihood = 68.202082
Computing standard errors:
Mixed-effects ML regression Number of obs = 60
Group variable: id Number of groups = 17
Obs per group: min = 3
avg = 3.5
max = 4
Wald chi2(6) = 164.59
Log likelihood = 68.202082 Prob> chi2 = 0.0000
-------------------------------------------------------------------------------
measurement | Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
_Itime_2 | .3080587 .032767 9.40 0.000 .2438365 .3722809
_Itime_3 | .257 .0317744 8.09 0.000 .1947233 .3192767
_Itime_4 | .238 .0317744 7.49 0.000 .1757233 .3002767
_Igroup_2 | .0041429 .0391134 0.11 0.916 -.0725181 .0808038
_ItimXgro_2_2 | -.3109158 .0501596 -6.20 0.000 -.4092268 -.2126049
_ItimXgro_3_2 | -.2541429 .0495169 -5.13 0.000 -.3511941 -.1570916
_ItimXgro_4_2 | 0 (omitted)
_cons | .103 .0250987 4.10 0.000 .0538075 .1521925
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Identity |
sd(_cons) | .0353746 .0129137 .0172964 .0723481
-----------------------------+------------------------------------------------
sd(Residual) | .0710498 .0075191 .0577405 .0874268
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 3.15 Prob>= chibar2 = 0.0379
.----
This
is all fine. However in addition to this, I would like to get a
comparison within group comparison of the timepoints, which is not
provided with the xtmixed analysis.
That being:
Group 1: time 2 and 3
Group 1: time 2 and 4
Group 1: time 3 and 4
And
Group 2: time 1 and 2
Group 2: time 1 and 3
Group 2: time 2 and 3
I have been told that the command to use is the following lincom commands:
Group 1:
lincom _Itime_2 + _Itime_3
( 1) [measurement]_Itime_2 + [measurement]_Itime_3 = 0
------------------------------------------------------------------------------
measurement | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .5650587 .0556139 10.16 0.000 .4560574 .6740599
------------------------------------------------------------------------------
This should compare time 2 with time 3 in group 1.
Group 2:
lincom _Itime_2 + _ItimXgro_3_2
( 1) [measurement]_Itime_2 + [measurement]_ItimXgro_3_2 = 0
------------------------------------------------------------------------------
measurement | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .0539158 .0501596 1.07 0.282 -.0443951 .1522268
------------------------------------------------------------------------------
This should compare time 2 with time 3 in group 2.
However,
I am not entirely sure, whether I have setup the command correctly.
Thus, the question is, whether the above lincom command is correct setup
in regards to the purpose (within group comparisons of time 2 and 3)?
Thanks in advance.
Best, Jakob Nielsen
*
* 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/
*
* 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/