optim_risk_y_r2: Cross-validated non-parametric R-squared for computing...

Description Usage Arguments Value Examples

Description

In general, the function passed to y_weight_control$optim_risk should expect a named list of outcomes (Y) and predictions (pred) in validation folds and should return a criteria by which outcome weights may be optimized. The weights are input to the function via y_weight and are optimized in the y_weight_control$weight_fn. See Examples section below for an example of the format of the input list used for y_weight_control$optim_risk functions.

In this case, the function computes cross-validated nonparametric R-squared.

Usage

1
optim_risk_y_r2(y_weight, input, y_weight_control)

Arguments

y_weight

A numeric vector of weights corresponding to each outcome. Typically, this is what is maximized over in y_weight_control$weight_fn.

input

A list with named entries Y (matrix of outcomes for this validation fold) and pred (matrix of super learner predictions for each outcomes with columns corresponding to different outcomes).

y_weight_control

Composite outcome weight control options.

Value

Numeric value of cross-validated R-squared

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#Simulate data with proper format:
input <- list(Y = cbind(rnorm(50), rnorm(50)), pred = cbind(rnorm(50), rnorm(50)))

# made up weights
y_weight <- c(0.5, 0.5)

# linear combination of outcomes
y_weight_control <- list(ensemble_fn = "ensemble_linear")

# get risk
risk <- optim_risk_y_r2(y_weight, input, y_weight_control)

benkeser/cvma documentation built on May 5, 2019, 1:37 p.m.