Dear all,

I have 10 studies. I want to fit a generalized additive model for each of 8
studies. For combining the results from 10 studies, I have to specify the
same knots (30,40,50,60,70,80,90) and knots boundary, 20 and 100, in
gam(mgcv). Now I just found knots= option in the gam function, so I added
the boundary of age=20 and age=100 into knots list.

data1.gam<-gam(y~male+s(age,by=as.factor(male),bs='cr',k=9), data=data1,
family=binomial,knots=list(age=c(20,30,40,50,60,70,80,90,100)))

Since the number of knots is 9, I have to set k=9 for 'cr 'basis spline.
data1.gam$coeff gives 8 coefficients for each of two gender groups, male and
female. I am wondering how to specify the same knots and their boundary and
'cr' is appropriate for this case. In addition, why is there 8 coefficients
given instead of 9?

I am a beginner of GAM. Only a week. Could someone please give a help.
Thanks a lot.

Sincerely,

Yan

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to