2
$\begingroup$

I have to ascertain what specific rasch item a student needs to attain to have a 70% probability of passing a future criterion test (the tests are correlated, the results below are output from the logistic regression equation).

I ran a logistic regression equation on a series of rasch items. Because the rasch items represent discrete ability scores, and the number of items was not very large (15-items per student) I have to interpolate what rasch item would be needed to have a 70% probability of passing a criterion. Below is the output and code I have tried to use to create the probability.

intercept = -0.8392
slope = 0.4120

Finding probability of 0.70 given the above intercept/slope:

#Eq1
exp((log(0.70) - intercept)/slope)
#Output: 3.225788

This output would indicate a rasch score of 3.225788 would represent a probability of 0.70. But when I use that output to assess the probability of 3.225788, it comes out to a probability of 0.62.

#Eq2
exp(-0.8392+0.4120*(3.225788)) / (1 + exp(-0.8392 + 0.4120*(3.22578)))
#Output: 0.62

I also tried repeating equation 1 by first assigning the log(0.7) to an object (p) in the hopes that this could solve a rounding error that I read about in McElreath's "Statistical Rethinking" but it didn't appear to help.

Please do let me know if you need a reproducible dataset. I thought perhaps the intercept/slope would be enough, but can put together more if needed.

$\endgroup$

migrated from stackoverflow.com Nov 25 '18 at 10:18

This question came from our site for professional and enthusiast programmers.

2
$\begingroup$

I think your arithmetic is wrong ...

  • back-transform 0.7 to the log-odds (logit) scale: log(x/(1-x)) or plogis() in R:
p <- 0.7
log(p/(1-p))  ## 0.847
logit.p <- qlogis(p)   ## same
  • Solve for the desired value (a+b*x=p -> x = (p-a)/b):
int <- -0.8392
slope <- 0.4120
val <- (logit.p-int)/slope  ## 4.093
  • Checking: the logistic function (exp(x)/(1+exp(x)), or 1/(1+exp(-x))) is also available as plogis() in R:
plogis(int+slope*val)  ## 0.7

There's a dose.p function in the MASS package that will do this automatically (and compute approximate standard errors) when provided with a glm object:

$\endgroup$
  • $\begingroup$ Thank you! I’m a bit embarrassed that I didn’t notice I wasn’t properly transforming the probability into odds before trying to solve the equation. $\endgroup$ – aleksis.paul Nov 25 '18 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.