updateCovf: Update Covariance Functions in 'STmodel' Objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Updates/sets the covariance functions for STmodel objects. Used by createSTmodel.

Usage

1
updateCovf(STmodel, cov.beta = STmodel$cov.beta, cov.nu = STmodel$cov.nu)

Arguments

STmodel

STmodel object with observations, covariates, trends, etc; see mesa.model.

cov.beta, cov.nu

Covariance specification for the beta- and nu-fields should contain fields covf, nugget, and random.effect (for the nu field); see details for description of these fields. For cov.beta the fields should contain one element for each smooth-temporal trend / beta-field if the fields have only one element, these elements are repeated implying the same covariance for all beta-fields.

Details

The covariance function is specified using lists for cov.beta and cov.nu. The lists should contain the following elements:

covf

The type of covariance function(s), see namesCovFuns.

nugget

For the beta-fields: a vector of TRUE/FALSE indicating if each beta-field should contain a nugget.
For the nu-field: Either TRUE/FALSE for constant nugget/no nugget; a formula; or length=1 character vector. For the latter two the nugget is allowed to vary as exp(B*theta) where:
nugget = as.formula(paste("~", paste(cov.nu$nugget, collapse="+")))
covars = model.frame(nugget, covars, drop.unused.levels=TRUE)
B=model.matrix(nugget, covars)
B=as.matrix(B)
The resulting regression matrix is stored as STmodel$cov.nu$nugget.matrix giving nugget for the observed locations. Unobserved locations are assumed to have a zero nugget.

random.effect

Only used for cov.nu, TRUE/FALSE indicating if a random.effect for the mean value should be included, see makeSigmaNu.

Value

updated version of STmodel with new covariance specifications.

Author(s)

Johan Lindstrom

See Also

Other STmodel functions: createCV, createDataMatrix, createSTmodel, dropObservations, estimateBetaFields, loglikeSTdim, loglikeST, predictNaive, processLUR, processLocation, updateTrend.STdata

Other covariance functions: crossDist, evalCovFuns, makeSigmaB, makeSigmaNu, namesCovFuns, parsCovFuns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
##load the data
data(mesa.model)

##covariance specification:
cov.beta <- list(covf="exp", nugget=FALSE)
cov.nu <- list(covf="exp", nugget=TRUE, random.effect=FALSE)

##Simple covariance structure
updateCovf(mesa.model, cov.beta, cov.nu)

##different behaviour for different beta:s
cov.beta <- list(covf=c("exp","exp2","matern"), nugget=c(TRUE,FALSE,FALSE))
updateCovf(mesa.model, cov.beta, cov.nu)

##Spatially varying nugget
cov.nu <- list(covf="exp", nugget="type", random.effect=FALSE)
print(tmp <- updateCovf(mesa.model, cov.beta, cov.nu))
##lets study the regression matrix for the nugget
str(tmp$cov.nu$nugget.matrix)
head(tmp$cov.nu$nugget.matrix)

SpatioTemporal documentation built on May 2, 2019, 8:49 a.m.