screen.wgtd.corP: Weighted correlation screening algorithm

View source: R/corr.R

screen.wgtd.corPR Documentation

Weighted correlation screening algorithm

Description

Performs feature selection according to the ranking of P-values returned from weighted correlations. Implemented via wtd.cor.

Usage

screen.wgtd.corP(
  Y,
  X,
  family,
  obsWeights,
  id,
  method = "pearson",
  minPvalue = 0.1,
  k = 2,
  ...
)

Arguments

Y

Outcome (numeric vector). See SuperLearner for specifics.

X

Predictor variable(s) (data.frame or matrix). See SuperLearner for specifics.

family

Error distribution to be used in the model: gaussian or binomial. Currently unused. See SuperLearner for specifics.

obsWeights

Optional numeric vector of observation weights. See SuperLearner for specifics.

id

Cluster identification variable. Currently unused.

method

Which correlation coefficient to compute. Currently only accepts "pearson".

minPvalue

To pass the screen, resulting P-values must not exceed this number.

k

Minimum number of features to select. Only used if less than this number of features are selected using minPvalue.

...

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

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 <- X[, 1] + sqrt(abs(X[, 2] * X[, 3])) + X[, 2] - X[, 3] + rnorm(n)
obsWeights <- 1/runif(n)
screen.wgtd.corP(Y, X, gaussian(), obsWeights, seq(n), minPvalue = 0.000001)

screen.wgtd.corP01 <- function(..., minPvalue = 0.01){
    screen.wgtd.corP(..., minPvalue = minPvalue)
}

library(SuperLearner)
sl = SuperLearner(Y, X, family = gaussian(), cvControl = list(V = 2),
                  obsWeights = obsWeights,
                  SL.library = list(c("SL.glm", "All"),
                                    c("SL.glm.interaction", "screen.wgtd.corP01")))
sl
sl$whichScreen

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