stratified_estimator: Unbiased estimators of the score function based on...

View source: R/unbiased_estimators.R

stratified_estimatorR Documentation

Unbiased estimators of the score function based on stratification

Description

Estimates the score function using the unbiased stratified estimators of Vihola (2018)

Usage

stratified_estimator(
  model,
  theta,
  observations,
  nparticles,
  resampling_threshold = 1,
  coupled2_resampling,
  coupled4_resampling,
  initialization = "particlefilter",
  algorithm = "CPF",
  k = 0,
  m = 1,
  level_distribution,
  nrepeats,
  stratification
)

Arguments

model

a list representing a hidden Markov model, e.g. hmm_ornstein_uhlenbeck

theta

a vector of parameters as input to model functions

observations

a matrix of observations of size nobservations x ydimension

nparticles

number of particles

resampling_threshold

ESS proportion below which resampling is triggered (always resample at observation times by default)

coupled2_resampling

a 2-marginal coupled resampling scheme, such as coupled2_maximal_independent_residuals

coupled4_resampling

a 4-marginal coupled resampling scheme, such as coupled4_maximalchains_maximallevels_independent_residuals

initialization

choice of distribution to initialize chains, such as dynamics or the default particlefilter

algorithm

character specifying type of algorithm desired, i.e. CPF for conditional particle filter, CASPF for conditional ancestor sampling particle filter, CBSPF for conditional backward sampling particle filter

k

iteration at which to start averaging (default to 0)

m

iteration at which to stop averaging (default to 1)

level_distribution

list containing mass_function and tail_function that specify the distribution of levels, e.g. by calling compute_level_distribution

nrepeats

number of replicates to be stratified

stratification

type of stratification, such as uniformly-stratified or systematic-sampling

Value

a list with objects such as: random_level is a vector of random levels (of size nrepeats) to truncated infinite sum; unbiasedestimator is an unbiased estimator of the gradient of the log-likelihood; cost is the cost to compute the independent-sum estimator; elapsedtime is the time taken to compute the independent-sum estimator.


jeremyhengjm/UnbiasedScore documentation built on Nov. 17, 2023, 1:48 a.m.