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   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Stratifying after regression (with 2 interactions)
Date   Thu, 1 Dec 2005 16:11:35 -0000

As conventionally defined, an interaction between age 
and sex requires age and sex to be separate variables. 
And I don't think you can fit an interaction between 
age and sex properly by leaving out a large chunk 
of the data. 

As before, it seems that you want to be told what 
is "correct" or even "preferable" without putting
your cards on the table about what you think 
is producing the data. I doubt there is an intrinsically
statistical answer to your questions independent of 
the science motivating your modelling. If there is 
no science, or you don't know what it is, you are
back to whatever fits best, plus or minus some 
parsimony criterion. 

Nick 
[email protected] 

Raoul C Reulen
 
> 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)

Nick Cox
 
> 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. 
 
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/



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