glm.WH: mafc Probit Fit to Psychometric Function with Upper Asymptote...

View source: R/glm.WH.R

glm.WHR Documentation

mafc Probit Fit to Psychometric Function with Upper Asymptote Less than One

Description

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.

Usage

glm.WH(formula, data, NumAlt = 2, lambda.init = 0.01, 
	interval = c(0, 0.05), trace = FALSE, tol = 1e-06, ...)

Arguments

formula

a symbolic description of the model to be fit.

data

an optional data frame, list or enviroment (or object coercible by as.data.frame containing the variables in the model. If not found in data, the variables are taken from the environment(formula), typically the environment from glm.WH was called.

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 lambda.

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 glm.

Details

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.

Value

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.

Author(s)

Ken Knoblauch

References

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).

See Also

mafc, glm,glm.lambda, probit.lambda, family

Examples

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)


psyphy documentation built on Aug. 19, 2023, 5:07 p.m.