screen.wgtd.ttestP: Weighted t-test screening algorithm

View source: R/twosamptests.R

screen.wgtd.ttestPR Documentation

Weighted t-test screening algorithm

Description

Convenience wrapper to perform feature selection according to the ranking of P-values returned from weighted t-tests. Implemented via wtd.t.test.

Usage

screen.wgtd.ttestP(..., selector = "cutoff.k", k = 1, minP = 0.1)

Arguments

...

Passed to wtd.t.test. These arguments control bootstrapping of P-values and standard errors as well as forced scaling of weights.

selector

A string corresponding to a subset selecting function implemented in the FSelector package. One of: cutoff.k or cutoff.k.percent. Ignored if minP is non-NULL and at least k features have P-values at or below minP. Default: "cutoff.k".

k

Numeric. Minimum number or proportion of features to select. Passed through to the selector. For cutoff.k, this is an integer indicating the number of features to keep from X. For cutoff.k.percent, this is instead the proportion of features to keep. Default: 1. Ignored if at least k features have P-values at or below minP.

minP

Numeric. To pass the screen, resulting P-values must not exceed this number. Default is 0.1. Ignored if fewer than k features have P-values at or below this value.

Value

A logical vector with length equal to ncol(X)

Examples

# based on example in SuperLearner package
set.seed(1)
n <- 100
p <- 20
X <- matrix(rnorm(n*p), nrow = n, ncol = p)
X <- data.frame(X)
Y <- rbinom(n, 1, plogis(.2*X[, 1] + .1*X[, 2] - .2*X[, 3] + .1*X[, 3]*X[, 4] - .2*abs(X[, 4])))
obsWeights <- 1/runif(n)
screen.wgtd.ttestP(Y, X, binomial(), obsWeights, seq(n), minP = 0.05)

screen.wgtd.ttestP05 <- function(..., minP = 0.05){
    screen.wgtd.ttestP(..., minP = minP)
}

library(SuperLearner)
sl = SuperLearner(Y, X, family = binomial(), cvControl = list(V = 2),
                  obsWeights = obsWeights,
                  SL.library = list(c("SL.lm", "All"),
                                    c("SL.lm", "screen.wgtd.ttestP05")))
sl
sl$whichScreen

saraemoore/SLScreenExtra documentation built on Nov. 4, 2023, 9:31 p.m.