logit.2asym {psyphy} | R Documentation |
These functions provide links for the binamial family so that psychometric functions can be fit with both the upper and lower asymptotes different from 1 and 0, respectively.
logit.2asym(g, lam) probit.2asym(g, lam) cauchit.2asym(g, lam) cloglog.2asym(g, lam) weib.2asym( ... )
g |
numeric in the range (0, 1), normally <= 0.5, however, which specifies the lower asymptote of the psychometric function. |
lam |
numeric in the range (0, 1), specifying 1 - the upper asymptote of the psychometric function. |
... |
used just to pass along the formals of cloglog.2asym as arguments to weib.2asym . |
These links are used to specify psychometric functions with the form
P(x) = gamma + (1 - gamma - λ) p(x)
where gamma is the lower asymptote and lambda is 1 - the upper asymptote, and p(x) is the base psychometric function, varying between 0 and 1.
Each link returns a list containing functions required for relating the response to the linear predictor in generalized linear models and the name of the link.
linkfun |
The link function |
linkinv |
The inverse link function |
mu.eta |
The derivative of the inverse link |
valideta |
The domain over which the linear predictor is valid |
link |
A name to be used for the link |
Kenneth Knoblauch
Klein S. A. (2001) Measuring, estimating, and understanding the psychometric function: a commentary. Percept Psychophys., 63(8), 1421–1455.
Wichmann, F. A. and Hill, N. J. (2001) The psychometric function: I.Fitting, sampling, and goodness of fit. Percept Psychophys., 63(8), 1293–1313.
glm
, glm
make.link
, psyfun.2asym
#A toy example, b <- 3 g <- 0.05 # simulated false alarm rate d <- 0.03 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) ddprob.glm <- psyfun.2asym(resp.mat ~ cnt, link = probit.2asym) ddlog.glm <- psyfun.2asym(resp.mat ~ cnt, link = logit.2asym) # Can fit a Weibull function, but use log contrast as variable ddweib.glm <- psyfun.2asym(resp.mat ~ log(cnt), link = weib.2asym) ddcau.glm <- psyfun.2asym(resp.mat ~ cnt, link = cauchit.2asym) plot(cnt, phat, log = "x", cex = 1.5, ylim = c(0, 1)) pcnt <- seq(0.01, 0.1, len = 100) lines(pcnt, predict(ddprob.glm, data.frame(cnt = pcnt), type = "response"), lwd = 5) lines(pcnt, predict(ddlog.glm, data.frame(cnt = pcnt), type = "response"), lwd = 2, lty = 2, col = "blue") lines(pcnt, predict(ddweib.glm, data.frame(cnt = pcnt), type = "response"), lwd = 3, col = "grey") lines(pcnt, predict(ddcau.glm, data.frame(cnt = pcnt), type = "response"), lwd = 3, col = "grey", lty = 2)