Statalist


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

st: A linear fit within a child's record


From   "Siyam, Amani" <[email protected]>
To   <[email protected]>
Subject   st: A linear fit within a child's record
Date   Thu, 11 Oct 2007 22:02:43 +0200

Dear Stata-users, 

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 

Many thanks for your help in advance. 

All the best, 

Amani 

<<winmail.dat>>




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