# [R] Fitting spline using Pspline

From: guy33 <david.reshef_at_magd.ox.ac.uk>
Date: Sun, 29 May 2011 10:30:01 -0700 (PDT)

Hey all,

I seem to be having trouble fitting a spline to a large set of data using PSpline. It seems to work fine for a data set of size n=4476, but not for anything larger (say, n=4477). For example:

THIS WORKS:

```random = array(0,c(4476,2))
random[,1] = runif(4476,0,1)
random[,2] = runif(4476,0,1)
```

random = random[order(random[,1]),]
plot(random[,1],random[,2])
fit2 = sm.spline(random[,1],random[,2], norder=2, cv=FALSE) lines(fit2\$x,fit2\$y)

THIS FAILS:

```random = array(0,c(4477,2))
random[,1] = runif(4477,0,1)
random[,2] = runif(4477,0,1)
```

random = random[order(random[,1]),]
plot(random[,1],random[,2])
fit2 = sm.spline(random[,1],random[,2], norder=2, cv=FALSE) lines(fit2\$x,fit2\$y)

It gives:
Error in smooth.Pspline(x = ux, y = tmp[, 1], w = tmp[, 2], method = method, :
Singularity error in solving equations

Does anyone know if this is just a limitation, or am I missing something. The dataset I'd like to run it on contains n=6000. If it is a limitation, does anyone know of any other ways to do this that would accommodate a larger dataset (ideally with generalized cross validation)?

Thanks!
-guy33

--

View this message in context: http://r.789695.n4.nabble.com/Fitting-spline-using-Pspline-tp3559202p3559202.html Sent from the R help mailing list archive at Nabble.com.

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 Sun 29 May 2011 - 21:08:16 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

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 Sun 29 May 2011 - 22:30:11 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.