stlmm: Fit a Spatio-Temporal Linear Mixed Model

Description Usage Arguments Value

View source: R/stlmm.R

Description

Fit a Spatio-Temporal Linear Mixed Model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
stlmm(data, formula, ...)

## S3 method for class 'data.frame'
stlmm(
  data,
  formula,
  xcoord,
  ycoord = NULL,
  tcoord,
  stcov,
  estmethod = "reml",
  s_cor = "exponential",
  t_cor = "exponential",
  chol = FALSE,
  condition = 1e-04,
  logdet = FALSE,
  weights = "cressie",
  initial = NULL,
  optim_options = NULL,
  h_options = NULL,
  max_options = NULL,
  stempsv_options = NULL,
  ...
)

Arguments

data

A data object containing all necessary variables.

formula

A formula of the form y ~ x, where y is the response variable and x are the predictor variables.

...

Additonal arguments.

xcoord

A character vector specifying the column name of the x-coordinate variable in data.

ycoord

A character vector specifying the column name of the y-coordinate variable in data.

tcoord

A character vector specifying the column name of the t-coordinate (time) variable in data.

stcov

The spatio-temporal covariance type

product

The product LMM

sum_with_error

The sum-with-error LMM

productsum

The product sum LMM

estmethod

The estimation method

reml

Restricted Maximum Likelihood

svwls

Semivariogram Weighted Least Squares

s_cor

The spatial correlation

exponential

The exponential correlation (the default).

spherical

The spherical correlation.

gaussian

The Gaussian correlation.

t_cor

The temporal correlation

exponential

The exponential correlation (the default).

spherical

The spherical correlation.

gaussian

The Gaussian correlation.

tent

The tent (linear with sill) correlation.

chol

Should the Cholesky decomposition be used? If FALSE, efficient inversion algorithms are implemented. Defaults to FALSE.

condition

A small number added to the diagonals of matrices before inverting them to prevent ill-conditioning (defaults to 1e-4).

logdet

Should the log determinant be returned? (defaults to FALSE).

weights

Weights when estmethod = "svwls" (defaults to "cressie") for the Cressie's weighted least squares weights).

initial

Initial values for the parameters. Must be made with make_covparam_object() (defaults to even spread of across variance parameters, a total variance matching the sample variance of OLS residuals, and ranges equaling half the maximum distance in the domain).

optim_options

A list containing additional options to pass to optim.

h_options

A list containing options to compute distances if response, xcoord, ycoord, and tcoord are provided. Named arguments are

h_t_distmetric

The temporal distance matrix (defaults to "euclidean").

h_s_distmetric

The spatial distance matrix (defaults to "euclidean").

max_options

A list containing additonal options for placing upper bounds on the total variance, spatial range, and temporal range. This can be helpful for numerical stability in optimization.

max_v

The maximum total variance (defaults to four times the variance of OLS residuals)

max_s_range

The maximum spatial range variance (defaults to four times the maximum observed spatial distance)

max_t_range

The maximum temporal range variance (defaults to four times the maximum observed temporal distance)

stempsv_options

A list containing additional options for the empirical spatio-temporal semivariogram. Named arguments are

n_s_lag

The number of spatial distance classes (defaults to 16).

n_t_lag

The number of temporal distance classes (defaults to 16).

h_s_max

The maximum spatial distance. Deafaults to half the maximum distance in the spatial domain.

h_t_max

The maximum temporal distance. Deafaults to half the maximum distance in the temporal domain.

Value

A list containing several objects

CovarianceParameters

Estimated covariance parameters.

Coefficients

Fixed effect estimates.

NamesCoefficients

Names of the fixed effect estimates.

CovCoefficients

The covariance matrix of the fixed effect estimates.

Objective

A list containing optimization information.

CovarianceForms

The spatial, temopral, and spatio-temporal correlation forms.

formula

The model formula.

model

A list containing the fixed effect design matrix and response vector.

data_object

An ordered data object.

invert_object

An inverse object.

coord_names

The names of the coordinate vectors.

coords

The coordinate vectors.

h_options

Returning the h_options argument.

stempsv_options

Returning the stempsv_options argument.

stempsv

The empirical spatio-temporal semivariogram (if estmethod = "svwls")

optim_options

Returning the stempsv_options argument.

max_options

Returning the max_options argument.

chol

Returning the chol argument.

condition

Returning the condition argument.

residuals

Raw residuals.


michaeldumelle/DumelleEtAl2021STLMM documentation built on Dec. 21, 2021, 5:56 p.m.