r2_diff: r2_diff

Description Usage Arguments Value Examples

View source: R/r2Diff.R

Description

Compare the R-squared values in two objects class optWeight or of class r2_optWeight. The former compares the R-squared values for each outcome between the two optWeight objects, while the latter compares the R-squared values for the combined outcome of two r2_optWeight objects.

Usage

1
r2_diff(object1, object2, comparison = c("diff", "ratio"), alpha = 0.05)

Arguments

object1

An object of either class optWeight or of class r2_optWeight. The class type should match that of object2.

object2

An object of either class optWeight or of class r2_optWeight. The class type should match that of object1.

comparison

What type of comparison should be made. Possible choices include "diff" and "ratio".

alpha

The function returns a (1-alpha)*100 percent confidence interval. Default is set to 0.05 (i.e., 95 percent confidence interval)

Value

Point estimate and confidence interval for the selected comparison.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
X <- data.frame(x1=runif(n=100,0,5), x2=runif(n=100,0,5))
Y1 <- rnorm(100, X$x1 + X$x2, 1)
Y2 <- rnorm(100, X$x1 + X$x2, 3)
Y <- data.frame(Y1 = Y1, Y2 = Y2)
#fit1 <- optWeight(Y = Y, X = X, SL.library = c("SL.glm","SL.mean"), 
#family = "gaussian", return.CV.SuperLearner = FALSE)
#perf.fit1 <- r2_optWeight(object = fit1, Y = Y, X = X, evalV = 5)
#fit2 <- optWeight(Y = Y, X = X[,1,drop=FALSE], SL.library = c("SL.glm","SL.mean"), 
#family = "gaussian",return.CV.SuperLearner = FALSE)
#perf.fit2 <- r2_optWeight(object = fit2, Y = Y, X = X[,1,drop=FALSE], evalV = 5)

# compare cross-validated r-squared for each outcome
#comp <- r2_diff(fit1, fit2)
# comp
# compare cross-validated r-squared for combined outcome
#perf.comp <- r2_diff(perf.fit1, perf.fit2)
# perf.comp

benkeser/r2weight documentation built on Sept. 16, 2017, 3:28 a.m.