2

I have a multinomial logistic regression model, fitted with nnet::multinom(). My outcome has three categories and I have used one predictor in the model. Ultimately I want to jointly test the null hypothesis of the equality of the predicted probabilities (calculated for specific values of the predictor) for a specific category of my outcome.

My code:

library(nnet)
library(marginaleffects)
mod <- multinom(factor(gear) ~ mpg, data = mtcars, trace = FALSE) # fit the model
pred <- predictions(mod, newdata = data.frame(mpg = c(10, 20, 25))) # predicted probabilities for particular values of my predictor
hypotheses(pred, hypothesis = c("b1 = b2", "b1 = b3"), joint = TRUE) # jointly test the null hypothesis of the equality of probabilities of the first category

The error I get:

Error: Could not extract sample size from model object.

I can run:

hypotheses(pred, hypothesis = c("b1 = b2", "b1 = b3"))

But that tests each hypothesis separately.

Any ideas?

asked Jun 16, 2024 at 8:53

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.