loglikeSTgetPars {SpatioTemporal} | R Documentation |
Extracts parameters for the log-likelihood from a parameter vector and separates regression parameters and log-covariance parameters.
loglikeSTgetPars(x, STmodel)
x |
A vector containing regression (optionally) and
log-covariance parameters. The ordering of
has to be exactly that indicated by
|
STmodel |
STmodel |
list containing:
gamma |
Regression coefficients for the spatio-temporal covariate(s). |
alpha |
A list of regression coefficients for geographic covariates. |
cov.beta |
A list containg a lists of pars and vector of nuggets.
See |
cov.nu |
A list of covariance parameters for the nu-field, as
|
Covariance parameters are also back-transformed from log-scale.
Johan Lindstrom
Other likelihood utility functions: calc.mu.B
,
loglikeSTdim
, loglikeSTnames
##load the data data(mesa.model) ##Compute dimensions for the data structure dim <- loglikeSTdim(mesa.model) ##Let's create random parameter vectors ... x <- runif( dim$nparam.cov ) names(x) <- loglikeSTnames(mesa.model, FALSE) x.all <- runif( dim$nparam ) names(x.all) <- loglikeSTnames(mesa.model, TRUE) ##... and pick them apart str( loglikeSTgetPars(x, mesa.model) ) str( loglikeSTgetPars(x.all, mesa.model) ) ##Try a somewhat more interesting covariance structure mesa.model.alt <- updateCovf(mesa.model, cov.beta=list(covf=c("exp","exp2","matern"), nugget=c(TRUE,FALSE,TRUE)), cov.nu=list(covf="exp", nugget="type", random.effect=TRUE)) ##Compute dimensions for the data structure dim <- loglikeSTdim(mesa.model.alt) ##Let's create random parameter vectors ... x <- runif( dim$nparam.cov ) names(x) <- loglikeSTnames(mesa.model.alt, FALSE) x.all <- runif( dim$nparam ) names(x.all) <- loglikeSTnames(mesa.model.alt, TRUE) ##... and pick them apart str( loglikeSTgetPars(x, mesa.model.alt) ) str( loglikeSTgetPars(x.all, mesa.model.alt) )