R/EmpiricalFns.R
resampleScoreModel.Rd
Studentized bootstrap variance estimate for scoreFn(yValues,modelValues).
resampleScoreModel( modelValues, yValues, scoreFn, ..., na.rm = FALSE, returnScores = FALSE, nRep = 100, parallelCluster = NULL )
modelValues | numeric array of predictions (model to test). |
---|---|
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. |
summaries
#> #> Pearson's product-moment correlation #> #> data: m1 and y #> t = 3, df = 3, p-value = 0.02883 #> alternative hypothesis: true correlation is greater than 0 #> 95 percent confidence interval: #> 0.1526678 1.0000000 #> sample estimates: #> cor #> 0.8660254 #>f <- function(modelValues,yValues) { if((sd(modelValues)<=0)||(sd(yValues)<=0)) { return(0) } cor(modelValues,yValues) } s <- sigr::resampleScoreModel(m1,y,f) print(s)#> $fnName #> [1] "resampleScoreModel" #> #> $observedScore #> [1] 0.8660254 #> #> $bias #> [1] -0.06201873 #> #> $sd #> [1] 0.2768382 #> #> $nNA #> [1] 0 #> #> $n #> [1] 5 #>z <- (s$observedScore-0)/s$sd # should check size of z relative to bias! pValue <- pt(z,df=length(y)-2,lower.tail=FALSE) pValue#> [1] 0.0260677