cmdSuperLearner.onebin | R Documentation |
This function estimates the conditional mixed density using a given number of bins b
.
cmdSuperLearner.onebin(A, W, b, SL.library, verbose, validRows)
A |
|
W |
|
b |
Integer number of bins >= 2. |
SL.library |
Library to use for bin-specific probabilities. |
verbose |
Logical indicating whether to print progress reports to the command line. |
validRows |
List of rows in each CV fold. |
Returns a named list with the following elements:
bins |
List of length |
bin.fits |
List of length |
a.ecdf |
Empirical CDF of the exposure. |
SL.bin.probs |
SuperLearner conditional probabilities of being in each bin. |
SL.densities |
SuperLearner conditional standardized mixed density correspondint to each bin. |
cv.library.densities |
Cross-validated library conditional standardized mixed density corresponding to each bin. |
library.densities |
Library conditional standardized mixed density corresponding to each bin fit on the full data. |
alg.names |
Algorithm names. |
# Define parameters n <- 300 W <- data.frame(matrix(rnorm(3 * n), ncol = 3)) Z <- rbinom(n, size = 1, prob = 1/(1 + exp(2-W[,1] + W[,2]))) A <- (1-Z) * rnorm(n, mean = W[,2] - W[,3], sd = abs(1 + W[,1])) validRows <- cmdCVFolds(n = n, cvControl = list(V = 10, shuffle=TRUE, validRows = NULL)) bin.fit <- cmdSuperLearner.onebin(A, W, b = 2, SL.library = c("SL.mean", "SL.glm", "SL.gam", "SL.earth"), verbose=TRUE, validRows = validRows)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.