[R] gam
Simon Wood
simon at stats.gla.ac.uk
Wed Jun 16 17:48:26 CEST 2004
> i'm working with mgcv packages and specially gam. My exemple is:
>
> >test<-gam(B~s(pred1)+s(pred2))
> >plot(test,pages=1)
>
> when ploting test, you can view pred1 vs s(pred1, edf[1] ) & pred2 vs
> s(pred2, edf[2] )
>
> I would like to know if there is a way to access to those terms
> (s(pred1) & s(pred2)). Does someone know how?
Depends a bit on what sort of access you want... You can use predict.gam
to obtain the estimated value of each smooth term at any set of pred1 or
pred2 values you supply (along with standard errors).
The underlying equations are somewhat unwieldy, but are given in
Wood, S.N. (2003) Thin plate regression splines. J.R.Statist.Soc.B
65(1):95-114 ... if you need to evaluate the smooth in another program or
something then you'd probably need to transform the t.p.r.s. parameters back
to thin plate spline parameters and use the t.p.s. basis.
- You can also change the smoothing basis to one which is easier to write
down - the "cr" basis (see ?s) parameterizes a 1-d cubic spline in terms of the
function values at the knots, for example.
- Or you can add a smoothing basis of your own design and hence specify
the equations of the smooth yourself: ?p.spline gives an example.
>
> the purpose is to access to equation of smooths terms in order to have
> the equation of my additive model.
best,
Simon
_____________________________________________________________________
> Simon Wood simon at stats.gla.ac.uk www.stats.gla.ac.uk/~simon/
>> Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>> Direct telephone: (0)141 330 4530 Fax: (0)141 330 4814
More information about the R-help
mailing list