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.
r2_diff(object1, object2, comparison = c("diff", "ratio"), alpha = 0.05)
object1 | An object of either class |
---|---|
object2 | An object of either class |
comparison | What type of comparison should be made. Possible choices include
|
alpha | The function returns a |
Point estimate and confidence interval for the selected comparison
.
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