[R] sequential treatment of a vector for formula
dwinsemius at comcast.net
Thu May 27 16:09:58 CEST 2010
On May 27, 2010, at 12:42 AM, Wu Gong wrote:
> I don't know if my understanding of P is right.
> P ?= (the number of lives at the end of the interval)/(the number of
> at the beginning of the interval)
In standard actuarial parlance one would use lower case p_x for that
quantity and would reserve upper case P_x for the cumulative survival
fraction. The cumulative product of the p_x', P_x, with appropriate
corrections for censoring, was rebranded in biostatistical circles as
the Kaplan-Meier estimator.
> ### Compute proportion of a cohort that survives through the interval
> ### The formula is P0=L1/LO
> ## Original data is a vector of death days
> ## Count the frenquency of each death day
> ## Add more levels to fulfill days range
> tb <- table(factor(example,levels=seq(0, max(example))))
> ## Output
> iC <- data.frame("x"=names(tb),
In a fresh session that R code does not succeed, since the data.frame
function does not handle recursive references.
> A R learner.
David Winsemius, MD
West Hartford, CT
More information about the R-help