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

st: RE: Re: parmby & Beta


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: parmby & Beta
Date   Tue, 15 Jul 2003 17:29:21 +0100

Roger Newson replied to Fred Wolfe

> >Is there anyway to get -parmby- output to include beta 
> (Beta), as in:
> >
> >  parmby "reg cutdown high pain_ haq_ depress glb  age sex 
> edlevel white 
> > inctouse duration, beta", saving(testme, replace) 
> for(estimate min95 
> > max95 %8.2f p %8.1e) li(*)
> 
> This is not a simple thing to do, because -regress- does 
> not save any such 
> estimation result as -e(Beta)-. However, you could always 
> standardise your 
> Y- and X-variables before doing your regression, as in the 
> following program:
> 
> foreach X of var cutdown high pain_ haq_ depress glb  age 
> sex edlevel white 
> inctouse duration {
>    summ `X'
>    replace `X'=(`X'-r(mean))/r(sd)
> }
> parmby "reg cutdown high pain_ haq_ depress glb  age sex 
> edlevel white 
> inctouse duration, beta", saving(testme, replace) 
> for(estimate min95 max95 
> %8.2f p %8.1e) li(*)
> 
> This would code all your Y- and X-variables to a scale of 
> SDs from the 
> mean, causing -estimate-, -min95- and -max95- to be 
> expressed in Y-axis SDs 
> per X-axis SD. To eliminate missing values listwise, you 
> might type instead:
> 
> gene byte listmiss=0
> foreach X of var cutdown high pain_ haq_ depress glb  age 
> sex edlevel white 
> inctouse duration {
>    replace listmiss=1 if missing(`X')
> }
> foreach X of var cutdown high pain_ haq_ depress glb  age 
> sex edlevel white 
> inctouse duration {
>    replace `X'=. if listmiss
>    summ `X'
>    replace `X'=(`X'-r(mean))/r(sd)
> }
> parmby "reg cutdown high pain_ haq_ depress glb  age sex 
> edlevel white 
> inctouse duration, beta", saving(testme, replace) 
> for(estimate min95 max95 
> %8.2f p %8.1e) li(*)
> 
> This would recode all your X- and Y-variables to missing in 
> observations 
> where any of the variables were previously missing, or to a 
> scale of SDs 
> from the mean otherwise, where the SDs and means are from 
> observations not 
> deleted listwise.

A detail here is the markout of missing values. 

Given 

. local varlist "cutdown high pain_ haq_ depress glb  age sex 
edlevel white inctouse duration"

There are two other ways to mark out the observations 
with any missings. 

. reg `varlist' 
. gen byte OK = e(sample) 

or 

. egen OK = rmiss(`varlist') 
. replace OK = !OK 

. qui foreach X of local varlist { 
. 	su `X' if OK
. 	replace `X' = (`X' - r(mean)) / r(sd) if OK 
. }

. parmby "reg `varlist'", saving(testme, replace) 
for(estimate min95 max95 %8.2f p %8.1e) li(*)

Nick 
n.j.cox@durham.ac.uk 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index