Dear all, I am having a (really) hard time getting pyears to work together with a ratetable to give me the number of expected events (deaths). I have the following data: dos, date of surgery, as.Date dof, date of last follow-up, as.Date dos, date of surgery, as.Date sex, gender, as.factor (female,male) ev, event(death), 0= censored at time point dof, 1=death at time point dof Could someone please help. I am searching the web 5 days now and I cannot find any simple example that I can reproduce or fit to my needs. I have managed to get the patient years the conventional way: I use pyears to tcut the follow up time by age and year of surgery, and by sex. Then I do cross multiplication with the life tables I have obtained and customized. I have seen that the use of a ratetable together with the pyears function can produce the expected deaths, but I have not been successful applying it to my data. Could someone please help me with the syntax? Many thanks in advance JT -- View this message in context: http://r.789695.n4.nabble.com/Survival-pyears-and-ratetable-expected-events-tp3553208p3553208.html Sent from the R help mailing list archive at Nabble.com.
>I am having a (really) hard time getting pyears to work together with a > ratetable to give me the number of expected events (deaths).The most complete discussion of pyears and rate tables is in a technical report from the Biostatistics group at Mayo http://mayoresearch.mayo.edu/mayo/research/biostat/ Number 63 I believe. Have you looked at that? Terry Therneau
I tried again but I cannot get a valid expected number of death directly from the pyear function. Using cross multiplication from Lifetables I am expecting in my cohort about 26 expected deaths (to match the 25 observed deaths). I have tried different variation of the pyears syntax but i get either 0.05 expected deaths or something like 25000. I have used different age and fu formats but I get no plausible result Could anyone help me with the syntax? Should the following syntax work getting the expected number of deaths? I am having no luck getting the thing to work. pyears(Surv(fu,ev)~ratetable(sex=sex, age=age,year=yearofsurgery), ratetable=expsurv.us, scale=365.25)$expected sex is a factor (male, female) ev=1 is death ev=0 censored at last fu fu is in days age is in days year of surgery is as.Date Any ideas? JT -- View this message in context: http://r.789695.n4.nabble.com/Survival-pyears-and-ratetable-expected-events-tp3553208p3556443.html Sent from the R help mailing list archive at Nabble.com.
On May 27, 2011, at 5:35 PM, Jim Trabas wrote:> I tried again but I cannot get a valid expected number of death > directly from > the pyear function. Using cross multiplication from Lifetables I am > expecting in my cohort about 26 expected deaths (to match the 25 > observed > deaths). I have tried different variation of the pyears syntax but i > get > either 0.05 expected deaths or something like 25000. I have used > different > age and fu formats but I get no plausible result > > Could anyone help me with the syntax? > > Should the following syntax work getting the expected number of > deaths? I am > having no luck getting the thing to work. > > pyears(Surv(fu,ev)~ratetable(sex=sex, age=age,year=yearofsurgery), > ratetable=expsurv.us, scale=365.25)$expectedHave you constructed a ratetable by that name? I do not see one in the datasets in the survival package.> > sex is a factor (male, female) > ev=1 is death ev=0 censored at last fu > fu is in days > age is in days > year of surgery is as.Date > > > Any ideas? > JT > > -- > View this message in context: http://r.789695.n4.nabble.com/Survival-pyears-and-ratetable-expected-events-tp3553208p3556443.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT
Hi thanks, The conventional method is solid (cross multiplication of patient years at each age and year and gender, with the corresponding risk for death at each age year and gender). I get about 26 expected deaths (verified by many different sources) Now what I am trying to do is get the same answer with the pyears function using a ratetable, and I am not being successful at all. Could one help be with the syntax, lets assume for now I want to use the survexp.us ratetable. Or help me with how my variables should be formated, (days? years? scale? asDate? Julian date? days difference from an origin? ) and entered in the pyears method? Or give me similar working example that I can decompose and fit to my problem? David sorry, I ment survexp.us (the standard in the survival package) Thanks to all, JT -- View this message in context: http://r.789695.n4.nabble.com/Survival-pyears-and-ratetable-expected-events-tp3553208p3557000.html Sent from the R help mailing list archive at Nabble.com.
> Should the following syntax work getting the expected number of > deaths? I am > having no luck getting the thing to work.> pyears(Surv(fu,ev)~ratetable(sex=sex, age=age,year=yearofsurgery), > ratetable=expsurv.us, scale=365.25)$expectedYour syntax is fine. It looks like you built your own rate table, and I'm guessing that something was done incorrectly at that step. The dimensions etc are fussy for a rate table, and it is easy to get them wrong. Terry Therneau