[Rd] predict in Pspline package (PR#2714)
h95mr at mun.ca
h95mr at mun.ca
Tue Apr 1 03:02:07 MEST 2003
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 at 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
More information about the R-devel
mailing list