The summary of a model in R gives you a table of the coefficient estimates and other parameters. Sometimes it may be useful to have a string of text with the model's equation, so that you can present it in an article (e.g. Real et al. 2005) or apply it in a (raster map) calculation, either in R (although here you can usually use the 'predict' function for this) or in a GIS software (e.g. Barbosa et al. 2010). The getModEqn
function gets this equation for linear or generalized linear models.
By default it prints the "Y"
linear equation, but for generalized linear models you can also set type = "P"
(for the equation of probability) or type = "F"
(for favourability, which corrects the intercept to eliminate the effect of prevalence - see Real et al. 2006).
If the variables to which you want to apply the model have a prefix or suffix (e.g. prefix = "raster.stack$" for the R raster package, or prefix = "mydata$" for a data frame, or suffix = "@1" in Quantum GIS, or suffix = "@mapset" in GRASS), you can get these in the equation too, using the prefix
and/or the suffix
argument.