mash: Mash a brew

Description Usage Arguments Value Methods (by class) Examples

View source: R/mash.R

Description

When an ipa_brew is mashed, training data are used to fit imputation models based on the brew flavor.

Usage

1
2
3
4
5
6
7
mash(brew, with = NULL, ...)

## S3 method for class 'softImpute_brew'
mash(brew, with = NULL, ...)

## S3 method for class 'kneighbors_brew'
mash(brew, with = NULL, ...)

Arguments

brew

an ipa_brew object that may or may not have been spiced (see spice).

with

a helper function for mashing brews. See masher_nbrs and masher_soft)

...

additional arguments for specific brew flavors.

Value

an ipa_brew object with additional values attached to pars.

Methods (by class)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
x1 = rnorm(100)
x2 = rnorm(100) + x1
x3 = rnorm(100) + x1 + x2

outcome = 0.5 * (x1 - x2 + x3)

data <- data.frame(x1=x1, x2=x2, x3=x3, outcome=outcome)

n_miss = 10

data[1:n_miss,'x1'] = NA
sft_brew <- brew_soft(data, outcome=outcome, bind_miss = FALSE)

# these two calls are equivalent
mash(sft_brew, with = masher_soft(bs = FALSE))
mash(sft_brew, bs = FALSE)

knn_brew <- brew_nbrs(data, outcome=outcome, bind_miss = TRUE) %>%

# these two calls are equivalent
mash(knn_brew, with = masher_nbrs(fun_aggr_ctns = median))
mash(knn_brew, fun_aggr_ctns = median)

bcjaeger/ipa documentation built on May 7, 2020, 9:45 a.m.