Skip to contents

Reduce the size of an lx_model by compressing posterior draws and/or dropping optional components. Public and private draws are always kept, but can be subsampled or averaged. By default no draw compression is applied, but simulated answers are still dropped, which can be useful when you don't need them.

Usage

lx_prune(
  model,
  compress = c("subsample", "mean"),
  size = 1,
  method = c("even", "random"),
  seed = NULL,
  drop_sim = TRUE,
  drop_responses = FALSE,
  drop_diagnostics = FALSE
)

Arguments

model

An object of class lx_model.

compress

How to compress draws. "subsample" keeps a subset of draws; "mean" replaces draws with per-respondent posterior means (1 column).

size

For compress = "subsample", controls how many draws to keep. If size is in (0, 1], it is treated as a fraction of draws to keep. If size is > 1, it is treated as a count of draws to keep. Default is 1 (keep all draws).

method

When subsampling, how to pick draws. "even" selects evenly spaced draws; "random" samples draws without replacement.

seed

Optional integer seed used for random subsampling.

drop_sim

Logical. If TRUE, drop simulated responses (sim_public, sim_private).

drop_responses

Logical. If TRUE, drop observed responses (response_public, response_private, response_majority).

drop_diagnostics

Logical. If TRUE, drop draws_summary and rhat_summary.

Value

An lx_model object.

Examples

model_small <- lx_prune(example_lx_model, size = 0.5)
model_mean <- lx_prune(example_lx_model, compress = "mean")