crwSamplePar: Create a weighted importance sample for posterior predictive...

View source: R/crwSamplePar.R

crwSampleParR Documentation

Create a weighted importance sample for posterior predictive track simulation.

Description

The crwSamplePar 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

crwSamplePar(
  object.sim,
  method = "IS",
  size = 1000,
  df = Inf,
  grid.eps = 1,
  crit = 2.5,
  scale = 1,
  quad.ask = T,
  force.quad
)

Arguments

object.sim

A simulation object from crwSimulator.

method

Method for obtaining weights for movement parameter samples

size

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.

Details

The crwSamplePar function uses the information in a crwSimulator object to create a set of weights for importance sample-resampling of parameters in a full posterior sample of parameters and locations using crwPostIS. This function is usually called from crwPostIS. The average user should have no need to call this function directly.

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

Covariance 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

Author(s)

Devin S. Johnson

See Also

See demo(northernFurSealDemo) for example.


crawl documentation built on Oct. 10, 2022, 1:07 a.m.