Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
240-276-1260 -Original Message- From: David Barron [mailto:dnbar...@gmail.com] Sent: Saturday, January 03, 2015 10:19 AM To: Muhuri, Pradip (SAMHSA/CBHSQ) Cc: r-help@r-project.org Subject: Re: [R] R function to convert person-level observations to person-period observations Your data are wron

Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread David Barron
Your data are wrong. The 'event' variable (dead in your example) needs to be 1 for cases that end in an event and 0 for spells that are censored: yours is the other way around. If you change the 'dead' variable to c(1,0,1) you will get the desired result. If you really need to reverse the behavio

[R] R function to convert person-level observations to person-period observations

2015-01-03 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, I was trying to convert person-level observations to person-period observations using an R custom function obtained from the UCLA web site (http://www.ats.ucla.edu/stat/r/faq/person_period.htm). Please see my reproducible example below. The function (PLPP) in the R script takes five a