Hi! S-plus users.
E-mail: s-news@wubios.wustl.edu
The program below leads to the error message:
Error in safe.predict.gam(object, newdata, type, se.fit, t..:
Length of variable 2 is 1 !=length of row names (10)
Dumped
-------------------- Program (A) --------------------
function()
{
xx <- seq(from = 1, by = 1, to = 10)
ex <- seq(from = 3, by = 0.3, length = 12)
yy <- sin(xx) + 2
data1 <<- data.frame(x = xx, y = yy)
span1 <<- 0.4
fit.gam <- gam(y ~ lo(x, span = span1), data = data1, family =
"poisson", x = T, model
= T) ##
data2 <- data.frame(x = ex)
ey <- predict.gam(fit.gam, data2)
}
-------------------- End of Program (A) --------------------
On the other hand, the program below works:
-------------------- Program (B) --------------------
function()
{
xx <- seq(from = 1, by = 1, to = 10)
ex <- seq(from = 3, by = 0.3, length = 12)
yy <- sin(xx) + 2
data1 <<- data.frame(x = xx, y = yy)
fit.gam <- gam(y ~ lo(x, span = 0.4), data = data1, family = "poisson",
x = T, model =
T) ##
data2 <- data.frame(x = ex)
ey <- predict.gam(fit.gam, data2)
}
-------------------- End of Program (B) --------------------
It should mean that when "span" of "lo()" is specifies by
a variable on a working directory, "predict.gam())"
runs into some trouble.
Is there any solution for this? Or is this an unavoidable
character of "gam())"?
***** Kunio Takezawa, Ph.D. (takezawa@affrc.go.jp) *****
***** Research Information Section *****
**** Hokuriku National Agricultural Experiment Station, JAPAN ****
***** <http://www.inada.affrc.go.jp/~takezawa/patent-e.html> *****
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|