[R] splines
Thomas Lumley
tlumley at u.washington.edu
Thu May 2 18:48:16 CEST 2002
On Thu, 2 May 2002, crambe Christophe wrote:
> I've got a problem with the R function spline.des.
>
> I use the following arguments:
> x_seq(0,1,length=200)
> knot_quantile(x,(1:8)/9)
> ord_3
> k_sort(c(rep(range(x),ord,knot)))
> derivs_rep(2,200)
>
> When I do spline.des(k,x,ord,derivs)$design on Splus and on R, I don't
> have the same results.
> However, if I take an order ord=4 (ie a spline of degree 3), then, I
> have the same results on Splus and R.
I do get the same results --
R:
Warning message:
Numerical expression has 8 elements: only the first used in: 1:length.out
Splus6:
Warning messages:
Condition has 8 elements: only the first used in: if(length.out > 0)
Recall(x, ceiling(length.out/n))[1:length.out] else x[0]
and assuming you meant
k<-sort(c(rep(range(x),ord),knot))
I then get the same result from both packages except for the last line of
the matrix, which is all zero in R but is equal to the previous line in
S-PLUS
This appears to be a rounding error due to having multiple knots `exactly'
at the maximum value -- if the knot is moved very slightly to the right
then the packages agree again.
-thomas
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list