glm.WH | R Documentation |
A probit fit of a psychometric function with upper asymptote less than 1 is obtained by cycling between a fit with glm
using the probit.lambda
link and optimize
to estimate lambda
, 1 - the upper asymptotic value, until the log Likelihood changes by less than a pre-set tolerance.
glm.WH(formula, data, NumAlt = 2, lambda.init = 0.01,
interval = c(0, 0.05), trace = FALSE, tol = 1e-06, ...)
formula |
a symbolic description of the model to be fit. |
data |
an optional data frame, list or enviroment (or object coercible by |
NumAlt |
integer indicating the number of alternatives (> 1) in the mafc-task. (Default: 2). |
lambda.init |
numeric, initial estimate of 1 - upper asymptote. |
interval |
numeric vector giving interval endpoints within which to search for |
trace |
logical, indicating whether or not to print out a trace of the iterative process. |
tol |
numeric, tolerance for ending iterations. |
... |
futher arguments passed to |
The psychometric function fit to the data is described by
P(x) = 1/m + (1 - 1/m - \lambda) \Phi(x)
where m
is the number of alternatives and the lower asymptote, 1 - \lambda
is the upper asymptote and \Phi
is the cumulative normal function.
returns an object of class ‘lambda’ which inherits from classes ‘glm’ and ‘lm’. It only differs from an object of class ‘glm’ in including an additional components, lambda
, giving the estimated minimum of lambda
. The degrees of freedom are reduced by 1 to take into account the estimation of lambda
.
Ken Knoblauch
Wichmann, F. A. and Hill, N. J. (2001) The psychometric function: I.Fitting, sampling, and goodness of fit. Percept Psychophys., 63(8), 1293–1313.
Yssaad-Fesselier, R. and Knoblauch, K. (2006) Modeling psychometric
functions in R. Behav Res Methods., 38(1), 28–41. (for examples
with gnlr
).
mafc
, glm
,glm.lambda
, probit.lambda
, family
b <- 3.5
g <- 1/4
d <- 0.04
a <- 0.04
p <- c(a, b, g, d)
num.tr <- 160
cnt <- 10^seq(-2, -1, length = 6) # contrast levels
#simulated Weibull-Quick observer responses
truep <- g + (1 - g - d) * pweibull(cnt, b, a)
ny <- rbinom(length(cnt), num.tr, truep)
nn <- num.tr - ny
phat <- ny/(ny + nn)
resp.mat <- matrix(c(ny, nn), ncol = 2)
tst.glm <- glm(resp.mat ~ cnt, binomial(mafc.probit(1/g)))
pcnt <- seq(0.005, 1, len = 1000)
plot(cnt, phat, log = "x", ylim = c(0, 1), xlim = c(0.005, 1),
cex = 1.75)
lines(pcnt, predict(tst.glm, data.frame(cnt = pcnt), type = "response"), lwd = 2)
tst.lam <- glm.WH(resp.mat ~ cnt, NumAlt = 1/g, trace = TRUE)
lines(pcnt, predict(tst.lam, data.frame(cnt = pcnt),
type = "response"), lty = 2, lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.