cmdSuperLearner.onebin: cmdSuperLearner for a specific number of bins

View source: R/mixed.dens.R

cmdSuperLearner.onebinR Documentation

cmdSuperLearner for a specific number of bins

Description

This function estimates the conditional mixed density using a given number of bins b.

Usage

cmdSuperLearner.onebin(A, W, b, SL.library, verbose, validRows)

Arguments

A

n x 1 numeric vector of exposure values.

W

n x p data.frame of covariate values to condition upon.

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.

Value

Returns a named list with the following elements:

bins

List of length b containing the sets used for each bin.

bin.fits

List of length b containing the estimated SuperLearner objects for each bin.

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.

Examples

# 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)

tedwestling/ctsCausal documentation built on Dec. 7, 2022, 3:33 p.m.