SpatioTemporal (version 1.1.9.1)

loglikeSTgetPars: Extract Parameters from a Vector

Description

Extracts parameters for the log-likelihood from a parameter vector and separates regression parameters and log-covariance parameters.

Usage

loglikeSTgetPars(x, STmodel)

Arguments

x

A vector containing regression (optionally) and log-covariance parameters. The ordering of has to be exactly that indicated by loglikeSTnames.

STmodel

STmodel STmodel object describing the problem.

Value

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 makeSigmaB.

cov.nu

A list of covariance parameters for the nu-field, as pars, nugget and random.effect respectively.

Covariance parameters are also back-transformed from log-scale.

See Also

Other likelihood utility functions: calc.mu.B, loglikeSTdim, loglikeSTnames

Examples

Run this code
# NOT RUN {
##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) )
# }

Run the code above in your browser using DataLab