[R-sig-ME] Logistic modelling with guessing parameter
Peter Harrison
pharr011 at gold.ac.uk
Thu May 7 19:13:54 CEST 2015
Hello everyone,
I'm currently modelling response data for a musical error detection experiment. Participants' responses can either be correct (1) or incorrect (0); the difficulty of the question is predicted by a number of factors, including accuracy (accurate performance -> errors are difficult to detect) and musical piece ("audio_name").
The model I'm fitting is similar to a 3-PL IRT model, with a constrained guessing parameter of 0.5 (i.e. the most difficult questions should be answered with a 50% success rate). However, instead of the normal conception of item difficulty, probability of correct response is given by a linear combination of difficulty-related predictors (such as accuracy and audio_name). Therefore:
probability of correct response = 0.5 + 0.5 / (1 + exp(predictors))
where predictors = e.g. a*accuracy + b*audio_name + c (but with audio_name dummy coded, with different b for each level of audio_name).
I've been using a script kindly posted by Ken Knoblauch back in 2010 (https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q4/004531.html) to achieve this using lme4, simply changing a few terms to keep it up-to-date with current package versions (see bottom of message for the script). It seems to work fine with "accuracy" as a fixed effect and "p_ID" as a random effect. However, I want to add "audio_name" as a fixed effect, i.e. responses ~ accuracy + audio_name + (1|p_ID). But when I do this, I get the following error message: (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate.
I'm not sure what this error message means, but have been assuming it is talking about a convergence problem. I've tried various things to fix it, including control=glmerControl(optimizer="bobyqa"), control=glmerControl(optimizer="Nelder_Mead"), and nAgQ=3, but none of these have worked.
Would anyone be able to help me with this error message, and what to do about it?
Thanks so much!
Peter
Key to data file:
accuracy = accuracy of the music clip (higher accuracy -> question is more difficult) = continuous variable
audio_name = musical piece played = categorical variable (27 levels, coded with text strings)
p_ID = participant ID = categorical variable (229 levels, coded 1:229)
behind_beat = whether clip was behind the beat or not = dichotomous (1 = TRUE, 0 = FALSE)
Script:
library(lme4)
data <- read.csv("https://dl.dropboxusercontent.com/s/szq2e2sxwfsuxo6/data.csv", header = TRUE)
mafc.logit <- function (.m = 2)
{
.m <- as.integer(.m)
if (.m < 2)
stop(".m must be an integer > 1")
linkfun <- function(mu) {
mu <- pmax(mu, 1/.m + .Machine$double.eps)
qlogis((.m * mu - 1)/(.m - 1))
}
linkinv <- function(eta) {
1/.m + (.m - 1)/.m * binomial()$linkinv(eta)
}
mu.eta <- function(eta) ((.m - 1)/.m) * binomial()$mu.eta(eta)
valideta <- function(eta) TRUE
link <- paste("mafc.logit(", .m, ")", sep = "")
structure(list(linkfun = linkfun, linkinv = linkinv, mu.eta = mu.eta,
valideta = valideta, name = link), class = "link-glm")
}
mod1 <- glmer(responses ~ accuracy + (1|p_ID), family = binomial(mafc.logit(2)), data=data)
summary(mod1)
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list