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

st: RE: Calculating the changing proportion of a population with a certain property over time


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Calculating the changing proportion of a population with a certain property over time
Date   Mon, 12 Dec 2005 19:01:16 -0000

Create a variable 

gen is_one = prop == 1 

and

lowess is_one time 

egen mean_is_one = mean(is_one), by(time) 

etc. 

Nick 
[email protected] 

Steinar Fossedal
 
> I have a survival time dataset with customer information, and 
> I want to
> create a plot which shows the proportion of the population with a
> certain nominal property as it changes over time. Thus I would like to
> calculate the number of customers with the property at each time, and
> divide it to the number of total customers (or customers with another
> interesting property). Since there is not a record at each time t for
> every customer, I can't simply calculate it from the records directly.
> (- count if prop==1 & time==9 - would miss customers which got the
> property at time 8)
> 
> Any suggestions as to how I can do this? I played with the idea to
> create records for all time intervals, but I can't seem to 
> find an easy
> way to duplicate observations either.

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