dear Philip,
I am not able to solve your problem, however the error message you get
does not depends on mgcv::gam, therefore gam(,..outer.ok=TRUE) or
predict.gam(,outer.ok=TRUE) do not make sense.
The error message comes from the function splines::splineDesign which is
called when the option bs="ps" is used.
I think the error depends on the fact that you want to "predict" a value
outside the observed range of the covariate. When using P-splines the
predictions outside the range follow a given polynomial..
hope this helps
vito
Il 28/03/2011 7.10, Philip Gautier ha scritto:
Hello
I'm using function gam from package mgcv to fit splines. When I try
to make a prediction slightly beyond the original 'x' range, I get
this error:
A = runif(50,1,149)
B = sqrt(A) + rnorm(50)
range(A)
[1] 3.289136 145.342961
fit1 = gam(B ~ s(A, bs="ps"), outer.ok=TRUE)
predict(fit1, newdata=data.frame(A=149.9), outer.ok=TRUE)
Error in splineDesign(knots, x, ord, derivs, outer.ok = outer.ok) :
the 'x' data must be in the range 3.14708 to 145.485 unless you set
'outer.ok = TRUE'
I've inserted the argument 'outer.ok=TRUE' as you can see, but it
hasn't helped. How can I obtain this prediction?
Thanks,
Philip Gautier
Dept. of Mathematics and Statistics
American University, Washington, DC
______________________________________________
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.
--
====================================
Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 23895240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo
______________________________________________
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.