plot.mssmEss: Plot Effective Sample Sizes

Description Usage Arguments Value Examples

View source: R/plot.R

Description

Plots the effective sample sizes.

Usage

1
2
## S3 method for class 'mssmEss'
plot(x, y, ...)

Arguments

x

an object of class mssmEss.

y

un-used.

...

un-used.

Value

The plotted x-values, y-values, and maximum possible effective sample size.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if(require(Ecdat)){
  # load data and fit glm to get some parameters to use in an illustration
  data("Gasoline", package = "Ecdat")
  glm_fit <- glm(lgaspcar ~ factor(country) + lincomep + lrpmg + lcarpcap,
                 Gamma("log"), Gasoline)

  # get object to run particle filter
  library(mssm)
  ll_func <- mssm(
    fixed = formula(glm_fit), random = ~ 1, family = Gamma("log"),
    data = Gasoline, ti = year, control = mssm_control(
      N_part = 1000L, n_threads = 1L))

  # run particle filter
  pf <- ll_func$pf_filter(
    cfix = coef(glm_fit), disp = summary(glm_fit)$dispersion,
    F. = as.matrix(.0001), Q = as.matrix(.0001^2))

  # plot effective samples sizes
  plot(get_ess(pf))
}

mssm documentation built on Jan. 31, 2022, 9:08 a.m.