(Sorry for the duplicate posting, first posting did not contain text in the body
of the message.)
Greetings,
I am attempting to plot the model fits of a generalized additive model using the
gam package (gam version 1.0, R v. 2.6.2). The gam object is created without
any apparent problem, but when I try to plot (plot(<gam_object>)), I
repeatedly receive the following error: "Error in dim(data) <- dim :
attempt to set an attribute on NULL". Diagnostics are pasted below.
Cheers, Chris Taylor
>Traceback()
14: array(np, 1)
13: predict.gam(object, type = "lpmatrix", ...)
12: model.matrix.gam(object)
11: model.matrix(object)
10: predict.lm(object, newdata, se.fit, scale = residual.scale, type =
ifelse(type = "link", "response", type), terms =
terms, na.action = na.action)
9: predict.glm(object, type = "terms", terms = terms, se.fit = TRUE)
8: NextMethod("predict")
7: switch(type, response = {
out <- predict.gam(object, type = "link", se.fit = TRUE,
...)
famob <- family(object)
out$se.fit <- drop(out$se.fit * abs(famob$mu.eta(out$fit)))
out$fit <- fitted(object)
out
}, link = {
out <- NextMethod("predict")
out$fit <- object$additive.predictors
TS <- out$residual.scale^2
TT <- ncol(object$var)
out$se.fit <- sqrt(out$se.fit^2 + TS * object$var %*% rep(1,
TT))
out
}, terms = {
out <- NextMethod("predict")
TT <- dimnames(s <- object$smooth)[[2]]
out$fit[, TT] <- out$fit[, TT] + s
TS <- out$residual.scale^2
out$se.fit[, TT] <- sqrt(out$se.fit[, TT]^2 + TS * object$var)
out
})
6: predict.gam(object, type = "terms", terms = terms, se.fit = TRUE)
5: predict(object, type = "terms", terms = terms, se.fit = TRUE)
4: preplot.gam(x, terms = terms)
3: plot.gam(Cr4Rot1_100m.gam, se = T, residuals = T, main = "Trend analysis
on ABC, 100m resolution: Cr4Rot1")
2: plot(Cr4Rot1_100m.gam, se = T, residuals = T, main = "Trend analysis on
ABC, 100m resolution: Cr4Rot1")
1: plot(Cr4Rot1_100m.gam, se = T, residuals = T, main = "Trend analysis on
ABC, 100m resolution: Cr4Rot1")
> sessionInfo()
R version 2.6.2 (2008-02-08)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] splines stats graphics grDevices utils datasets methods base
other attached packages:
[1] gstat_0.9-47 rgdal_0.5-25 sp_0.9-25 gam_1.0 akima_0.5-1
loaded via a namespace (and not attached):
[1] grid_2.6.2 lattice_0.17-10 mgcv_1.4-1 tools_2.6.2
--
J. Christopher Taylor, Ph.D.
Applied Ecology and Restoration Research
National Ocean Service / NOAA
National Centers for Coastal Ocean Science
Center for Coastal Fisheries and Habitat Research
101 Pivers Island Road, Beaufort, North Carolina 28516-9722
Ph:(252) 838 0833 Fx:(252) 728 8784
Website: http://www.ccfhr.noaa.gov/