Skip to content

Commit 6da2c44

Browse files
committed
minor edits
1 parent 1db1e90 commit 6da2c44

File tree

2 files changed

+1
-99
lines changed

2 files changed

+1
-99
lines changed

R/helpers.R

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -418,42 +418,6 @@ is_character <- function(x) {
418418
is.character(x)
419419
}
420420

421-
#' #' #' @noRd
422-
#' #' expand_model_set <- function(model) {
423-
#' #' msets <- names(mod_groups)
424-
#' #' if (any(model %in% msets)) {
425-
#' #' group_mods <- intersect(model, msets)
426-
#' #' model <- union(model, unname(unlist(mod_groups[group_mods])))
427-
#' #' model <- setdiff(model, msets)
428-
#' #' }
429-
#' #' model
430-
#' #' }
431-
#'
432-
#' #' @noRd
433-
#' retrieve_valid_family <- function(named_list, data) {
434-
#' if (!"family" %in% names(named_list)) {
435-
#' y <- retrieve_var(data, "y_var", error = TRUE)
436-
#' tr <- retrieve_var(data, "trials_var")
437-
#' family <- set_distribution(y, support_integer = TRUE, trials = tr)
438-
#' } else {
439-
#' family <- named_list$family
440-
#' }
441-
#' validate_family(family)
442-
#' }
443-
444-
#' #' @noRd
445-
#' define_loo_controls <- function(loo_controls, family_str) {
446-
#' if (missing(loo_controls)) {
447-
#' loo_controls <- list(fitting = list(), weights = list(method = "pseudobma"))
448-
#' } else {
449-
#' loo_controls <- validate_loo_controls(loo_controls, family_str)
450-
#' if (!"method" %in% names(loo_controls$weights)) {
451-
#' loo_controls$weights$method <- "pseudobma"
452-
#' }
453-
#' }
454-
#' loo_controls
455-
#' }
456-
457421
#' @noRd
458422
retrieve_var <- function(data, var, error = FALSE) {
459423
bnec_vars <- attr(data, "bnec_pop")
@@ -480,48 +444,6 @@ retrieve_var <- function(data, var, error = FALSE) {
480444
}
481445
}
482446

483-
#' #' @noRd
484-
#' add_brm_defaults <- function(brm_args, model, family, predictor, response,
485-
#' skip_check, custom_name) {
486-
#' if (!("chains" %in% names(brm_args))) {
487-
#' brm_args$chains <- 4
488-
#' }
489-
#' if (!("sample_prior" %in% names(brm_args))) {
490-
#' brm_args$sample_prior <- "yes"
491-
#' }
492-
#' if (!("iter" %in% names(brm_args))) {
493-
#' brm_args$iter <- 1e4
494-
#' }
495-
#' if (!("warmup" %in% names(brm_args))) {
496-
#' brm_args$warmup <- floor(brm_args$iter / 5) * 4
497-
#' }
498-
#' priors <- try(validate_priors(brm_args$prior, model), silent = TRUE)
499-
#' if (inherits(priors, "try-error")) {
500-
#' brm_args$prior <- define_prior(model, family, predictor, response)
501-
#' } else {
502-
#' brm_args$prior <- priors
503-
#' }
504-
#' if (!("init" %in% names(brm_args)) || skip_check) {
505-
#' msg_tag <- ifelse(family$family == "custom", custom_name, family$family)
506-
#' message(paste0("Finding initial values which allow the response to be",
507-
#' " fitted using a ", model, " model and a ", msg_tag,
508-
#' " distribution."))
509-
#' response_link <- response_link_scale(response, family)
510-
#' init_seed <- NULL
511-
#' if ("seed" %in% names(brm_args)) {
512-
#' init_seed <- brm_args$seed
513-
#' }
514-
#' inits <- make_good_inits(model, predictor, response_link,
515-
#' priors = brm_args$prior, chains = brm_args$chains,
516-
#' seed = init_seed)
517-
#' if (length(inits) == 1 && "random" %in% names(inits)) {
518-
#' inits <- inits$random
519-
#' }
520-
#' brm_args$init <- inits
521-
#' }
522-
#' brm_args
523-
#' }
524-
525447
#' @noRd
526448
extract_formula <- function(x) {
527449
out <- try(x[["bayesnecformula"]], silent = TRUE)
@@ -532,27 +454,6 @@ extract_formula <- function(x) {
532454
}
533455
}
534456

535-
#' #' @noRd
536-
#' #' @importFrom stats model.frame
537-
#' has_family_changed <- function(x, data, ...) {
538-
#' brm_args <- list(...)
539-
#' for (i in seq_along(x)) {
540-
#' formula <- extract_formula(x[[i]])
541-
#' bdat <- model.frame(formula, data = data, run_par_checks = TRUE)
542-
#' model <- get_model_from_formula(formula)
543-
#' family <- retrieve_valid_family(brm_args, bdat)
544-
#' model <- check_models(model, family, bdat)
545-
#' checked_df <- check_data(data = bdat, family = family, model = model)
546-
#' }
547-
#' out <- all.equal(checked_df$family, x[[1]]$fit$family,
548-
#' check.attributes = FALSE, check.environment = FALSE)
549-
#' if (is.logical(out)) {
550-
#' FALSE
551-
#' } else {
552-
#' TRUE
553-
#' }
554-
#' }
555-
556457
#' @noRd
557458
find_transformations <- function(data) {
558459
bnec_pop_vars <- attr(data, "bnec_pop")

R/nsec_multi.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ nsec_multi <- function(object, sig_val = 0.01, resolution = 50,
9292
if(!is.na(multi_var)) {
9393
vars <- object$data |> dplyr::select(starts_with(multi_var)) |> colnames()
9494
if(length(vars)==0) stop("multi_var does not appear to be in your input data.")
95+
9596
all_nsec_out <- apply(p_samples, MARGIN = 3, FUN = get_nsec_multi,
9697
sig_val = sig_val, x_vec = x_vec, xform = xform)
9798
names(all_nsec_out) <- vars

0 commit comments

Comments
 (0)