Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: A linear fit within a child's record


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: A linear fit within a child's record
Date   Fri, 12 Oct 2007 16:16:34 +0100

Sounds, as far as Stata is concerned, like a case for -rolling-. 

The constraint that -flag == 1- might better be applied
retrospectively. 

Nick 
n.j.cox@durham.ac.uk 

Siyam, Amani
 
> Below is a segment I have of a child's record that includes 
> 22 visits: 
> 
>   +---------------------------------------------------------------+ 
>   | visit   sex   age   tage   weight    tweight   thresh    flag | 
>   |---------------------------------------------------------------| 
>   |    19     2   549    548     12.1       12.1        7       0 | 
>   |    20     2   583    609    12.35          .        7       1 | 
>   |    21     2   670    670    13.85      13.85        7       0 | 
>   +---------------------------------------------------------------+ 
> 
> I need your help to structure a STATA code that would perform 
> a linear fit within a child's record as follows: 
> 
> By child: 
>         take the observed weight when flag==1, the 
> weight[_n-1] and weight[_n+1]; 
>         regress the 3 points weights on the 3 points age 
> (age[_n], age[_n-1], age[_n+1]) 
>         and return the beta-coefficient of that model 
>         or 
>         predict tweight for tage(=609) if flag==1 using that model 

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