[R] Fitting a survival curve
Ben Bolker
bolker at zoo.ufl.edu
Tue Nov 14 23:30:53 CET 2006
Richard Pitman <richard.pitman3 <at> btopenworld.com> writes:
>
> I am new to R and am trying to fit a survival curve with a weibull
> hazard function to a set of data giving the probability of survival to
> age x, given the year of birth, in the form:
>
> Probability of survival:
> Birth year
> 1980 1981 ... 2003
> .2 0.90 0.89 ... 0.87
> 1 0.80 0.81 ... 0.79
> age 2 0.75 0.74 ... 0.73
> 3 0.70 0.69 ... 0.68
> 5 0.50 0.49 ... 0.43
> 10 0.30 0.31 ... 0.26
>
> I would like to be able to fit a curve to each birth cohort, extrapolate
> the curve a few years and be able to create a plot of the survival
> curves.
>
You don't have enough data for a standard survival analysis,
which is based on individual-level survival times. (You don't
even know the total cohort size, which you would need to know
to fit a binomial model.) However, you can compute the _expected_
probabilities of survival to age a using dweibull(a) [or,
since your categories are fairly coarse, pweibull(a2)-pweibull(a1)].
As a starting point, you could try a least-squares fit through
the data -- again, this is not quite right, but in the
absence of information about sample size it's a little hard
to know how to weight the different points.
Hope that helps.
Ben Bolker
More information about the R-help
mailing list