Skip to content

spatial GLM using glmmPQL

3 messages · Anne GOARANT, Roger Bivand, Andrew Niccolai

#
Hi List,
I have observations of insect counts and environmental variables. My 
first goal was to compute a GLM to explain the insect counts with the 
environment. The thing is that my insect counts are not spatially 
independant and show spatial autocorrelation (a spherical variogram 
model can be fit to the data).
So I intend to compute the same GLM model and taking into account the 
spatial autocorrelation. The final objective would be to compare both 
model (spatial and non spatial and check which one is the best).
I read that a way to do a spatial GLM is using the glmmPQL function of 
MASS and putting all the observations in the same group for the random 
effect (Dorman, Ecography 30, 2007).  I was wondering if the "non 
computed" Log-Likelihood value (but it can be computed by changing a 
line code in the glmmPQL code function) is correct. I did some trials to 
compare the model outputs for the same dataset for glm and glmmPQL (with 
all the observations in the same group) and it gave me the same 
estimated parameters. It also gave me the same Log-Likelihood for both 
methods.
Do you have any idea if the Log-Likelihood from glmmPQL is correct when 
one considers all the data in the same group for the random effect?
Is there any other methods to do what I want (comparison of spatial and 
non-spatial GLM)?
Thanks for your help.
Anne



________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
http://www.eset.com
#
On Thu, 10 Apr 2008, Anne GOARANT wrote:

            
When this came up recently on R-help, Douglas Bates, whose views deserve 
respect, commented that using a single group was not advisable:

https://stat.ethz.ch/pipermail/r-help/2008-March/157672.html

Using one group for each observation may be another alternative. The 
choice in the Dormann et al. paper was motivated by a desire to get the 
same results as SAS GLIMMIX, not by any considered judgement - the authors 
in fact call their "hack" an "abuse" of the method (see the electronic 
supplement).

Hope this helps,

Roger

  
    
10 days later
#
Greetings list.
Below is some code that anyone can run to produce a distance transform image
of the R logo.  I am interested in some code that will skeletonize this
distmap image or the equivalent SpatialGridDataFrame object.  Essentially I
need to find the ridgeline of the distance transform that would in theory
trace the R logo image at all locations that are the maximum distance from
the boundaries.  Any help would be greatly appreciated.  I have also read of
a way to skeletonize a set of discrete boundary points using Voronoi
tessellation and then thinning the lines but I think the medial axis
transform of the distance map will be easier to handle.  Thanks again for
any and all help!

## Code to produce distance transform image (and SGDF) of R logo.
.spatstat_check <- FALSE # this is the trick used to pass FALSE to check=
w2 <- letterR
plot(w2)
m <- complement.owin(w2)
rm(.spatstat_check)
p1 <- as.psp(w2)
plot(p1)
d <- distmap(p1)
summary(d)
plot(d)
plot(w2, add=TRUE)
d[m] <- NA
summary(d)
plot(d)
## Convert to SpatialGridDataFrame if this helps
dsgdf <- as.SpatialGridDataFrame.im(d)
image(dsgdf)





Andrew Niccolai
Doctoral Candidate
Yale School of Forestry