I would like to request help with the following: I am trying to use a Generalized Additive Model (gam) to examine the density distribution of fish as a function of latitude and longitude as continuous variables, and year as a categorical variable. The model is written as: gam.out <- gam(Density ~ s(Lat) + s(Lon) + as.factor(Year)) The fitted model prediction of the link function is gam.out$linear.predictors. Presumably, gam.out$linear.predictors must be derived from some combination of the original predictor variables (Lat, Lon, Year), their corresponding coefficients and the intercept (gam.out$coefficients), and the smooth outputs gam.out$smooth and/or gam.out$sp. By comparison, for a glm model: glm.out <- glm(Density ~ Lat + Lon + as.factor(Year)) this is simply: glm.out$linear.predictors = glm.out$coefficients(intercept) + glm.out$coefficients (year) + glm.out$coefficients(lat) x Lat + glm.out$coefficients(lon) x Lon My problem is that I cannot figure out how to get the equivalent from the gam model. I would like to know how to decompose gam.out$linear.predictors into its components so that I can evaluate the effects of the different predictor variables separately. I would appreciate any comments that can help me with this. Thank you, Andreas Winter Blacksburg, VA
[[alternative HTML version deleted]]
______________________________________________ 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.