resampleScoreModel: Studentized bootstrap variance estimate for...

Description Usage Arguments Value Examples

View source: R/EmpiricalFns.R

Description

Studentized bootstrap variance estimate for scoreFn(yValues,modelValues).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
resampleScoreModel(
  modelValues,
  yValues,
  scoreFn,
  ...,
  na.rm = FALSE,
  returnScores = FALSE,
  nRep = 100,
  parallelCluster = NULL
)

Arguments

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.

Value

summaries

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(25325)
y <- 1:5
m1 <- c(1,1,2,2,2)
cor.test(m1,y,alternative='greater')
f <- function(modelValues,yValues) {
 if((sd(modelValues)<=0)||(sd(yValues)<=0)) {
   return(0)
 }
 cor(modelValues,yValues)
}
s <- sigr::resampleScoreModel(m1,y,f)
print(s)
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

sigr documentation built on June 12, 2021, 9:07 a.m.