Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Linear regression for individual subjects


From   Bryan Chung <[email protected]>
To   [email protected]
Subject   st: Linear regression for individual subjects
Date   Fri, 19 Jul 2002 14:49:50 -0600

I have a dataset that contains pain scores for people with heel pain. We
measured heel pain at 0, 2, 4, 6, and 12 weeks post-initiation of
treatment for heel pain. My data is organized such that I have six
variables: ID, time (which has the values 0, 2, 4, 6, and 12), and the
four pain scores (V1, V2, V3, and V4). What I am trying to do is to fit
a line for each pain score for each ID over time (i.e. pain score vs.
time). However, I am not sure how to do this. I suspect this involves
writing a do file, which may or may not be a problem for me. The problem
I have is that because I need a line to be fit (i.e. a beta 0
(intercept) and a beta 1 (slope)) for each individual, I need to iterate
a command for each observation, namely: regress v1 time if obs==x, where
x is the observation number. How does iteration work in Stata? Is there
a for loop equivalent?

Bryan

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index