bandwidth_cross_validation {modelfree}R Documentation

Cross-validation bandwidth for local polymnomial estimator of a psychometric function

Description

This function finds the cross-validation bandwidth for a local polynomial estimate of the psychometric function with specified guessing and lapsing rates.

Usage

bandwidth_cross_validation( r, m, x, H, link = "logit", guessing = 0,
                           lapsing = 0, K = 2, p = 1, ker = "dnorm",
                           maxiter = 50, tol = 1e-6, method = "all")

Arguments

r

number of successes at points x

m

number of trials at points x

x

stimulus levels

H

search interval

link

(optional) name of the link function to be used; 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

method

(optional) loss function to be used in cross-validation: choose from: "ISEeta", "ISE", "deviance"; by default all possible values are calculated

Value

⁠h ⁠ cross-validation bandwidth for the chosen "method"; if no "method" is specified, then it has three components: $pscale, $etascale and $deviance

Examples

data("Miranda_Henson")
x = Miranda_Henson$x
r = Miranda_Henson$r
m = Miranda_Henson$m
numxfit <- 199; # Number of new points to be generated minus 1
xfit <- (max(x)-min(x)) * (0:numxfit) / numxfit + min(x)
# Find a cross-validation bandwidth
bwd_min <- min( diff( x ) )
bwd_max <- max( x ) - min( x )
bwd <- bandwidth_cross_validation( r, m, x, c( bwd_min, bwd_max ) )
bwd <- bwd$deviance # Choose the estimate based on cross-validated deviance
pfit <- locglmfit( xfit, r, m, x, bwd )$pfit
# Plot the fitted curve
plot( x, r / m, xlim = c( 0.1, 1.302 ), ylim = c( 0.0165, 0.965 ), type = "p", pch="*" )
lines(xfit, pfit )

[Package modelfree version 1.2 Index]