importance.weight: Importance sampling

View source: R/mcem_hcbn.R

importance.weightR Documentation

Importance sampling

Description

compute the sufficient statistics in expectation using importance sampling

Usage

importance.weight(
  genotype,
  L,
  poset,
  lambda,
  eps,
  time = NULL,
  sampling = c("forward", "add-remove", "backward", "bernoulli", "pool"),
  weight.remove = numeric(0),
  dist.pool = integer(0),
  Tdiff.pool = matrix(0),
  neighborhood.dist = 1L,
  lambda.s = 1,
  thrds = 1L,
  seed = NULL
)

Arguments

genotype

either a binary vector or a matrix containing observations or genotypes. Each row of the matrix corresponds to a genotype vector whose entries indicate whether an event has been observed (1) or not (0)

L

number of samples to be drawn from the proposal

poset

a matrix containing the cover relations

lambda

a vector of the rate parameters

eps

error rate

time

optional argument specifying the sampling time

sampling

sampling scheme to generate hidden genotypes, X. OPTIONS: "forward" - generate occurrence times according to current rate parameters, and, from them, generate the hidden genotypes, X; "add-remove" - generate genotypes, X, from observed genotypes, Y using a two-steps proposal. First, pick a move uniformly at random: either to add or to remove an event. Events are chosen to be removed with probability proportional to their rates, and to be added with an inverse probability. Second, make genotypes compatible with the poset by either adding or removing all events incompatible with the poset; "backward" - enumerate all genotypes with Hamming distance k; "bernoulli" - generate genotypes from a Bernoulli distribution with success probability p = ε; "pool" - generate a pool of compatible genotypes according to current rate parameters and sample K observations proportional to their Hamming distance;

weight.remove

a numeric vector of length p containing the weights for choosing events to be removed. This option is used if sampling is set to "add-remove"

dist.pool

Hamming distance between genotype and the genotype pool. This option is used if sampling is set to "pool" and genotype corresponds to a vector containing a single genotype

Tdiff.pool

Expected time differences for the genotype pool. This option is used if sampling is set to "pool" and genotype corresponds to a vector containing a single genotype

neighborhood.dist

an integer value indicating the Hamming distance between the observation and the samples generated by "backward" sampling. This option is used if sampling is set to "backward". Defaults to 1

lambda.s

rate of the sampling process. Defaults to 1.0

thrds

number of threads for parallel execution. This option is used if genotype corresponds to a matrix of genotypes

seed

seed for reproducibility


cbg-ethz/MC-CBN documentation built on Dec. 15, 2022, 5:42 p.m.