[R] How to define degree=1 in mgcv

Simon Wood s.wood at bath.ac.uk
Mon Jan 25 16:06:19 CET 2010


On Monday 25 January 2010 02:40, hellen lee wrote:
> Hi, all
>
> I have a question on mgcv and ns. Now I want to compare the results from
> glm, gam and ns. Take a simple model y~x for example.
>
> glm1 = glm(y~x, data=data1)
> gam1 = gam(y~s(x), data=data1)
> ns1 = glm(y~ns(x),data=data1)
>
> In order to confirm the result from glm1 is consistent to those from gam1
> and ns1, I want to define degree=1 in mgcv and ns. I am wondering if there
> is somebody can give me some suggestions? I appreciate.
gam(y~x,data=data1) 

or

gam(y~s(x,sp=1e6),data=data1)

you might need to increase the value supplied in `sp' in order to get the EDF 
for the smooth term close enough to 1 for your liking.

best,
Simon

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283



More information about the R-help mailing list