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

Creates a copy of the binomial family with the inverse link function changed to equal the 2-AFC psychometric function and correspondingly changed link function and derivative of the inverse link function.

1 | ```
twoAFC()
``` |

A binomial family object for models. Among other things it inludes the
psychometric function as
`linkinv`

and the inverse psychometric function (for direct
dprime computation) as
`linkfun`

.

Several functions in this package makes use of the function, but it may also be used on its own—see the example below.

Rune Haubo B Christensen and Per Bruun Brockhoff

Brockhoff, P.B. and Christensen, R.H.B. (2010). Thurstonian models for sensory discrimination tests as generalized linear models. Food Quality and Preference, 21, pp. 330-338.

`triangle`

, `threeAFC`

,
`tetrad`

, `duotrio`

, `discrim`

,
`discrimPwr`

, `discrimSim`

,
`AnotA`

, `discrimSS`

,
`samediff`

, `findcr`

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 | ```
## Estimating d-prime using glm for a 2-AFC test:
xt <- matrix(c(10, 5), ncol = 2) ## data: 10 correct answers, 5 incorrect
res <- glm(xt ~ 1, family = twoAFC)
summary(res)
## Equivalent to (Estimate and Std. Error):
discrim(10, 15, method="twoAFC")
## Extended example plotting the profile likelihood
## data: 10 correct and 8 incorrect:
xt <- matrix(c(10, 8), ncol = 2)
summary(res <- glm(xt ~ 1, family = twoAFC))
N <- 100
dev <- double(N)
level <- c(0.95, 0.99)
delta <- seq(1e-4, 3, length = N)
for(i in 1:N)
dev[i] <- glm(xt ~ -1 + offset(delta[i]),
family = twoAFC)$deviance
plot(delta, exp(-dev/2), type = "l",
xlab = expression(delta),
ylab = "Normalized Profile Likelihood")
## Add Normal approximation:
lines(delta, exp(-(delta - coef(res))^2 /
(2 * vcov(res))), lty = 2)
## Add confidence limits:
lim <- sapply(level, function(x)
exp(-qchisq(x, df=1)/2) )
abline(h = lim, col = "grey")
``` |

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.