Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Stratifying after regression (with 2 interactions)


From   "Raoul C Reulen" <[email protected]>
To   <[email protected]>
Subject   RE: st: Stratifying after regression (with 2 interactions)
Date   Thu, 1 Dec 2005 15:56:06 -0000

Both solutions give different results. What solution would be preferable
if you want to stratify by age andsex because of an interaction
involving these variables? Use "if age==1 & sex==0" as described below
or use .lincom? 
In the first option you will only use data available in the strata, by
using .lincom you will use all data and have less degrees of freedom. 

Thanks

xi: reg BP group if age==1 & sex==0 (males, first age group)


Raou

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 01 December 2005 14:32
To: [email protected]
Subject: RE: st: Stratifying after regression (with 2 interactions)

What is "correct" will always depend on your view of the processes
generating the data, which are not apparent. 

It may be that what you want can be done cleanly by 

egen age_sex = group(age sex), label. 

and then using age_sex as the basis for one set of predictors. 

Nick
[email protected] 

Raoul C Reulen
 
> thanks for that. 
> 
> But I am still a bit confused about what to do in the following
> situation:
> 
> .xi: regress BP i.age*group i.sex*group
> 
> I want to know the difference between groupA and groupB for males in 
> the first age group, then for females in the first age group, then for

> males in the second age group etc.? How do I do this? Simply by:
> 
> .xi: reg BP group if age==1 & sex==0 (males, first age group)
> 
> .xi reg BP group if age==1 & sex==1 (females, first age group)
> 
> .xi reg BP group if age=2 & sex==0 (males, second age group)
> 
> Or is this incorrect since you don't use the whole model? If correct, 
> there must be an easier way to do this.

Joseph Coveney
 
> Raoul C Reulen wrote:
> 
> I am comparing the blood pressure between two groups by means of 
> multivariable regression. This is the regression model:
> 
> .xi: regress BP i.age*group i.sex*group
> 
> [omitted]
> 
> . . . how do I stratify the variable 'group' also for 'sex' AND age?
> I want to now the regression coefficient of variable group, by age and

> sex.
> 
> --------------------------------------------------------------
> ----------
> --------
> 
> If you're looking only for two two-way interactions, then -xi- will do

> it without any trouble (see below).
> 
> See also Michael Mitchell's & Phil Ender's -xi3-, especially if you 
> eventually will want the third two-way interaction and the three-way 
> interaction (although -xi- will do that, too; it just takes a couple 
> of passes).  Type:
> 
> findit xi3
> 
> on the command line form within Stata for more information.
 
> clear
> set more off
> sysuse bplong
> rename when group
> xi: regress bp i.agegrp*i.group i.sex*i.group // or
> xi3: regress bp i.agegrp*i.group i.sex*i.group // for the saturated 
> model
> xi3: regress bp i.agegrp*i.sex*i.group exit

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index