Learn R Programming

geostatsp (version 0.4.4)

lgm: Linear Geostatistical Models

Description

Fits a linear geostatistical model using Maximum Likelihood Estimation

Usage

lgm(data,  cells, covariates=NULL, formula=NULL,
maternRoughness=1,fixMaternRoughness=TRUE, 
aniso=FALSE, boxcox=1, fixBoxcox=TRUE,
 nugget = 0, fixNugget = FALSE,...)

Arguments

data
An object of class SpatialPointsDataFrame containing the data.
cells
Either an integer giving the number of cells in the x direction, or a raster object which will be used for the spatial random effect. If the cells in the raster are not square, the resolution in the y direction will be adjusted to make it so.
covariates
Either a single raster, a list of rasters or a raster stack containing covariate values used when making spatial predictions. Names of the raster layers or list elements correspond to names in the formula. If a covariate is missing from the data object
formula
Fixed effects formula, defaults to a linear combination of each of the layers in the covariates object. The response variable defaults to the first variable in the data object, and formula can be an integer o
maternRoughness
Order of the Matern correlation
fixMaternRoughness
Set to FALSE to estimate the Matern order
aniso
Set to TRUE to use geometric anisotropy.
boxcox
Box-Cox transformation parameter, set to 1 for no transformation.
fixBoxcox
Set to FALSE to estimate the Box-Cox parameter.
nugget
Value for the nugget effect (observation error
fixNugget
Set to FALSE to estimate the nugget effect parameter.
...
Additional options passed to likfit

Value

  • If the prediction locations are identical for the fixed effects and random effects, a single raster stack is returned with the following layers:
  • fixedEstimated means from the fixed effects portion of the model
  • randomPredicted random effect
  • krige.varConditional variance of predicted random effect (on the transformed scale if applicable)
  • predictPrediction of the response, sum of fixed and random effects. If exp.pred is TRUE, gives predictions on the exponentated scale, and half of krige.var is added prior to exponentiating
  • predict.logIf exp.pred=TRUE, the prediction of the logged process.
  • If the prediction locations are different for fixed and random effects (typically coarser for the random effects), a list with two raster stacks is returned.
  • predict.boxcoxIf a box cox transformation was used, the prediction of the process on the transformed scale.
  • If the prediction locations are different for fixed and random effects (typically coarser for the random effects), a list with two raster stacks is returned.
  • predictionA raster stack as above, though the random effect prediction is resampled to the same locations as the fixed effects.
  • randomthe predictions and conditional variance of the random effects, on the same raster as cells
  • Additionally, returned are
  • parametersA data frame with parameter estimates, and standard errors of the fixed effects parameters
  • likfitresults from likfit

Details

Calls likfit and krige

See Also

likfit, krige

Examples

Run this code
data(swissRain)
 
swissRes =  lgm(swissRain, cells=30, formula="rain",
	covariates=swissAltitude, boxcox=0.5, fixBoxcox=TRUE, 
	aniso=TRUE, 
	# starting values, arguments as in geoR::likfit
	ini.cov.pars=c(70, 20000), psiA=0.65, psiR=8
	)

swissRes$parameters

plot(swissRes$predict[["predict"]]) 
load(url("http://www.filefactory.com/file/frd1mhownd9/n/CHE_adm0_RData"))
plot(spTransform(gadm, swissRain@proj4string), add=TRUE)

Run the code above in your browser using DataLab