Description Usage Arguments Details Value See Also Examples
Calculate MLE's of model parameters and perform spatial prediction.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ## S4 method for signature 'missing,ANY,ANY,ANY'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'numeric,ANY,ANY,ANY'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'character,ANY,ANY,ANY'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,Spatial,numeric,ANY'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,Spatial,Raster,missing'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,Spatial,Raster,list'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,Spatial,Raster,Raster'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,Spatial,Raster,data.frame'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,Raster,ANY,ANY'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
## S4 method for signature 'formula,data.frame,Raster,data.frame'
lgm(
formula, data, grid, covariates,
buffer=0, shape=1, boxcox=1, nugget = 0,
expPred=FALSE, nuggetInPrediction=TRUE,
reml=TRUE,mc.cores=1,
aniso=FALSE,
fixShape=TRUE,
fixBoxcox=TRUE,
fixNugget = FALSE,
...)
|
formula |
A model formula for the fixed effects, or a character string specifying the response variable. |
data |
A |
grid |
Either a |
covariates |
The spatial covariates used in prediction, either a |
shape |
Order of the Matern correlation |
boxcox |
Box-Cox transformation parameter (or vector of parameters), set to 1 for no transformation. |
nugget |
Value for the nugget effect (observation error) variance, or vector of such values. |
expPred |
Should the predictions be exponentiated, defaults to |
nuggetInPrediction |
If |
reml |
If |
mc.cores |
If |
aniso |
Set to |
fixShape |
Set to |
fixBoxcox |
Set to |
fixNugget |
Set to |
buffer |
Extra distance to add around |
... |
Additional arguments passed to |
When data
is a SpatialPointsDataFrame
, parameters are estimated using optim
to maximize
the
log-likelihood function computed by likfitLgm
and spatial prediction accomplished with krigeLgm
.
With data
being a Raster
object, a Markov Random Field approximation to the Matern is used (experimental). Parameters to
be estimated should be provided as vectors of possible values, with optimization only considering the parameter values supplied.
A list is returned which includes a RasterStack
named predict
having layers:
fixed |
Estimated means from the fixed effects portion of the model |
random |
Predicted random effect |
krigeSd |
Conditional standard deviation of predicted random effect (on the transformed scale if applicable) |
predict |
Prediction of the response, sum of predicted fixed and random effects. For Box-Cox or log-transformed data on the natural (untransformed) scale. |
predict.log |
If |
predict.boxcox |
If a box cox transformation was used, the prediction of the process on the transformed scale. |
In addition, the element summery
contains a table of parameter estimates and confidence intervals. optim
contains the
output from the call to the optim
function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | data("swissRain")
swissRes = lgm( formula="rain",
data=swissRain[1:60,], grid=20,
covariates=swissAltitude, boxcox=0.5, fixBoxcox=TRUE,
shape=1, fixShape=TRUE,
aniso=FALSE, nugget=0, fixNugget=FALSE,
nuggetInPrediction=FALSE
)
swissRes$summary
plot(swissRes$predict[["predict"]], main="predicted rain")
plot(swissBorder, add=TRUE)
## Not run:
load(url("http://www.filefactory.com/file/frd1mhownd9/n/CHE_adm0_RData"))
library('RColorBrewer')
par(mar=c(0,0,0,3))
plot(gadm)
plot(mask(projectRaster(
swissRes$predict[["predict"]], crs=gadm@proj4string),gadm),
add=T,alpha=0.6, col=brewer.pal(9, "Blues"))
plot(gadm, add=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.