R/EmpiricalFns.R
resampleScoreModelPair.Rd
Studentized bootstrap test of strength of scoreFn(yValues,model1Values) > scoreFn(yValues,model1Values) sampled with replacement.
resampleScoreModelPair( model1Values, model2Values, yValues, scoreFn, ..., na.rm = FALSE, returnScores = FALSE, nRep = 100, parallelCluster = NULL, sameSample = FALSE )
model1Values | numeric array of predictions (model to test). |
---|---|
model2Values | numeric array of predictions (reference model). |
yValues | numeric/logical array of outcomes, dependent, or truth values |
scoreFn | function with signature scoreFn(modelValues,yValues) returning scalar numeric score. |
... | not used, forces later arguments to be bound by name. |
na.rm | logical, if TRUE remove NA values |
returnScores | logical if TRUE return detailed resampledScores. |
nRep | integer number of repititions to perform. |
parallelCluster | optional snow-style parallel cluster. |
sameSample | logical if TRUE use the same sample in computing both scores during bootstrap replication (else use independent samples). |
summaries
True confidence intervals are harder to get right (see "An Introduction to the Bootstrap", Bradely Efron, and Robert J. Tibshirani, Chapman & Hall/CRC, 1993.), but we will settle for simple p-value estimates.
#> [1] 0.8660254#> [1] 0.7071068f <- function(modelValues,yValues) { if((sd(modelValues)<=0)||(sd(yValues)<=0)) { return(0) } cor(modelValues,yValues) } resampleScoreModelPair(m1,m2,y,f)#> [1] "Studentized empirical test: is difference greater than zero on re-samples, summary: e=n.s."