From maechler@stat.math.ethz.ch  Mon Apr 22 11:30:58 2002
From: maechler@stat.math.ethz.ch (maechler@stat.math.ethz.ch)
Date: Mon, 22 Apr 2002 12:30:58 +0200 (MET DST)
Subject: [Rd] predict.*bSpline() bugs extrapolating for deriv >= 1 (PR#1473)
Message-ID: <200204221030.MAA25830@pubhealth.ku.dk>

I've already fixed the bugs, but as with the last one, this is
not critical enough to allow breaking current R-devel's code
freeze.  I hope I will have corrected it for 1.5.1..

## Here is code reproducing the problems;
## I use  try(.) whenever I know the current versions of R would
## give an error:

library(splines)

x <- c(1:3,5:6)
y <- c(3:1,5:6)
(isP <- interpSpline(x,y))# poly-spline representation
(isB <- interpSpline(x,y, bSpl = TRUE))# B-spline repr.

xo <- c(0, x, 10)# x + outside points

options(digits = 4)
for(der in 0:3) # deriv=3 fails!
    print(formatC(try(predict(isP, xo, deriv = der)$y), wid=7,format="f"),
          quote = FALSE)
##- Error in predict.npolySpline(isP, xo, deriv = der) :
##- 	subscript out of bounds


## Same for B-spline (instead of Polynom.):
for(der in 0:3)  # deriv=3 fails!
    print(formatC(try(predict(isB, xo, deriv = der)$y), wid=7,format="f"),
          quote = FALSE)
##- Error in predict.nbSpline(isB, xo, deriv = der) :
##- 	subscript out of bounds

## Here, also for deriv= 1 & 2,
## the value left to first proper knot is NA (and should not) <<< ! >>>

------
Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] predict.*bSpline() bugs extrapolating for deriv >= 1 (PR#1473)
maechler@stat.math.ethz.ch