[R] mgcv gam predict problem

From: Philip Gautier <philipgautier_at_gmail.com>
Date: Mon, 28 Mar 2011 01:10:08 -0400


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_at_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. Received on Mon 28 Mar 2011 - 08:17:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Mar 2011 - 12:00:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive