fit_mix_rule_backfitting: Iteratively Backfit a Super Learner, h(x) = Y|W, and an...

View source: R/fit_iterative_mix_rule_backfitting.R

fit_mix_rule_backfittingR Documentation

Iteratively Backfit a Super Learner, h(x) = Y|W, and an Ensemble Decision Algorithm, g(x), Y|M_x until Convergence.

Description

Iteratively Backfit a Super Learner, h(x) = Y|W, and an Ensemble Decision Algorithm, g(x), Y|M_x until Convergence.

Usage

fit_mix_rule_backfitting(
  at,
  a,
  w,
  y,
  direction,
  w_stack,
  fold,
  max_iter,
  verbose,
  parallel_cv,
  seed
)

Arguments

at

Training dataframe

a

Variable names in the mixture

w

Variable names in the covariates

y

Variable name for the outcome

direction

Positive/negative - max or min coefficient to keep in the ensemble

w_stack

Stack of algorithms made in SL 3 used in ensemble machine learning to fit Y|W

fold

Current fold in the cross-validation

max_iter

Max number of iterations of iterative backfitting algorithm

verbose

Run in verbose setting

parallel_cv

TRUE/FALSE indicator to parallelize cv

seed

Seed number for consistent results

Details

Performs an iterative backfitting algorithm to flexibly adjust for covariates W while finding the best fitting set of mixture rules to partition the space in M.

Value

A list of the mixture rule results within a fold including:

  • rules: A data frame with the data adpatively determined rules found in the pre model along with the coefficient, direction, fold, RMSE and other measures.

  • model: The best fitting pre model found in the fold.

Examples

data <- simulate_mixture_cube()
mix_comps <- c("M1", "M2", "M3")
W <- c("age", "sex", "bmi")
sls <- create_sls()
w_stack <- sls$W_stack
tree_stack <- sls$A_stack
example_output <- fit_mix_rule_backfitting(
  at = data,
  a = mix_comps,
  w = W,
  y = "y",
  direction = "positive",
  w_stack = w_stack,
  fold = 1,
  max_iter = 1,
  verbose = FALSE,
  parallel = FALSE,
  seed = 6442
)

blind-contours/CVtreeMLE documentation built on June 22, 2024, 8:53 p.m.