R-beta: spline problems(?)
"A. Tsiolakidis" <tsioltas@cs.keele.ac.uk> writes:
OK, thanks, it looks like I can use the splines library instead (I had no idea how, but now I do!). Should we call it a bug then? Question No. 2:
From the same S-plus program, I was forced to change a line that was giving
me Segmentation Error problems (a crash on Solaris 2.5): error _ t(y.fit) %*% ( DBD + Lambda ) %*% y.fit + rbind(rep(1,n)) %*% F.vec.sq - 2 * t(y.fit) %*% F.vec
Apparently, leaving out the middle term did the trick: error _ t(y.fit) %*% ( DBD + Lambda ) %*% y.fit - 2 * t(y.fit) %*% F.vec , while the program still runs more or less as expected. There's nothing nasty about this middle term, is there?
It could possibly be a problem with rbind or with the matrix multiplication for a column vector like that. It is unusual to create a matrix that way. If you want a single column you could create it as matrix( 1, nrow = n, ncol = 1) or reverse the value of the nrow and ncol arguments for a matrix with 1 row. Even more concise is array( 1, c(n, 1) ) or array( 1, c(1, n)) depending on which orientation you want.
Finally, a certain READ.MAT function, that reads in a single-column file, taking the first two entries as the dimension of a matrix and storing the remaining values in such a matrix, wouldn't work; anybody can see why?
READ.MAT _function(file, nrow = 0) {
if(nrow > 0) {
n <- scan(file, n = 2)[2] * nrow
tmp <- scan(file, n = n + 2)
}
## first point of action: simply read in the file in vector 'tmp'
else {
tmp <- scan(file)
}
if(length(tmp)<=2) {
return(NULL)
}
## the following clause should do the vector>>matrix conversion
else {
x <- matrix(tmp[ - c(1, 2)], ncol = tmp[2], byrow = T)
return(x)
}
}
I'm not sure exactly what is happening with that.
Finally, if anybody is curious to see what is giving me all this trouble, it is some code for what is termed Mixture Spline models: http://cm.bell-labs.com/cm/ms/departments/sia/dxsun/speech/mixSplineSpec
This was sent to me only. I am forwarding the reply onto the r-devel list so others can take a look at it.
Douglas Bates bates@stat.wisc.edu Statistics Department 608/262-2598 University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._