Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get.contr

Calculate contrasts from multivariable predictions


Description

Given multivariable predictions and prediction (co)variances, calculate contrasts and their (co)variance

Usage

get.contr(data, gstat.object, X, ids = names(gstat.object$data))

Arguments

data

data frame, output of predict

gstat.object

object of class gstat, used to extract ids; may be missing if ids is used

X

contrast vector or matrix; the number of variables in gstat.object should equal the number of elements in X if X is a vector, or the number of rows in X if X is a matrix.

ids

character vector with (selection of) id names, present in data

Details

From data, we can extract the n x 1 vector with multivariable predictions, say $y$, and its n x n covariance matrix $V$. Given a contrast matrix in $X$, this function computes the contrast vector $C=X'y$ and its variance $Var(C)=X'V X$.

Value

a data frame containing for each row in data the generalized least squares estimates (named beta.1, beta.2, ...), their variances (named var.beta.1, var.beta.2, ...) and covariances (named cov.beta.1.2, cov.beta.1.3, ...)

Author(s)

Edzer Pebesma

References

See Also


gstat

Spatial and Spatio-Temporal Geostatistical Modelling, Prediction and Simulation

v2.0-7
GPL (>= 2.0)
Authors
Edzer Pebesma [aut, cre] (<https://orcid.org/0000-0001-8049-7069>), Benedikt Graeler [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.