gls-methods {kergp} | R Documentation |
Generalized Least Squares Estimation with a Given Covariance Kernel
Description
Generalized Least Squares (GLS) estimation for a linear model with a covariance given by the covariance kernel object. The method gives auxiliary variables as needed in many algebraic computations.
Usage
## S4 method for signature 'covAll'
gls(object,
y, X, F = NULL, varNoise = NULL,
beta = NULL, checkNames = TRUE,
...)
Arguments
object |
An object with |
y |
The response vector with length |
X |
The input (or spatial design) matrix with |
F |
A trend design matrix with |
varNoise |
A known noise variance. When provided, must be a positive numeric value. |
beta |
A known vector of trend parameters. Default is |
checkNames |
Logical. If |
... |
not used yet. |
Details
There are two options: for unknown trend, this is the usual GLS
estimation with given covariance kernel; for a known trend, it returns
the corresponding auxiliary variables (see value
below).
Value
A list with several elements.
betaHat |
Vector |
L |
The (lower) Cholesky root matrix |
eStar |
Vector of length |
Fstar |
Matrix |
sseStar |
Sum of squared errors:
|
RStar |
The 'R' upper triangular |
All objects having length p
or having one of their dimension
equal to p
will be NULL
when F
is NULL
,
meaning that p = 0
.
Author(s)
Y. Deville, O. Roustant
References
Kenneth Lange (2010), Numerical Analysis for Statisticians 2nd ed. pp. 102-103. Springer-Verlag,
Examples
## a possible 'covTS'
myCov <- covTS(inputs = c("Temp", "Humid"),
kernel = "k1Matern5_2",
dep = c(range = "input"),
value = c(range = 0.4))
d <- myCov@d; n <- 100;
X <- matrix(runif(n*d), nrow = n, ncol = d)
colnames(X) <- inputNames(myCov)
## generate the 'GP part'
C <- covMat(myCov, X = X)
L <- t(chol(C))
zeta <- L %*% rnorm(n)
## trend matrix 'F' for Ordinary Kriging
F <- matrix(1, nrow = n, ncol = 1)
varNoise <- 0.5
epsilon <- rnorm(n, sd = sqrt(varNoise))
beta <- 10
y <- F %*% beta + zeta + epsilon
fit <- gls(myCov, X = X, y = y, F = F, varNoise = varNoise)