Package 'particlefield'

Title: Sequential Monte Carlo for Latent Conditional Autoregressive Model
Description: Functions for replicating the results of the latent Gaussian Markov random field experiment of Lindsten, Helske, Vihola (2018), XX. Contains also functions for performing particle Markov chain Monte Carlo estimation of the model parameters.
Authors: Jouni Helske [aut, cre]
Maintainer: Jouni Helske <[email protected]>
License: GPL (>= 2)
Version: 0.0.1
Built: 2024-11-06 03:25:48 UTC
Source: https://github.com/helske/particlefield

Help Index


Gaussian approximation for Binomial model with latent CAR field

Description

Gaussian approximation for Binomial model with latent CAR field

Usage

approximate_binomial_car(nnbs, nbs, tau, d, y, u, idx, mu = 0,
  use_mu = TRUE, initial_mode, max_iter = 100, conv_tol = 1e-08,
  reorder = TRUE, ratio_correction = TRUE)

Arguments

nnbs

Vector defining the number of neighbours for each vertex.

nbs

Matrix of indices of defining neighbours for each vertex.

tau

Precision parameter for CAR field.

d

Properness parameter for the CAR field.

y

Vector of observations.

u

Vector of trials. Default to 1.

idx

Vector defining the dependencies between y and x.

mu

Intercept of the linear predictor. Defaults to 0.

use_mu

Use mu in the model or not. Default is TRUE.

initial_mode

Initial mode estimate of x.

max_iter

Maximum number of iterations for the approximation algorithm.

conv_tol

Tolerance parameter for the approximation algorithm.

reorder

If TRUE (default), reordering is performed for increased efficiency.

ratio_correction

Should the returned log-likelihood estimate contain the ratio correction term? Default is TRUE.


Boostrap SMC for CAR model with Binomial observations

Description

Boostrap SMC for CAR model with Binomial observations

Usage

bsf_car(nnbs, nbs, tau, d, y, u, idx, mu = 0, use_mu = TRUE,
  n_particles, ess_threshold = NULL, reorder = TRUE,
  seed = sample(.Machine$integer.max, size = 1))

Arguments

nnbs

Vector defining the number of neighbours for each vertex.

nbs

Matrix of indices of defining neighbours for each vertex.

tau

Precision parameter for CAR field.

d

Properness parameter for the CAR field.

y

Vector of observations.

u

Vector of trials. Default to 1.

idx

Vector defining the dependencies between y and x.

mu

Intercept of the linear predictor. Defaults to 0.

use_mu

Use mu in the model or not. Default is TRUE.

n_particles

Number of particles for SMC.

ess_threshold

Resampling is done when the effective sample size estimator is less than this threshold times the number of particles. For example if ess_threshold=1 resampling is done at each iteration (default), whereas if ess_threshold=0 the algorithm reduces to simple importance sampling.

reorder

If TRUE (default), reordering is performed for increased efficiency.

seed

Seed for the random number generator.


Markov chain Monte Carlo for Binomial CAR model

Description

Markov chain Monte Carlo for Binomial CAR model

Usage

mcmc_binomial_car(nnbs, nbs, tau, d, y, u, idx, mu = 0, use_mu = TRUE,
  n_iter, n_burnin, n_particles = 0, initial_mode, max_iter = 100,
  conv_tol = 1e-08, seed = sample(.Machine$integer.max, size = 1),
  S = NULL, ratio_correction = TRUE, reorder = TRUE,
  ess_threshold = 1)

Arguments

nnbs

Vector defining the number of neighbours for each vertex.

nbs

Matrix of indices of defining neighbours for each vertex.

tau

Precision parameter for CAR field.

d

Properness parameter for the CAR field.

y

Vector of observations.

u

Vector of trials. Default to 1.

idx

Vector defining the dependencies between y and x.

mu

Intercept of the linear predictor. Defaults to 0.

use_mu

Use mu in the model or not. Default is TRUE.

n_iter

Number of iterations for the MCMC.

n_burnin

Number of iterations to discard as burn-in.

n_particles

Number of particles used in the SMC. If set to zero, approximate MCMC is used.

initial_mode

Initial mode estimate of x.

max_iter

Maximum number of iterations for the approximation algorithm.

conv_tol

Tolerance parameter for the approximation algorithm.

seed

Seed for the random number generator.

S

A lower triangular matrix defining the Cholesky decomposition of the Gaussian proposal distribution.

ratio_correction

Should the returned log-likelihood estimate contain the ratio correction term? Default is TRUE.

reorder

If TRUE (default), reordering is performed for increased efficiency.

ess_threshold

Resampling is done when the effective sample size estimator is less than this threshold times the number of particles. For example if ess_threshold=1 resampling is done at each iteration (default), whereas if ess_threshold=0 the algorithm reduces to simple importance sampling.


Sequential Monte Carlo Methods for Markov Random Fields

Description

This package contains codes for running sequential Monte Carlo (SMC) for simple latent Gaussian Markov random field (GMRF) where the observations are Poisson or binomial. The methodology is introduced in Lindsten, Helske, Vihola (2018).


Twisted SMC for CAR model with Binomial observations

Description

Twisted SMC for CAR model with Binomial observations

Usage

psi_car(nnbs, nbs, tau, d, y, u, idx, mu = 0, use_mu = TRUE,
  n_particles, ess_threshold = NULL, reorder = TRUE, initial_mode,
  max_iter = 100, conv_tol = 1e-08,
  seed = sample(.Machine$integer.max, size = 1))

Arguments

nnbs

Vector defining the number of neighbours for each vertex.

nbs

Matrix of indices of defining neighbours for each vertex.

tau

Precision parameter for CAR field.

d

Properness parameter for the CAR field.

y

Vector of observations.

u

Vector of trials. Default to 1.

idx

Vector defining the dependencies between y and x.

mu

Intercept of the linear predictor. Defaults to 0.

use_mu

Use mu in the model or not. Default is TRUE.

n_particles

Number of particles for SMC.

ess_threshold

Resampling is done when the effective sample size estimator is less than this threshold times the number of particles. For example if ess_threshold=1 resampling is done at each iteration (default), whereas if ess_threshold=0 the algorithm reduces to simple importance sampling.

reorder

If TRUE (default), reordering is performed for increased efficiency.

initial_mode

Initial mode estimate of x.

max_iter

Maximum number of iterations for the approximation algorithm.

conv_tol

Tolerance parameter for the approximation algorithm.

seed

Seed for the random number generator.