Dear List,
I am trying to reproduce a figure that I made for an analysis that I did
a few months ago. Between when I first made the figure and now, I've
upgraded to R 3.0.2 and upgraded my operating system (ubuntu 13.04). My
codebase, which once works, is throwing an error when I try to use
predict.gam on a model object that I saved:
1> prediction = predict(MI,se.fit=TRUE,newdata=rhc)
Error in if (object$inter) X[[i]] <- PredictMat(object$margin[[i]], dat, :
argument is of length zero
traceback() gives me the following:
1> traceback()
6: Predict.matrix.tensor.smooth(object, dk$data)
5: Predict.matrix(object, dk$data)
4: Predict.matrix3(object, data)
3: PredictMat(object$smooth[[k]], data)
2: predict.gam(MI, se.fit = TRUE, newdata = rhc)
1: predict(MI, se.fit = TRUE, newdata = rhc)
the final function being called looks like this:
1> Predict.matrix.tensor.smooth
function (object, data)
{
m <- length(object$margin)
X <- list()
for (i in 1:m) {
term <- object$margin[[i]]$term
dat <- list()
for (j in 1:length(term)) dat[[term[j]]] <- data[[term[j]]]
if (object$inter)
X[[i]] <- PredictMat(object$margin[[i]], dat, n =
length(dat[[1]]))
else X[[i]] <- Predict.matrix(object$margin[[i]], dat)
}
mxp <- length(object$XP)
if (mxp > 0)
for (i in 1:mxp) if (!is.null(object$XP[[i]]))
X[[i]] <- X[[i]] %*% object$XP[[i]]
T <- tensor.prod.model.matrix(X)
T
}
Unfortunately, I can't say that I understand how that function is
working, beyond that it takes a fitted model object and makes a piece of
the model matrix.
Any ideas about what this could stem from? Where to start looking to
fix it? I could probably do the entire analysis from scratch, but it is
quite complex and I'd prefer to save the time.
Apologies for non-reproducible code -- the data is big and the script is
long.
Thanks for any assistance,
Andrew
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.