# NOT RUN {
## Example of a simple 2-AC model. First the conventional way:
twoAC(c(2, 2, 6))
# }
# NOT RUN {
## The using a cumulative link model (clm from package ordinal):
if(require(ordinal)) {
response <- gl(3,1)
fit.clm <- clm(response ~ 1, weights = c(2, 2, 6), link = "probit")
clm2twoAC(fit.clm)
## Alternatively we could get estimates and standard errors "by hand":
tab <- coef(summary(fit.clm))
theta <- tab[,1]
(tau <- (theta[2] - theta[1])/sqrt(2))
(d.prime <- (-theta[2] - theta[1])/sqrt(2))
VCOV <- vcov(fit.clm)
(se.tau <- sqrt((VCOV[1,1] + VCOV[2,2] - 2*VCOV[2,1])/2))
(se.d.prime <- sqrt((VCOV[1,1] + VCOV[2,2] + 2*VCOV[2,1])/2))
## Extended example with a regression model for d.prime
## (see the referenced paper for details):
n.women <- c(2, 2, 6)*10
n.men <- c(1, 2, 7)*10
wt <- c(n.women, n.men)
response <- gl(3,1, length = 6)
gender <- gl(2, 3, labels = c("women", "men"))
fm2 <- clm(response ~ gender, weights = wt, link = "probit")
clm2twoAC(fm2)
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab