[R] how to interpret coefficients for a natural spline smooth function in a GLM
spencerg
spencer.graves at prodsyse.com
Sun Jun 28 03:49:01 CEST 2009
I have not seen a reply to this question, so I will offer a
comment; someone who knows more than I may correct or add to my comments.
There are many different kinds of splines. Perhaps the most
common are B-splines, which sum to 1 inside their range of definition
and are 0 outside. Natural splines are similar, but support
extrapolation outside the (finite) range of definition. A natural cubic
spline extrapolates as straight lines
(http://en.wikipedia.org/wiki/Spline_interpolation).
The coefficients are weights for a B-spline basis for the natural
spline, defined in terms of the knots.
The "fda" package includes a "TaylorSpline" function to translate
spline coefficients into the coefficients of Taylor expansions about the
midpoints of the intervals between knots. However, I do not know if it
will work with a natural spline.
This is far from a complete answer to your question, but I hope it
helps.
Spencer Graves
ltracy wrote:
> Hello-
>
> I am trying to model infections counts over 120 months using a GLM in R.
> The model is simple really including a factor variable for year (10 yrs in
> total) and another variable consisting of a natural spline function for time
> in months.
>
> My code for the GLM is as follows:
> model1<-glm(ALL_COUNT~factor(FY)+ns(1:120, 10), offset=log(TOTAL_PTS),
> family=poisson, data=TS1)
>
> The summary output pertaining to the smooth function consists of 10
> coefficients for each df in the model. Here are the coefficients:
>
> ns(1:120, 10)1 -0.72438 0.32773 -2.210 0.027084 *
> ns(1:120, 10)2 -1.19097 0.37492 -3.177 0.001490 **
> ns(1:120, 10)3 -1.40250 0.42366 -3.310 0.000931 ***
> ns(1:120, 10)4 -0.82722 0.47459 -1.743 0.081334 .
> ns(1:120, 10)5 -0.46139 0.49657 -0.929 0.352812
> ns(1:120, 10)6 -0.44892 0.51909 -0.865 0.387137
> ns(1:120, 10)7 -0.53060 0.54783 -0.969 0.332778
> ns(1:120, 10)8 -0.25699 0.55582 -0.462 0.643814
> ns(1:120, 10)9 -0.74091 0.63899 -1.160 0.246249
> ns(1:120, 10)10 0.41142 0.56317 0.731 0.465054
>
> What is still unclear to me is what these 10 coefficients from the natural
> spline represent.
>
> Thanks in advace-
>
>
>
>
>
More information about the R-help
mailing list