Statalist


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

Re: st: RE: Duration and average frequency of examination


From   MAY BAYDOUN <[email protected]>
To   [email protected]
Subject   Re: st: RE: Duration and average frequency of examination
Date   Wed, 11 Jun 2008 10:52:09 -0700 (PDT)

Dear Martin,


Thanks a lot for your help. I think I got it. The code
is:


sort id age_visit
drop total_duration average_freq  
by id: gen total_duration =age_visit[_N] -
age_visit[1]

by id: gen average_freq=1/(total_duration /_N)

The frequency represents the average number of times
per year that a person is examined. So, if it is once
a year, it would be one, if it is once every two
years, it would be 0.5 etc. 

By applying this code I obtained a mean duration of 22
years and a mean frequency of 0.6 which is about
right. Thanks again!

May

--- Martin Weiss <[email protected]>
wrote:

> Duration is the easy one here:
> 
> bys id: g duration=ageatvisit[_N]-ageatvisit[1]
> 
> But I just do not know what your frequency is
> supposed to mean. Please
> specify...
> 
> Martin Weiss
>
_________________________________________________________________
> 
> Diplom-Kaufmann Martin Weiss
> Mohlstrasse 36
> Room 415
> 72074 Tuebingen
> Germany
> 
> Fon: 0049-7071-2978184
> 
> Home:
>
http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130
> 
> Publications:
>
http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131
> 
> SSRN:
>
http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945
> 
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On
> Behalf Of MAY BAYDOUN
> Sent: Tuesday, June 10, 2008 7:46 PM
> To: [email protected]
> Subject: st: Duration and average frequency of
> examination
> 
> Dear statalisters,
> 
> I was wondering if you could help me figure out a
> way
> to obtain the frequency at which each individual was
> examined (i.e. average number of follow-up visits
> per
> year) and the total duration (i.e. time between
> first
> and last visit) if the dataset is person-period
> format
> and I have the following structure:
> 
> id visit age at visit
> 1  1     30 
> 1  2     32
> 1  3     36 
> 1  4     50
> 2  1     45
> 2  2     46
> 3  3     50
> 3  4     56 
> 3  5     60
> 3  6     65
> 4  1     42
> 4  2     48
> 
> In other words, the distance in age between visits
> varies for each individual, the number of visits is
> not the same and the age at baseline varies as well.
> 
> 
> So, I would like to obtain the following variables
> (made up numbers for frequencies):
> 
> id  Freq Duration
> 1   0.5   20 
> 2   0.4   1
> 3   0.3   15  
> 4   0.6   6 
> 
> The duration for individual 1 for example is:
> 50-30
> 
> The average frequency is the tricky one I guess, it
> is
> for individual 1:
> [1/(32-30) + 1/(36-32) + 1/(50-36)]/4
> 
> Thanks a lot and hope to hear from you soon,
> 
> Sincerely yours,
> 
> May
> 
> 
> May Baydoun, PhD in Epidemiology (UNC-Chapel Hill) 
> Staff Scientist,
>   National Institute on Aging, NIH/IRP,  Biomedical
> Research Center,
>   Baltimore, MD
> 
> 
> 
> 
> May Baydoun, PhD in Epidemiology (UNC-Chapel Hill) 
> Staff Scientist,
> National Institute on Aging, NIH/IRP,  Biomedical
> Research Center,
> Baltimore, MD
> 
> 
>       
> *
> *   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/
> 
> *
> *   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/
> 


May Baydoun, PhD in Epidemiology (UNC-Chapel Hill)  Staff Scientist,  National Institute on Aging, NIH/IRP,  Biomedical Research Center,  Baltimore, MD


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