Learn R Programming

crawl (version 2.3.0)

crwSimulator: Construct a posterior simulation object for the CTCRW state vectors

Description

The crwSimulator function uses a fitted model object from crwMLE and a set of prediction times to construct a list from which crwPostIS will draw a sample from either the posterior distribution of the state vectors conditional on fitted parameters or a full posterior draw from an importance sample of the parameters.

Usage

crwSimulator(
  object.crwFit,
  predTime = NULL,
  method = "IS",
  parIS = 1000,
  df = Inf,
  grid.eps = 1,
  crit = 2.5,
  scale = 1,
  quad.ask = TRUE,
  force.quad
)

Value

List with the following elements:

x

Longitude coordinate with NA at prediction times

y

Similar to above for latitude

locType

Indicates prediction types with a "p" or observation times with an "o"

P1.y

Initial state covariance for latitude

P1.x

Initial state covariance for longitude

a1.y

Initial latitude state

a1.x

Initial longitude state

n.errX

number of longitude error model parameters

n.errY

number of latitude error model parameters

delta

vector of time differences

driftMod

Logical. indicates random drift model

stopMod

Logical. Indicated stop model fitted

stop.mf

stop model design matrix

err.mfX

Longitude error model design matrix

err.mfY

Latitude error model design matrix

mov.mf

Movement model design matrix

fixPar

Fixed values for parameters in model fitting

Cmat

Covaraince matrix for parameter sampling distribution

Lmat

Cholesky decomposition of Cmat

par

fitted parameter values

N

Total number of locations

loglik

log likelihood of the fitted model

Time

vector of observation times

coord

names of coordinate vectors in original data

Time.name

Name of the observation times vector in the original data

thetaSampList

A list containing a data frame of parameter vectors and their associated probabilities for a resample

Arguments

object.crwFit

A model object from crwMLE.

predTime

vector of additional prediction times.

method

Method for obtaining weights for movement parameter samples

parIS

Size of the parameter importance sample

df

Degrees of freedom for the t approximation to the parameter posterior

grid.eps

Grid size for method="quadrature"

crit

Criterion for deciding "significance" of quadrature points (difference in log-likelihood)

scale

Scale multiplier for the covariance matrix of the t approximation

quad.ask

Logical, for method='quadrature'. Whether or not the sampler should ask if quadrature sampling should take place. It is used to stop the sampling if the number of likelihood evaluations would be extreme.

force.quad

A logical indicating whether or not to force the execution of the quadrature method for large parameter vectors.

Author

Devin S. Johnson

Details

The crwSimulator function produces a list and preprocesses the necessary components for repeated track simulation from a fitted CTCRW model from crwMLE. The method argument can be one of "IS" or "quadrature". If method="IS" is chosen standard importance sampling will be used to calculate the appropriate weights via t proposal with df degrees of freedom. If df=Inf (default) then a multivariate normal distribution is used to approximate the parameter posterior. If method="quadrature", then a regular grid over the posterior is used to calculate the weights. The argument grid.eps controls the quadrature grid. The arguments are approximately the upper and lower limit in terms of standard deviations of the posterior. The default is grid.eps, in units of 1sd. If object.crwFit was fitted with crwArgoFilter, then the returned list will also include p.out, which is the approximate probability that the observation is an outlier.

See Also

See demo(northernFurSealDemo) for example.