bootstrap_ci_th: Bootstrap confidence interval for a slope of a psychometric...

View source: R/bootstrap_ci_th.R

bootstrap_ci_thR Documentation

Bootstrap confidence interval for a slope of a psychometric function

Description

Finds a bootstrap estimate of a confidence interval at a significance level alpha for the estimated threshold for the local polynomial estimate of the psychometric function with guessing and lapsing rates. The confidence interval is based on bootstrap percentiles. See Efron & Tibshirani's "An introduction to the bootstrap", 1993

Usage

bootstrap_ci_th( TH, r, m, x, N, h0, alpha = 0.05,
                 X = (max(x)-min(x))*(0:999)/999+min(x), link = "logit", guessing = 0,
                 lapsing = 0, K = 2, p = 1, ker = "dnorm", maxiter = 50, tol = 1e-6 )

Arguments

TH

required threshold level

r

number of successes at points x

m

number of trials at points x

x

stimulus levels

N

number of bootstrap replications; N should be at least 1000 for reliable results

h0

bandwidth

alpha

(optional) significance level of the confidence interval; default is 0.05

X

(optional) set of values at which estimates of the psychometric function for the threshold estimation are to be obtained; if not given, 1000 equally spaced points from minimum to maximum of x are used

link

(optional) name of the link function; default is "logit"

guessing

(optional) guessing rate; default is 0

lapsing

(optional) lapsing rate; default is 0

K

(optional) power parameter for Weibull and reverse Weibull link; default is 2

p

(optional) degree of the polynomial; default is 1

ker

(optional) kernel function for weights; default is "dnorm"

maxiter

(optional) maximum number of iterations in Fisher scoring; default is 50

tol

(optional) tolerance level at which to stop Fisher scoring; default is 1e-6

Value

⁠ci ⁠ confidence interval based on bootstrap percentiles

⁠th0 ⁠ threshold estimate

Examples

## Not run: 
data("Miranda_Henson")
x = Miranda_Henson$x
r = Miranda_Henson$r
m = Miranda_Henson$m
bwd_min <- min( diff( x ) )
bwd_max <- max( x ) - min( x )
bwd <- bandwidth_cross_validation( r, m, x, c( bwd_min, bwd_max ), method = "deviance" )
prob <- 0.5 # Required threshold level
alpha <- 0.05 # Significance level for the confidence intervals
# This might take a few minutes
niter <- 1000 # Note number of bootstrap iterations should be at least 1000
ci_th <- bootstrap_ci_th( prob, r, m, x, niter, bwd, alpha ) # Be patient, slow process

## End(Not run)


modelfree documentation built on May 31, 2023, 7:17 p.m.