Learn R Programming

SpatioTemporal (version 1.1.2)

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:
  • gammaRegression coefficients for the spatio-temporal covariate(s).
  • alphaA list of regression coefficients for geographic covariates.
  • cov.betaA list containg a lists of pars and vector of nuggets. See makeSigmaB.
  • cov.nuA 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.iS.X, calc.mu.B, calc.X.iS.X, loglikeSTdim, loglikeSTnames

Examples

Run this code
##load the data
data(mesa.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 <- createSTmodel(mesa.data, LUR=mesa.model$LUR.list, ST=1,
                                cov.beta=list(covf=c("exp","exp2","matern"),
                                  nugget=c(TRUE,FALSE,TRUE)),
                                cov.nu=list(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