| qpm_estimate | R Documentation |
Estimates any subset of structural parameters and shock standard
deviations from data, using the Kalman-filter likelihood of the solved
model. method = "bayes" finds the posterior mode (in transformed,
unconstrained space), seeds an adaptive random-walk Metropolis sampler
with the inverse Hessian, and returns posterior draws with split
R-hat and effective-sample-size diagnostics. method = "mle" uses the
same machinery with flat priors on the declared supports.
qpm_estimate(
model,
data,
priors,
observables = NULL,
measurement_error = 0,
kappa = 1e+06,
method = c("bayes", "mle"),
iter = 4000,
burn = floor(iter/2),
chains = 2,
thin = 1,
seed = NULL,
verbose = TRUE
)
## S3 method for class 'qpm_estimate'
coef(object, type = c("mean", "mode", "median"), ...)
model |
A |
data |
Data frame in levels (as for |
priors |
A |
observables, measurement_error, kappa |
Passed to the filter. |
method |
|
iter |
MCMC iterations per chain (including burn-in). |
burn |
Burn-in iterations (default |
chains |
Number of chains (run sequentially). |
thin |
Keep every |
seed |
Optional RNG seed. The previous state of the random number generator is restored on exit, so a seeded call does not disturb the caller's random stream. |
verbose |
Report progress with |
object |
A |
type |
Point estimate: posterior |
... |
Unused. |
Draws that violate Blanchard-Kahn (indeterminacy or explosiveness) receive zero posterior weight — the usual truncation of the prior to the determinacy region. Everything without a prior stays calibrated at its current value.
An object of class qpm_estimate: posterior draws (natural
units), the mode, acceptance rate, split R-hat and effective
sample sizes, and the originating model/data. Use coef() to
extract point estimates and apply_estimate() to recalibrate the
model.
m <- qpm_model(variables = vars(x = "x"), shocks = shocks(e),
equations = eqs(x ~ rho * x[-1] + e),
params = list(rho = 0.5))
obs <- simulate(qpm_solve(qpm_calibrate(m, rho = 0.8)), nsim = 100, seed = 1)
est <- qpm_estimate(m, obs, priors(rho = beta(0.5, 0.2), e = invgamma(1, 0.3)),
iter = 300, chains = 2, seed = 2, verbose = FALSE)
est
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.