Skip to content

Multilevel logistic regression guessing parameter

1 message · Ken Knoblauch

#
Hi,

I think that you can achieve this with one of the alternate links in the 
psyphy package, like mafc.logit(.m = 2). Here is an example that is 
contrived but I don't have time to generate toy data and you didn't 
supply any. And it is set-up for 4 alternatives so it gives a lower 
asymptote of 0.25 instead of 2.

I had suggested this to you offline, but you said it didn't work, but it 
works fine for me in the example code below.  As I said, the actually 
example doesn't make any sense but it should work for data where it 
does.

library(psyphy)
library(lattice)
library(lme4)

m1 <- glm(cbind(Correct, Incorrect) ~ factor(Size) * Contr,
    binomial(mafc.logit(.m = 4)), ecc2, subset = task == "DET")

contr <- seq(0.01, 0.5, len = 50)

nd2 <- nd <- expand.grid(Contr = contr,
	Size = factor(unique(ecc2$Size)))

nd$pr <- predict(m1, newdata = nd, type = "response")
xyplot(pr ~ Contr | Size, nd, type = "l", ylim = c(0, 1.1))


m2 <- glmer(cbind(Correct, Incorrect) ~  Contr + (Contr | Size),
   ecc2, binomial(mafc.logit(.m = 4)),
   subset = task == "DET")

nd2$pr <- predict(m2, newdata = nd2, re.form = NA,  type = "response")
dev.new()
xyplot(pr ~ Contr | Size, nd2, type = "l", ylim = c(0, 1.1))

HTH,

Ken