Mixed linear models with random intercept

Regards:
I adjusted a mixed model with random intercept and I used the lmer4 package. I do not know how to calculate and interpret the Odds Ratio. I have read the agresti and it tells me that the interpretation and calculation must be conditional on a subject with the same random effect. Can you recommend me a book or help me to solve my issue?
I also want to know what command I should use to test the goodness of fit of this model (I used the hoslem.test function but I'm not sure if it's the right one.
Thank you in advance !!!

Original post in Spanish

Saludos,
corrĂ­ un modelo mixto con intercepto aleatorio con el paquete lmer4 funcion glmer, pero me ha sido dificĂ­l interpretar los odds ratio como condicional a un sujeto con el mismo efecto aleatorio. Estuve leyendo el agresti pero la verdad sigo sin entender, me pueden recomendar un libro o ayudarme por favor. Tambien me gustaria saber que comando usar para probar la bondad de ajuste de este modelo use la funciĂłn hoslem.test pero no estoy segura de que sea lo correcto.

Muchas gracias.

Hi Ana Maria, welcome!

The preferred language here is English, could you please translate your question? This would increase your chances of getting help.


Hola Ana Maria, bienvenida!

El lenguaje preferido aquí es el inglés, Podrías por favor traducir tu pregunta? Esto aumentaría tus probabilidades de obtener ayuda.

1 Like

The standard text is Applied Logistic Regression 3rd ed (2013) by David W. Hosmer, Jr., Stanley Lameshow and Rodney X. Sturdivant. On page 168, they state

We feel quite strongly that [goodness of fit tests] should not be used to build [logistic] models the likelihood ratio tests for significance of coefficients are much more powerful and appropriate.

Their key message in evaluating a variable is "does the model perform better with or without its inclusion?" Their recommended methods are log likelihood, score and Wald.

For a highly technical subject, the text is very understandable. Two R oriented texts, Introductory Statistics with R by Peter Dalgaard and *Practical Statistics for Data Scientists" by Peter Bruce and Andrew Bruce have the best treatment of logistic regression that I've seen for R, but neither goes into the level of detail as Hosmer et al.

1 Like

Sorry my Spanish is so rusty.

The odds ratio in a logistic regression is expressed as

$$odds-ratio = \frac{(Odds(Y=1|X=1)}{(Odds(Y = 1| X = 0)}$$

where Y is the binary dependent variable and X is the independent variable. An odds ratio of 2 means that the odds of Y=1 are twice those if X=1 than if X=0.

To convert to a probability with a fitted model

pred <- predict(your_model)
prob <- 1/(1 + exp(-pred))
summary(prob)

For your other questions, a reproducible example, called a reprex would be very helpful.

Regards:
I adjusted a mixed model with random intercept and I used the lmer4 package. I do not know how to calculate and interpret the Odds Ratio. I have read the agresti and it tells me that the interpretation and calculation must be conditional on a subject with the same random effect. Can you recommend me a book or help me to solve my issue?
I also want to know what command I should use to test the goodness of fit of this model (I used the hoslem.test function but I'm not sure if it's the right one.
Thank you in advance !!!

thanks! I will try this method

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.