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: predicting height by age for each individual
From
"Y.R.E. Retamal" <[email protected]>
To
[email protected]
Subject
Re: st: predicting height by age for each individual
Date
Thu, 30 Jan 2014 17:01:36 +0000
Dear Maarten
Thank you very much for your comments. I know that height do not change
linearly with age, I just put this equation to simplify my question. My
question is more related to automatize regressions (and their
predictions) than the equation itself. Nevertheless, thank you very much
for your advice
Concerning your second comment, I am sorry, I committed a mistake. I
wanted to put: predict xb if id==1. Thus, the predicted values will be
filled just in the cells associated to id 1. Problems begin from the
second individual (id 2), because xb is already defined. So, I would
have to put a different name to variable xb for id==2, e.g. xb2, which
will have non missing values just for id==2. After that:
replace xb=xb2 if id==2
drop xb2
putting the predicted values for id==1 and id==2 in just one variable.
I would like to automatize all this procedure.
I hope have been clearer
Rodrigo
On 2014-01-30 15:47, Maarten Buis wrote:
I have two comments:
As a father I can tell you that height does not change linearly with
age in that period. You might want to look at -fp- in order to create
a reasonable model.
Imangine what happens in your code when you have three persons. Your
first regression will fill in for person 2 and 3, your second
regression will be used to fill in 1 and 3, but wait.. you already
filled in for person 3. What do you want to do in that case?
-- Maarten
On Thu, Jan 30, 2014 at 4:26 PM, Y.R.E. Retamal <[email protected]>
wrote:
Dear STATA users
I am studying growth and development in children from 0 to 3 years
old. I am
using a longitudinal database of children where height and weight were
measured from birth to three years old (1600 children).
I would like to predict height of each child from birth until three
years
old for each six months (birth, 6, 12, 18, ..., 36 month), after
running a
linear regression of height by age for each child, not all at the same
time.
For example, I have the following database:
id month height
1 0 59
1 6 68
1 12 70
1 18 74
1 24 81
1 30 86
1 36 94
2 0 50
2 6 55
2 12 74
2 18 80
2 24 82
2 30 87
2 36 95
I could do:
reg height month if id==1
predict xb if id!=1
reg height month if id==2
predict xb if id!=2
and so...
But, I have 1600 children, therefore I should write the same commands
per
each child (1600 times), something truly inefficient and tedious.
There is a
command or program to run the same commands, but automatically?
Any help would be very appreciated.
Rodrigo
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
--
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/