[R] finding the best cubic spline fitting
dwinsemius at comcast.net
Tue May 25 05:02:34 CEST 2010
On May 24, 2010, at 6:39 PM, Usman Munir wrote:
> I am trying to fit cubic spline to a data on mortality rate by age
> and year
> (1900-2008). The data is noisy and hence I would like to smooth
> using spline
> and also extrapolate beyond 2008. Data from 1900 to 1948 are very
> while data from 1948 to 2008 are reliable. I would like to have a
> weight for data between 1948 to 2008. I am not sure how to do this.
> When I
> smooth data from 1948 to 2008 I get sensible results for residual
> fitgam=gam(mortality~te(age,year, bs="cs"))
> However, if I smooth all the data 1900 to 1948 I get wierd residual
There were, after all, two World Wars and the Influenza Pandemic of
1918 in those years.
> have tried putting in knots i.e.
> fitgam=gam(logit_temp~te(age,year, bs="cs"), knot=list(years =
> But this doesn't work either. Any suggestions will be appreciated!
David Winsemius, MD
West Hartford, CT
More information about the R-help