[R-sig-Geo] coff standard erros in ggwr

Bjarke Christensen Bjarke.Christensen at sydbank.dk
Wed Sep 17 16:59:02 CEST 2008


>I'm using the function ggwr (for the first time). I want to test the
>significance of the coeff. estimates (global), but I can't find their
>standard errors.

I may be completely misunderstanding you, but last time I looked at GWR, it
was my impression that it was pretty much impossible to know the asymptotic
distribution of the coefficients.

>I used the following code:
>xx<-SpatialPointsDataFrame(coords=coord,data=en1)
>bw <- ggwr.sel(numhomicidio~offset(log(popmedia))+I12 + I4 + I5 +
>I10,data=xx,family=quasipoisson())
>ed_quasi<-ggwr(numhomicidio~offset(log(popmedia))+I12 + I4 + I5 + I10,
>data=xx,family=quasipoisson(),bandwidth=bw)

ed.parameters <- slot(ed_quasi$SDF, 'data')
sd(ed.parameters)

will give you the standard deviation of the estimated parameters. But, as I
said, I very much doubt that it is possible to use them for a meaningful
stationarity test.

If I am completely misunderstanding you, and you are just looking for the
standard errors of the aspatial model, then ed_quasi$lm will give you some
sort of a bastardised lm object. The following function is lifted out of
the code for summary.lm, and will give you the coefficient matrix for the
lm component of a gwr object. Alternatively, you could just estimate a glm
model with the same formula, and use all the trimmings that come with such
an object.

se.gwr <- function (object)
{
    z <- object$lm
    p <- z$rank
    Qr <- z$qr
    n <- NROW(Qr$qr)
    rdf <- n - p
    p1 <- 1:p
    rss <- sum(z$residuals^2)
    resvar <- rss/rdf
    R <- chol2inv(Qr$qr[p1, p1, drop = FALSE])
    se <- sqrt(diag(R) * resvar)
    est <- z$coefficients[Qr$pivot[p1]]
    tval <- est/se
    ans <- cbind(est, se, tval, 2 * pt(abs(tval),
        rdf, lower.tail = FALSE))
    rownames(ans) <- names(z$coefficients)
    colnames(ans) <- c("Estimate", "Std. Error", "t value", "Pr(>|t|)")
    printCoefmat(ans)
    invisible(ans)
}

se.gwr(ed_quasi)

Bjarke Christensen




More information about the R-sig-Geo mailing list