For 1) see reply just sent to R help...
"Re: [R] Use pcls in "mgcv" package to achieve constrained cubic spline"
(I'm assuming you mean to fix the value of the smooth at a particular
knot location - i.e. to impose a constraint like f(t_0) = b).
For 2) try 'model.matrix', or 'predict.gam' with argument
'type="lpmatrix"' (see ?predict.gam)
On 23/03/13 01:05, Antonio P. Ramos wrote:
Hi all,
I am using GAM to model time trends in a logistic regression. Yet I would
like to extract the the fitted spline from it to add it to another model,
that cannot be fitted in GAM or GAMM.
Thus I have 2 questions:
1) How can I fit a smoother over time so that I force one knot to be at a
particular location while letting the model to find the other knots?
2) how can I extract the matrix from the fitted GAM so that I can use it in
as an impute for a different model.
The types of models I am running are to the following form:
gam <- gam(mortality.under.2~ maternal_age_c+ I(maternal_age_c^2)+
s(birth_year,by=wealth2) +
+ wealth2 + sex +
residence+ maternal_educ + birth_order,
,data=colombia2,family="binomial")
I've read the extensive documentation for the GAM but I am not sure still.
Any suggestion is really appreciated.
Thanks,
Antonio Pedro
[[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.
--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603 http://people.bath.ac.uk/sw283
______________________________________________
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.