geolm: Linear model for geostatistical data.

Description Usage Arguments Details Value Author(s) Examples

View source: R/geolm.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
geolm(
  formula,
  data,
  coordnames,
  mod,
  weights = NULL,
  mu = NULL,
  longlat = NULL,
  cmod = NULL
)

Arguments

formula

An object of class formula providing a symbolic description of the model to be fitted. See Details of this function and lm.

data

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

coordnames

The columns of data containing the spatial coordinates, provided as a formula (e.g., ~ x + y), column numbers (e.g., c(1, 2)), or column names (e.g., c("x", "y"))

mod

A model object produced by one of the cmod_* functions, e.g., cmod_std.

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.

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.

longlat

A logical indicating whether Euclidean (FALSE) or Great Circle distance (WGS84 ellipsoid) (longlat = TRUE) should be used. Default is FALSE.

cmod

Retained for backwards compatibility. A model object produced by one of the cmod_* functions, e.g., cmod_std.

Details

Note: for the multiresolution Gaussian process model, if cmod$est == "f" (i.e., if the nugget is finescale instead of measurement error), then the weights argument is internally set to rep(1, n), where n is the number of observations.

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.

Value

Returns a geolm_* object, where * depends on mod.

Author(s)

Joshua French

Examples

1
2
3
4
5
6
data = data.frame(y = rnorm(10), x1 = runif(10),
                 x2 = runif(10))
d = geodist(data[,c("x1", "x2")])
mod = cmod_man(v = exp(-d), evar = 1)
gearmod = geolm(y ~ x1, data = data,
                coordnames = ~ x1 + x2, mod = mod)

gear documentation built on April 14, 2020, 5:12 p.m.

Related to geolm in gear...