[GRASS-user] predict.glm and predict.gam output

Dylan Beaudette debeaudette at ucdavis.edu
Thu Jun 18 15:31:46 EDT 2009

On Thursday 18 June 2009, Anke Konrad wrote:
> Hi all,
> I am currently trying to compare different plant occurrence prediction
> maps generated in R and exported into GRASS. One of these maps was
> generated from a glm fitted to some data, and subsequently applying this
> glm model to a wider region using predict.glm. The outcome here was a
> probability of occurrence. The second map I generated using a gam
> (mgcv), however, this map seems to have assigned something like a
> negative log-likelihood of occurrence to each raster cell in the region.
> Since I would like to compare the two, I would like to figure out a way
> of having the same kind of output from the "predict" functions (either
> probability OR negative log-likelihood). Does anyone know of a way of
> changing the output options? And if not, does anyone have any
> suggestions of how I could deal with this issue?


This is actually a question for the r-help mailing list. If you can provide 
some code samples, along with the type of model you are trying to fit (sounds 
like logistic regression model), I bet you will get some good answers. 

Usual suspects when you get bad output from a predict.*() function:
1. you fed it data that was not in the same format as the original data used 
to fit the model
2. you fed it data that was not what you thought it was: i.e. a map read in 
from GRASS as the wrong datatype, ect.
3. you fed it data that was way outside the range of data used to fit the 

As always be sure to check ?predict.gam and ?predict.glm .


Dylan Beaudette
Soil Resource Laboratory
University of California at Davis

More information about the grass-user mailing list