Description Usage Arguments Details Value Examples
In general, the function passed to y_weight_control$cv_risk
should expect a list
of outcomes and predictions in validation folds, in addition to a list called
y_weight
that contains the outcome weights (computed in the training sample)
corresponding to this validation fold and any other information needed by
y_weight_control$cv_risk
(e.g., anything needed to compute confidence
intervals – in this case the marginal mean of the composite outcome in the
training sample). The function should return a list with names cv_measure, ci_low,
ci_high, and p_value. The output of this function is returned irrespective of the
names of the list; however, the names are necessary for print
methods to
work properly.
1 | cv_risk_y_r2(input, y_weight_control)
|
input |
A list where each entry corresponds to a validation fold. Each entry is a list with entries: Y (matrix of outcomes for this validation fold), pred (matrix of super learner predictions for each outcomes with columns corresponding to different outcomes). |
y_weight_control |
Composite outcome weight control options. |
In this case, the confidence intervals are computed on the scale of log(MSE/Var) and back-transformed to the R-squared scale. Here, MSE is the cross-validated mean squared-error of the composite super learner predicting the composite outcome and Var is the cross-validated marginal mean of the composite outcome. The p-value is for the one-sided hypothesis test that cross-validated R-squared equals zero against the alternative that it is greater than zero.
List with named components cv_measure (cross-validated R-squared), ci_low (lower
100(1 - y_weight_control$alpha
)% CI), ci_high (upper
100(1 - y_weight_control$alpha
)% CI), p_value
1 2 3 4 5 6 7 8 9 10 11 12 13 | # simulate data with proper format
input <- list(list(Y = cbind(rbinom(50,1,0.5), rbinom(50,1,0.5)),
pred = cbind(runif(50,0,1), runif(50,0,1)),
y_weight = list(weight = c(0.5, 0.5), ybar=0.5)),
list(Y = cbind(rbinom(50,1,0.5), rbinom(50,1,0.5)),
pred = cbind(runif(50,0,1), runif(50,0,1)),
y_weight = list(weight = c(0.25, 0.75), ybar=0.5)))
# linear combination of outcomes
y_weight_control <- list(ensemble_fn = "ensemble_linear")
# get risk
cv_risk <- cv_risk_y_r2(input, y_weight_control)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.