make_mod_res: Summarise results from 'make_ll_model'

View source: R/make_mod_res.R

make_mod_resR Documentation

Summarise results from make_ll_model

Description

Should now be generic enough to

Usage

make_mod_res(
  mod_file,
  ref = -20,
  pred_step = 1,
  include_random = FALSE,
  new_level = "State",
  cov_q = NULL,
  cov_val = NULL,
  res_q = c(0.1, 0.5, 0.9),
  ps_thresh = 0.05,
  keep_mod = TRUE,
  keep_pred = TRUE,
  do_gc = TRUE,
  ...
)

Arguments

mod_file

Character. Path to saved results from make_ll_model

ref

Character or numeric. One of: a single level of cat_col from make_ll_model to set as the reference level; a single value of var_col from make_ll_model to use as a reference value or a negative integer on the scale of var_col to compare all values of var_col against var_col + ref.

pred_step

Numeric. What step (in units of var_col) to predict at?

include_random

Logical. If there is a random effect in the original model, should the levels of that random effect be conditioned on? If not, provide new_level and a hypothetical new group will be provided.

new_level

Character. Name to assign to hypothetical new group.

cov_q

Numeric. What quantiles of cov to predict at?

cov_val

Numeric. Alternative to cov_q. What value of cov to predict at?

res_q

Numeric. What quantiles to summarise predictions at?

ps_thresh

Numeric value used in the threshold argument to bayestestR::p_significance(). Set to zero to return probability of direction

keep_mod

Logical. Return mod component of results (imported from mod_file). Saves memory if this is not returned.

keep_pred

Logical. Return pred component of results? Saves memory if this is not returned.

do_gc

Logical. Run base::gc after predict? On a server with shared resources, can be necessary when summarising many, many models to prevent RAM issues.

...

Passed to tidybayes::add_epred_draws()

Value

A list with components

list_length

data frame of list length quantiles in original data

data

data frame of original data retrieved from mod$data

pred

data frame of predictions (via tidybayes::add_epred_draws()), including a diff column of the difference between reference and each pred_step from the minimum of var_col to the maximum of var_col

res

data frame of predictions summarised, including columns for each of res_q (applied to the differences between ref and rec)

n_data

nrow(mod$data)

n_fixed_coefs

⁠length(mod$coefficients[!grepl("b\\[", names(mod$coefficients))])⁠

n_random_coefs

⁠length(mod$coefficients[grepl("b\\[", names(mod$coefficients))])⁠


Acanthiza/envTrend documentation built on Nov. 16, 2023, 4:24 p.m.