R/particle_filter.R

Defines functions particle_filter

#' @export
particle_filter <- function(theta, x, w, loss, loss_args, threshold, time1, time2, lfunc){
  a <- sample(1:I(dim(x)[1]), prob = w, replace = TRUE)
  dist_out <- apply(x[a, , drop = FALSE], MARGIN = 1, loss, theta = theta, inp = loss_args, time1 = time1, time2 = time2)
  return(dist_out)
}
AnthonyEbert/StateSpaceInference documentation built on May 25, 2021, 2:45 a.m.