
Spatial GLM, robust semivariogram, loss and weight normalisation
Source:R/SpatialGlmVariogram.R
SpatialGlmVariogram.RdR arm of morie.fn.sglm, sgcrh, sglss and
sgrwn. Sglm: spatial linear model by ML (Likfit)
with generalised-least-squares standard errors for family =
"gaussian", or the Laplace-approximation spatial GLMM
(SpatialGlmmFit) for Poisson and binomial responses.
Sgcrh: Cressie-Hawkins robust semivariogram, with the
0.045/N^2 term of Cressie (1993) or without it (method = "gstat"),
gstat's default bins. Sglss: mean squared error loss.
Sgrwn: row-standardised weights (zero rows kept).
Usage
Sglm(x, y, coords, family = "gaussian", model = "Exp")
Sgcrh(data, coords, lags = 15, cutoff = NULL, method = "cressie")
Sglss(predicted, observed)
Sgrwn(W)Arguments
- x
Design matrix (include an intercept column for an intercept).
- y
Responses.
- coords
Locations (n x 2, or a vector for points on a line).
- family
"gaussian","poisson"or"binomial".- model
Correlation model.
- data
Observations.
- lags
Number of distance bins.
- cutoff
Largest distance considered.
- method
"cressie"or"gstat".- predicted, observed
Predictions and observations.
- W
Weights matrix.
References
Cressie, N. and Hawkins, D. M. (1980). Robust estimation of the variogram: I. Mathematical Geology 12, 115-125.
Cressie, N. (1993). Statistics for Spatial Data, revised edition. Wiley.
Schabenberger, O. and Gotway, C. A. (2005). Statistical Methods for Spatial Data Analysis. Chapman and Hall/CRC.
Examples
xy <- rbind(c(0, 0), c(1, 0.2), c(2.1, 0), c(0.1, 1), c(1.2, 1.1), c(2, 0.9))
Sgcrh(c(1, 2.4, 1.3, 3.1, 1.9, 2.2), xy, lags = 3, cutoff = 2)$gamma
#> [1] 0.6936064 0.5020770
Sgrwn(rbind(c(0, 2, 2), c(1, 0, 0), c(0, 0, 0)))$W_normalized
#> [,1] [,2] [,3]
#> [1,] 0 0.5 0.5
#> [2,] 1 0.0 0.0
#> [3,] 0 0.0 0.0