[R] derivative estimation using GAM

Roman Torgovitsky rtorgovi at hsph.harvard.edu
Wed Jul 18 21:12:14 CEST 2007


Hello,
I have a question about Simon Wood's gam function.

Suppose I have a simple model

n<-100
x <- runif(n, 0, 1);
y<-x*x
data<-data.frame(x,y)
ct<-gam(y~ s(x,k = 5))

how could I estimate first derivative of the smooth. From what I understand,  i could get coefficients of the fit from

ct2<-gam(y~ s(x,k = 5),control =gam.control(absorb.cons = FALSE))
coeff(ct2)

to get unconstrained coefficient estimates for the model (this was suggested in response to a similar question in 2005), but how could I get derivative of the basis?

Thanks!
Roman Torgovitsky
Doctoral Student
Department of Biostatistics
Harvard University



More information about the R-help mailing list