View source: R/particle-filter.R
| particle_filter_loglik | R Documentation |
Convenience wrapper around particle_filter that accepts a
dsge_solution object and observed data directly.
particle_filter_loglik(
sol,
y,
n_particles = 1000L,
meas_sd = 0.001,
seed = NULL
)
sol |
A |
y |
Matrix or data frame of observed data (T x n_obs). |
n_particles |
Integer. Number of particles. Default 1000. |
meas_sd |
Numeric. Measurement error standard deviation. Default 0.001. |
seed |
Optional integer random seed. |
Scalar log-likelihood estimate.
particle_filter, bayes_particle
m <- dsge_model(
obs(y ~ z), state(z ~ rho * z), start = list(rho = 0.8)
)
set.seed(1)
z <- numeric(100); for (i in 2:100) z[i] <- 0.8 * z[i-1] + rnorm(1)
dat <- data.frame(y = z - mean(z))
sol <- solve_dsge(m, params = c(rho = 0.8), shock_sd = c(z = 0.2))
ll <- particle_filter_loglik(sol, dat, n_particles = 500, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.