To whom it may concern, I don't know whether this is really a bug with the Pspline package or only a problem with my installation. Things work fine in Linux but not in Mac OS X (Darwin). Both system run the latest public versions of R and Pspline. predict.smooth.Pspline produces only NaN instead of predicted values when norder>2:> library (Pspline) > tt <- seq (0,1,length=20) > xt <- tt^3 > > fit <- smooth.Pspline (tt, xt, norder=3,spar=0.0001, method=1) > predict.smooth.Pspline (fit, tt, nderiv=0)[,1][1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN [20] NaN>smooth.Pspline seems to work fine since>plot (tt,xt) >lines (fit)produces the expected result (curve fits data closely). Using norder = 2 instead works fine:> fit2 <- smooth.Pspline(tt,xt,norder=2,spar=0.0001,method=1) > lines(fit2, col="red") > px <- predict(fit2,tt)[,1] > round(px,2)[1] 0.00 0.00 0.00 0.00 0.01 0.02 0.03 0.05 0.07 0.11 0.15 0.19 0.25 0.32 0.40 [16] 0.49 0.60 0.72 0.85 0.99> round(xt,2)[1] 0.00 0.00 0.00 0.00 0.01 0.02 0.03 0.05 0.07 0.11 0.15 0.19 0.25 0.32 0.40 [16] 0.49 0.60 0.72 0.85 1.00> > > version_ platform powerpc-apple-darwin6.2 arch powerpc os darwin6.2 system powerpc, darwin6.2 status major 1 minor 6.1 year 2002 month 11 day 01 language R The same code works fine in Linux:> rm (list=ls()) > library(pspline) > tt <- seq (0,1,length=20) > xt <- tt^3 > fit <- smooth.Pspline (tt, xt, norder=3,spar=0.0001, method=1) > px<-predict(fit,tt)[,1] > round(px,2)[1] 0.00 0.00 0.00 0.00 0.01 0.02 0.03 0.05 0.07 0.11 0.15 0.19 0.25 0.32 0.40 [16] 0.49 0.60 0.72 0.85 1.00> > version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 6.1 year 2002 month 11 day 01 language R>Please let me know if I can help in any way troubleshooting this issue. Kind regards, Martin -- Martin Renner email: h95mr@mun.ca Department of Biology http://www.ucs.mun.ca/~h95mr/ Memorial University of Newfoundland Office: SN-2093 St. John's, NL, A1B 3X9 phone: (709) 737-3239 CANADA fax: (709) 737-3018 What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is brought under the name of totalitarianism or the holy name of liberty and democracy? - Gandhi
There is a pspline package, but no Pspline package. I presume you mean *pspline*, and have no idea how library(Pspline) would work. For *pspline* your example works correctly on Linux, Solaris and Windows, so the problem is definitely with your installation (and perhaps your OS). [Note that testing something where the fit is exact is not a very clever idea: you don't need smoothing splines to fit a cubic. It is entirely possible that a realistic problem would work.] In any case, we cannot debug your machine: you have the source code so please debug it yourself and if a MacOS-specific patch is needed please submit it to the maintainer (who might decline to add workarounds for broken systems). On Tue, 1 Apr 2003 h95mr@mun.ca wrote:> To whom it may concern, > > I don't know whether this is really a bug with the Pspline package or > only a problem with my installation. Things work fine in Linux but > not in Mac OS X (Darwin). Both system run the latest public versions > of R and Pspline. > > predict.smooth.Pspline produces only NaN instead of predicted values > when norder>2: > > > library (Pspline) > > tt <- seq (0,1,length=20) > > xt <- tt^3 > > > > fit <- smooth.Pspline (tt, xt, norder=3,spar=0.0001, method=1) > > predict.smooth.Pspline (fit, tt, nderiv=0)[,1] > [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN > [20] NaN > > > > smooth.Pspline seems to work fine since > >plot (tt,xt) > >lines (fit) > produces the expected result (curve fits data closely). Using norder > = 2 instead works fine: > > > fit2 <- smooth.Pspline(tt,xt,norder=2,spar=0.0001,method=1) > > lines(fit2, col="red") > > px <- predict(fit2,tt)[,1] > > round(px,2) > [1] 0.00 0.00 0.00 0.00 0.01 0.02 0.03 0.05 0.07 0.11 0.15 0.19 0.25 0.32 0.40 > [16] 0.49 0.60 0.72 0.85 0.99 > > round(xt,2) > [1] 0.00 0.00 0.00 0.00 0.01 0.02 0.03 0.05 0.07 0.11 0.15 0.19 0.25 0.32 0.40 > [16] 0.49 0.60 0.72 0.85 1.00 > > > > > > version > _ > platform powerpc-apple-darwin6.2 > arch powerpc > os darwin6.2 > system powerpc, darwin6.2 > status > major 1 > minor 6.1 > year 2002 > month 11 > day 01 > language R-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Tuesday, April 1, 2003, at 02:02 AM, h95mr@mun.ca wrote:> To whom it may concern, > > I don't know whether this is really a bug with the Pspline package or > only a problem with my installation. Things work fine in Linux but > not in Mac OS X (Darwin). Both system run the latest public versions > of R and Pspline.1.6.1 is not really latest public version of R. R 1.6.2 works fine for Mac OS X 1.2.4: > library(pspline) > tt <- seq (0,1,length=20) > xt <- tt^3 > fit <- smooth.Pspline (tt, xt, norder=3,spar=0.0001, method=1) > predict.smooth.Pspline (fit, tt, nderiv=0)[,1] [1] 0.0040913548 0.0002529571 -0.0004989511 0.0019184414 0.0077153296 [6] 0.0172687013 0.0311322187 0.0500210668 0.0747811296 0.1063514794 [11] 0.1457260829 0.1939169313 0.2519179914 0.3206683353 0.4010138472 [16] 0.4936697119 0.5991895918 0.7179504746 0.8501625554 0.9959086452 Try the latest version of R and see if it works for you. btw: library(Pspline) works only because of case-insensitivity of HFS+. - platform powerpc-apple-darwin6.4 arch powerpc os darwin6.4 system powerpc, darwin6.4 status Patched major 1 minor 6.2 year 2003 month 03 day 17 Cheers Simon --- Simon Urbanek Department of computer oriented statistics and data analysis University of Augsburg Universit?tsstr. 14 86135 Augsburg Germany Tel: +49-821-598-2236 Fax: +49-821-598-2280 Simon.Urbanek@Math.Uni-Augsburg.de http://simon.urbanek.info