@@ -418,42 +418,6 @@ is_character <- function(x) {
418
418
is.character(x )
419
419
}
420
420
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
-
457
421
# ' @noRd
458
422
retrieve_var <- function (data , var , error = FALSE ) {
459
423
bnec_vars <- attr(data , " bnec_pop" )
@@ -480,48 +444,6 @@ retrieve_var <- function(data, var, error = FALSE) {
480
444
}
481
445
}
482
446
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
-
525
447
# ' @noRd
526
448
extract_formula <- function (x ) {
527
449
out <- try(x [[" bayesnecformula" ]], silent = TRUE )
@@ -532,27 +454,6 @@ extract_formula <- function(x) {
532
454
}
533
455
}
534
456
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
-
556
457
# ' @noRd
557
458
find_transformations <- function (data ) {
558
459
bnec_pop_vars <- attr(data , " bnec_pop" )
0 commit comments