Description Usage Arguments Details Value Note Author(s) References See Also Examples

A wrapper for `glm`

in which the deviance for the model with binomial family and link `probit.lambda`

is profiled as a function of `lambda`

, the upper asymptote of the psychometric function.

1 2 |

`formula` |
a symbolic description of the model to be fit |

`data` |
an optional data frame, list or environment (or object coercible by |

`NumAlt` |
the number of alternatives, |

`lambda` |
a sequence of values to profile for the upper asymptote of the psychometric function |

`plot.it` |
logical indicating whether to plot the profile of the deviances as a function of |

`...` |
further arguments passed to |

The psychometric function fit to the data is described by

*P(x) = 1/m + (1 - 1/m - λ) Φ(x)*

where *m* is the number of alternatives and the lower asymptote, *1 - λ* is the upper asymptote and *Φ* 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 two additional components, `lambda`

, giving the estimated minimum of the profile by fitting a quadratic to the profile and a data frame containing the profiled deviance values for each value of `lambda`

tested. The degrees of freedom are reduced by 1 to take into account the estimation of `lambda`

.

If the minimum occurs outside the interval examined, an error might occur. In any case, re-running the function with a new range of `lambda`

that includes the minimum should work. if the plotted profile indicates that the fitted quadratic does not describe well the profile at the minimum, refitting with a more restricted range of `lambda`

is recommended.

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`

, `probit.lambda`

, `family`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ```
b <- 3.5
g <- 1/3
d <- 0.025
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
set.seed(12161952)
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)
## First with upper asymptote at 1
dd.glm <- glm(resp.mat ~ cnt, family = binomial(mafc.probit(3)))
summary(dd.glm)
dd.lam <- glm.lambda(resp.mat ~ cnt, NumAlt = 3, lambda = seq(0, 0.03,
len = 100), plot.it = TRUE)
summary(dd.lam)
## can refine interval, but doesn't change result much
dd.lam2 <- glm.lambda(resp.mat ~ cnt, NumAlt = 3,
lambda = seq(dd.lam$lambda/sqrt(2), dd.lam$lambda*sqrt(2),
len = 100), plot.it = TRUE)
summary(dd.lam2)
## Compare fits w/ and w/out lambda
anova(dd.glm, dd.lam2, test = "Chisq")
plot(cnt, phat, log = "x", cex = 1.5, ylim = c(0, 1))
pcnt <- seq(0.01, 0.1, len = 100)
lines(pcnt, predict(dd.glm, data.frame(cnt = pcnt),
type = "response"), lwd = 2)
lines(pcnt, predict(dd.lam, data.frame(cnt = pcnt),
type = "response"), lwd = 2, lty = 2)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.