Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Re: Creating a column from point estimates across observations


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: Re: Creating a column from point estimates across observations
Date   Sat, 6 Jun 2009 22:09:27 +0200

<>

At the very least, you have to add the -clear- option to the command.

**********
clear*

input  cid:mylabel /*
*/score  iq  nutrit, auto
 C1  100   210  200
 C1   90   190  180
 C2   88   186  150
 C2   80   200  210
 C3   99   180  199
 C3   90   188  211
 C1   30   190  201
 C1   80   180  190
 C2   60   155  176
 C2   50   145  145
 C3   70   198  134
 C3   90   188  122
end

compress
statsby "regress score iq nutrit"/*
*/ _b, by(cid) clear
list, noobs
**********

Apart from that, it does work for me, and leads to


+-----------------------------------------+
cid        b_iq    b_nutrit      b_cons
-----------------------------------------
C1     1.83641   -2.448085    193.3595
C2     .791065   -.2396581   -25.36585
C3   -1.647576   -.0035126    398.4029
+-----------------------------------------+



HTH
Martin
_______________________
----- Original Message ----- From: "Sohini Sahu" <[email protected]>
To: <[email protected]>
Sent: Saturday, June 06, 2009 9:51 PM
Subject: st: Re: Creating a column from point estimates across observations


Thank you Martin.

I was trying out the Statsby command using the following dummy dataset. I
am using version 8 of STATA.

   +------------------------------+
    | cid   score    iq   nutrit~n |
    |------------------------------|
 1. |  C1     100   210        200 |
 2. |  C1      90   190        180 |
 3. |  C2      88   186        150 |
 4. |  C2      80   200        210 |
 5. |  C3      99   180        199 |
    |------------------------------|
 6. |  C3      90   188        211 |
 7. |  C1      30   190        201 |
 8. |  C1      80   180        190 |
 9. |  C2      60   155        176 |
10. |  C2      50   145        145 |
    |------------------------------|
11. |  C3      70   198        134 |
12. |  C3      90   188        122 |
    +------------------------------+

I saved the above in a file.
Then I gave the command
statsby "regress score iq nutrition " _b, by(cid)

I get this
command:      regress score iq nutrition
statistics:   b_iq       = _b[iq]
             b_nutrit~n = _b[nutrition]
             b_cons     = _b[_cons]
by:           cid

The data editor has 4 columns now: cid, b_iq, b_nutrit~n and    b_cons but
the cells are all empty! Any idea where I am going wrong?

S
*
*   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/


*
*   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/



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