Description Usage Arguments Value Examples
If you use Rstudio, the masher
and spicer
functions can help
remind you which parameters go along with which ipa_brew
flavor.
The basic idea is to write spice(brew, with = spicer_<flavor>())
and mash(brew, with = masher_<flavor>())
. Hitting the tab key with
your curser inside the parentheses of masher_flavor()
will create a
drop-down menu that shows a list of the arguments that go along with
your brew's flavor.
If you have no trouble remembering the parameters that go along
with your brew's flavor, or if you just want your code to be more concise,
you don't have to use the with
argument. Instead, you can just
specify parameter values directly using the ...
argument in the mash
and spice
functions. In the examples below, both approaches are shown.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
bs |
a logical value. If |
bs_maxit |
an integer indicating the maximum number of iterations
for the |
bs_thresh |
convergence threshold for the |
bs_row.center |
a logical value. If |
bs_col.center |
a logical value. If |
bs_row.scale |
a logical value. If |
bs_col.scale |
a logical value. If |
si_type |
two algorithms are implemented, type="svd" or the default type="als". The "svd" algorithm repeatedly computes the svd of the completed matrix, and soft thresholds its singular values. Each new soft-thresholded svd is used to re-impute the missing entries. For large matrices of class "Incomplete", the svd is achieved by an efficient form of alternating orthogonal ridge regression. The "als" algorithm uses this same alternating ridge regression, but updates the imputation at each step, leading to quite substantial speedups in some cases. The "als" approach does not currently have the same theoretical convergence guarantees as the "svd" approach. |
si_thresh |
convergence threshold for the |
si_maxit |
maximum number of iterations for the |
si_final.svd |
only applicable to |
a list with input values that can be passed directly into
mash, e.g mash(brew, with = masher_nbrs())
for a neighbors brew or
mash(brew, with = masher_soft())
for a soft brew.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.