Learn R Programming

gear (version 0.1.5)

geolm: Linear model for geostatistical data.

Description

geolm creates a geostatistical linear model object of the appropriate class based on the arguments, especially the cmod arguments.

Usage

geolm(
  formula,
  data,
  coordnames,
  cmod = NULL,
  vmod = NULL,
  weights = NULL,
  longlat = FALSE,
  mu = NULL
)

Arguments

formula

An object of class formula. See Details.

data

A data frame containing the response, covariates, and location coordinates.

coordnames

A vector of length 2 with the names of the columns in data containing the coordinates, e.g., c("long", "lat").

cmod

A covariance model object obtained from one of the cmod.* functions, e.g., cmod.std.

vmod

A semivariance model object obtained from one of the vmod.* functions. Not currently implemented.

weights

An optional vector of weights for the errors to be used in the fitting process. A vector that is proportional to the reciprocal variances of the errors, i.e., errors are assumed to be uncorrelated with variances evar/weights. Default is NULL, meaning that the weights are uniformly 1.

longlat

A logical value. Default is FALSE. If TRUE, Great Circle distances (WGS84 ellipsoid) are calcualted between locations. Otherwise, Euclidean.

mu

A single numeric value indicating the consant mean of the spatial process if simple kriging is desired. Default is NULL, meaning that ordinary or universal kriging should be used.

Value

Returns a geolm object.

Details

formula should be specified after the form y ~ x1 + x2, where y is the response variable and x1 and x2 are the covariates of interest. If mu is provided, the variables to the right of ~ are ignored.

Examples

Run this code
# NOT RUN {
data = data.frame(y = rnorm(10), x1 = runif(10), 
                 x2 = runif(10))
cmod = cmod.std(model = "exponential", psill = 1, 
                 r = 1)
gearmod = geolm(y ~ x1, data = data,
                 coordnames = c("x1", "x2"),
                 cmod = cmod)
# }

Run the code above in your browser using DataLab