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: Constructing a variable from standard deviations
From
Stas Kolenikov <[email protected]>
To
[email protected]
Subject
Re: st: Constructing a variable from standard deviations
Date
Sat, 20 Nov 2010 17:25:59 -0600
-tabstat- is far from the most appropriate command for this purpose.
There are several ways to achieve what you need.
1. Use -egen- command:
egen sdy = sd( y )
2. Use saved results from -summarize- (type -return list- to find out
what these are):
sum y
gen sdy = r(sd)
I personally think that having a variable equal to a constant is a
data management oxymoron... variable must vary, by the virtue of its
name :). You probably only need it for another step or two in data
analysis, e.g., if you want to simulate a new set of errors with the
same variance:
sum y
gen new_y = rnormal()*r(sd)
On Sat, Nov 20, 2010 at 9:36 AM, M.P.J. van Zaal
<[email protected]> wrote:
> Dear reader,
>
> I have a problem with constructing a new a variable from the standard
> deviations of regressions residuals. I have generated 104 different
> regression residuals and then use tabstat to determine their standard
> deviations. I need to construct a new variable from these 104 standard
> deviations of the regression residuals for the next step in my analysis.
>
> I know that the tabstat has a save options to save the summary
> statistics in a matrix. Unfortunately when I use this option no matrix
> is created (nothing happens). Does anyone know how i can save the
> standard deviations in as a new variable, possible using tabstat or
> another method.
>
> Thanks for your attention and help
>
> regards,
>
> Mathijs
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/