updateCovf {SpatioTemporal} | R Documentation |
STmodel
ObjectsUpdates/sets the covariance functions for STmodel
objects. Used by
createSTmodel
.
updateCovf(STmodel, cov.beta = STmodel$cov.beta, cov.nu = STmodel$cov.nu)
STmodel |
|
cov.beta, cov.nu |
Covariance specification for the beta- and nu-fields
should contain fields |
The covariance function is specified using lists for cov.beta
and
cov.nu
. The lists should contain the following elements:
The type of covariance function(s), see
namesCovFuns
.
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.
Only used for cov.nu
, TRUE
/FALSE
indicating if a random.effect for the mean value should be included, see
makeSigmaNu
.
updated version of STmodel
with new covariance specifications.
Johan Lindstrom
Other STmodel functions: createCV
,
createDataMatrix
,
createSTmodel
,
dropObservations
,
estimateBetaFields
,
loglikeSTdim
, loglikeST
,
predictNaive
, processLUR
,
processLocation
,
updateTrend.STdata
Other covariance functions: crossDist
,
evalCovFuns
, makeSigmaB
,
makeSigmaNu
, namesCovFuns
,
parsCovFuns
##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)