Learn R Programming

rACMEMEEV (version 1.0.1)

traceplots: Create Traceplots for the Parameters

Description

Create sampler traceplots to run diagnostics on whether or not the sampler converged when creating the posterior. Columns should always be in the order that they appear in the model.

Usage

traceplots(input, columns, pre_model = FALSE, stan = FALSE)

Value

plotted objects

Arguments

input

list List of the model output

columns

vector The target columns to assess

pre_model

bool If you are passing the pre-model

stan

bool If the model is stan based

Examples

Run this code
columns <- c("fruit", "veg", "tobacco")
fruit_v_coef <- generate_coefficient(100, 0.3, 0.8, 0.95)
veg_v_coef <- generate_coefficient(100, 0.25, 0.75, 0.95)
tob_v_coef <- generate_coefficient(100, 0.4, 0.7, 0.95)
validity_coefficients <- c(fruit_v_coef, veg_v_coef, tob_v_coef)
data <- data.frame(
 list(
   "BMI" = rnorm(100, mean = 0, sd = 1),
   "fruit" = rnorm(100, mean = 0, sd = 1),
   "veg" = rnorm(100, mean = 0, sd = 1),
   "tobacco" = rnorm(100, mean = 0, sd = 1)
 )
)
output <- acme_model(data, columns)
lambda <- attenuation_matrix(
  output,
  columns,
  validity_coefficients,
)
model_output <- multivariate_model(
  "BMI ~ fruit + veg + tobacco",
  data = data,
  columns = columns,
  a_c_matrix = lambda$matrix,
  sds = lambda$sds,
  variances = lambda$variances,
  univariate = TRUE
)
traceplots(model_output$naive, columns)

Run the code above in your browser using DataLab