View source: R/bandwidth_plugin.R
bandwidth_plugin | R Documentation |
The function calculates an estimate of the AMISE optimal bandwidth for a local polynomial estimate of the psychometric function.
bandwidth_plugin( r, m, x, link = "logit", guessing = 0,
lapsing = 0, K = 2, p = 1, ker = "dnorm" )
r |
number of successes at points x |
m |
number of trials at points x |
x |
stimulus levels |
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" |
h
plug-in bandwidth (ISE optimal on eta-scale)
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 plug-in bandwidth
bwd <- bandwidth_plugin( r, m, x)
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 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.