compare_models: Benchmark results

View source: R/compare_models.R

compare_modelsR Documentation

Benchmark results

Description

Evaluate outputs from models implemented using a (1) rjMCMC and (2) Gibbs Variable Selection approach. Returns comparative plots of posterior model rankings and posterior parameter estimates.

Usage

compare_models(
  rj.dat = NULL,
  gvs.fixed = NULL,
  gvs.random = NULL,
  by.model = FALSE,
  kernel.adj = 2,
  viridis.col = FALSE,
  density = TRUE,
  prob = TRUE
)

Arguments

rj.dat

Input rjMCMC object, as returned by trace_rjMCMC.

gvs.fixed

Input Gibbs object, as returned by gibbs using a fixed effect implementation of the dose-response model.

gvs.random

Input Gibbs object, as returned by gibbs using a random effect implementation of the dose-response model.

by.model

Logical. If TRUE, the functions subsets posterior estimates by candidate model.

kernel.adj

Bandwidth adjustment. The bandwidth used to create density plots is given by kernel.adj*bw.

viridis.col

Logical. Whether to use a viridis colour scheme.

density

Logical. If TRUE, compares density plots for each model parameter.

prob

Logical. If TRUE, compares posterior rankings for candidate models.

Author(s)

Phil J. Bouchet

See Also

simulate_data example_brs summary.rjdata

Examples

## Not run: 
library(espresso)

# Simulate data for two species
mydat <- simulate_data(n.species = 2, 
                       n.whales = 16, 
                       max.trials = 3, 
                       covariates = list(exposed = c(0, 5), range = 0.5),
                       mu = c(101, 158), 
                       phi = 20, 
                       sigma = 20, 
                       Rc = c(210, 211), 
                       seed = 58697)
summary(mydat)
     
# Model selection by GVS                        
gvs <- gibbs(dat = mydat, 
             random.effects = FALSE, 
             include.covariates = FALSE, 
             mcmc.n = 1000, 
             burnin = 500)

# Run the reversible jump MCMC
rj <- run_rjMCMC(dat = mydat.config,
                 n.chains = 2,
                 n.burn = 100,
                 n.iter = 100,
                 do.update = FALSE)
                 
# Burn and thin
rj.trace <- trace_rjMCMC(rj.dat = rj)

# Compare outputs
compare_models(rj.dat = rj.trace, gvs.fixed = gvs)

## End(Not run)

pjbouchet/espresso documentation built on July 27, 2024, 12:31 p.m.