[R-sig-Geo] Base correlation larger than alpha (ME - Spdep package
Roger Bivand
Roger.Bivand at nhh.no
Mon Jun 10 22:02:06 CEST 2013
On Mon, 10 Jun 2013, Rodrigo Tardin wrote:
> Dear list,
>
> I am new to this list and I am trying to fit a Spatial Eigenvector GLM to
> count data.
>
> I am trying to fit a ME model in spdep package to investigate environmental
> drivers on Bryde's whale distribution. I have 3 environmental variables
> (depth, distance to coast, slope), my response variable is the occurrence
> (counts) of whales in 82 km2 grids.
>
> I used the dnearneigh function to build .nb data using the coordinates data.
>> nb1 <- dnearneigh(xy, 0, 10) ----
> and: lw1 <- nb2listw(nb1, style="W")
>
> x - is latitude coordinates
> y - is longitude coordinates
>
>
> Using the glm and Spatial filtering function (as done in spdep manual) I
> had no problems. However, when I used the 'ME' it says: base correlation
> larger than alpha. My alpha is 0.05.
>
> Here it is my code:
> ##This part works well
> glmbase1 <- glm(OCC ~ DEPTH + DISTCOAST+SLOPE, offset=RT,
> data=bryde3)
>
> lagcol1 <- SpatialFiltering(OCC_BIN ~ 1, ~ DEPTH + DISTCOAST+
> SLOPE, data=bryde3, style="W", nb=nb1, alpha=0.05, verbose=TRUE)
>
> glmlag1 <- glm(OCC ~ DEPTH + DISTCOAST+SLOPE + fitted(lagcol1),
> offset=RT,data=bryde3)
These are not the same models - lagcol1 is as you know the process in the
response (here OCC - RT??), not in the error. In ME, the process is in the
error, and it looks as though the covariates mop up much of the spatial
dependence (it is also a Poisson model with a default log link).
SpatialFiltering() does not handle an offset (as you have realised, I
think), so again, this is a possible source of difference. ME is testing
slightly diffferently too. Do:
errcol1 <- SpatialFiltering(I(OCC-RT) ~ DEPTH + DISTCOAST +
SLOPE, data=bryde3, style="W", nb=nb1, alpha=0.05, verbose=TRUE)
glmerr1 <- glm(OCC ~ DEPTH + DISTCOAST+SLOPE + fitted(errcol1),
offset=RT, data=bryde3)
and
errcol2 <- ME(OCC ~ DEPTH + DISTCOAST+SLOPE, offset=RT,
data=bryde3, family="gaussian", listw=lw1, alpha=0.05, verbose=TRUE)
glmerr12 <- glm(OCC ~ DEPTH + DISTCOAST+SLOPE + fitted(errcol2),
offset=RT, data=bryde3)
give similar results?
Hope this helps,
Roger
>
> anova(glmlag1)
> anova(glmbase1, glmlag1)
> set.seed(123)
>
> ##From here on, it does not
> lagcol1 <- ME(OCC ~ DEPTH + DISTCOAST+SLOPE, offset=RT, data=bryde3,
> family="poisson",
> listw=lw1, alpha=0.05, verbose=TRUE)
>
> Error in ME(OCC ~ DEPTH + DISTCOAST + SLOPE, data = bryde3, family =
> "poisson", :
> base correlation larger than alpha
>
> When I increase alpha to 0.6 (lower values keep saying the same error),
> this error message does not appear. However, when I try to rerun GLM with
> eigenvectors included as covariates (as done in spdep manual - page 118) I
> have the following error message:
>
> Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, :
> NA/NaN/Inf in 'x'
> warning message: step size truncated due to divergence
>
> Can anyone please help me?
> Other question, if I may, is there a strong difference between Spatial
> Filtering and ME?
>
> Many thanks in advance,
> Rodrigo
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list