spaMM (version 2.1.6)

Predictor: Interface for model formulas

Description

Predictor(...) performs some minimal syntax checking, and returns a formula with attributes. It serves as a unified interface for the set of descriptors for a linear predictor, including design matrices for random effects.

In the current version this function could be ignored by users.

Usage

Predictor(formula, offset=NULL, LMatrix = NULL, AMatrix = NULL, ZALMatrix = NULL)

Arguments

formula

a formula, which can include fixed effects, random effects, and offsets.

offset

a offset can be provided in this way, as a numeric vector. However, it may be better to provide the offset as an offset formula term (see scotlip example), in particular for later use with predict where the formula can be reevaluated on new data.

LMatrix

The “square root” of the correlation matrix between unique locations, see Details.

AMatrix

A matrix that relates observed (unique) locations to unobserved locations, see Details.

ZALMatrix

The design matrix for random effects, see Details.

Value

A formula with attributes. This return object has classes formula and predictor.

Details

In a spatial model a vector of correlated random effects Lv can be constructed from uncorrelated ones, v, for some matrix L (this may be meaningful only for Gaussian random effects). Typically L is the Cholesky “square root” of a correlation matrix determined by the random effect specification (e.g., Matern(...)), or given as the corrMatrix argument of HLCor.

If there is one realized random effect per response value, the linear predictor contains Lv, where L is a square matrix which dimension is the number of observations.

Several observations may be taken in the same location, and a matrix Z (usually automatically constructed) tells which element of Lv affects each observation. The linear predictor then contains ZLv, where dim(Z) is (number of observations,number of locations).

Finally, in some applications the realized random effects in response locations may be viewed as linear combinations ALv of random effects Lv in distinct locations. In that case the dimension of L is the number of such distinct locations, A maps them to the observed locations, and Z again maps them to possibly repeated observations in observed locations.

Thus, in general the random term in the linear predictor is written Mv, where M=ZAL is reconstructed from the element matrices (usually automatically constructed if needed), unless ZAL is given as argument.

Examples

Run this code
# NOT RUN {
# In the current version this function can be ignored by users,
# so examples are not required.
# (Use of AMatrix could perhaps be shown) 
# }

Run the code above in your browser using DataCamp Workspace