R-beta: spline problems(?)
Martin Maechler
maechler at stat.math.ethz.ch
Tue Apr 7 09:54:40 CEST 1998
>>>>> "Jim" == Jim Lindsey <jlindsey at luc.ac.be> writes:
Jim> I suspect that this is a problem that I pointed out some time ago
Jim> with integers. seq and : produce integers and the C code of spline
Jim> is expected doubles. Try as.double() around your 1:nrow(y) and
Jim> seq() calls to see if the problem goes away. Jim
Jim, this was exactly my own first suspicion, also.
But it's wrong.
spline(.) uses xy.coord(.)
[[a very useful thing! use it in your own functions!!]]
and xy.coord(.)
ends in
return(list(x = as.real(x), y = as.real(y), xlab = xlab,
ylab = ylab))
which ensures that integers are coerced to real (== double in R).
It must be rather another problem, as Ross already mentioned,
and is investigating himself.
Martin
Tasos> Hi,
Tasos>
Tasos> I am a total beginner with this whole thing so please have patience!
Tasos>
Tasos> I am trying to run an S-plus program with a certain line:
Tasos> spline(1:nrow(y), y[,1],n=100);
Tasos>
Tasos> This crashes with: Error: NAs in foreign function call (arg 8)
Tasos>
Tasos> Apparently, this is caused by the last command of spline: u <-
Tasos> seq(xmin, xmax, length.out = n) .C("spline_eval", z$method,
Tasos> length(u), x = u, y = double(n), z$n, z$x, z$y, z$b, z$c,
Tasos> z$d)[c("x", "y")] }
Tasos>
Tasos> Now, I can cause that error with: spline(1:10,1:10) So, there is a
Tasos> whole class of problems for which spline refuses to compute anything
Tasos> - is this the correct behaviour? E.g., spline(1:10,(1:10)/2.5) #it
Tasos> is alright, but ... spline(1:10,(1:10)/2) # this has the "NAs.."
Tasos> problem
Tasos>
Tasos> Finally, I am almost sure that the y matrix in my program has quite
Tasos> normal values, i.e. values that should allow for meaningful
Tasos> interpolation. Anybody knows what this all is about?
Tasos>
Tasos> Thanks,
Tasos>
Tasos> Tasos T.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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