| as.data.frame.mcmc_output {bssm} | R Documentation | 
Convert MCMC Output to data.frame
Description
Converts the MCMC output of run_mcmc to data.frame.
Usage
## S3 method for class 'mcmc_output'
as.data.frame(
  x,
  row.names,
  optional,
  variable = c("theta", "states"),
  times,
  states,
  expand = TRUE,
  use_times = TRUE,
  ...
)
Arguments
| x | Object of class  | 
| row.names | Ignored. | 
| optional | Ignored. | 
| variable | Return samples of  | 
| times | A vector of indices. In case of states, what time points to return? Default is all. | 
| states | A vector of indices. In case of states, what states to return? Default is all. | 
| expand | Should the jump-chain be expanded?
Defaults to  | 
| use_times | If  | 
| ... | Ignored. | 
See Also
as_draws which converts the output for
as_draws object.
Examples
data("poisson_series")
model <- bsm_ng(y = poisson_series, 
sd_slope = halfnormal(0.1, 0.1), 
sd_level = halfnormal(0.1, 1),
  distribution = "poisson")
  
out <- run_mcmc(model, iter = 2000, particles = 10)
head(as.data.frame(out, variable = "theta"))
head(as.data.frame(out, variable = "state"))
# don't expand the jump chain:
head(as.data.frame(out, variable = "theta", expand = FALSE))
# IS-weighted version:
out_is <- run_mcmc(model, iter = 2000, particles = 10, 
  mcmc_type  = "is2")
head(as.data.frame(out_is, variable = "theta"))
[Package bssm version 2.0.2 Index]