Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confidence intervals for brmultinom? #19

Closed
MelanieCNM opened this issue Jul 3, 2020 · 1 comment
Closed

confidence intervals for brmultinom? #19

MelanieCNM opened this issue Jul 3, 2020 · 1 comment

Comments

@MelanieCNM
Copy link

I am using brmultinom with a small data set (120 cases). Is there a function or command to find the confidence intervals with the brmultinom function? I tried using the confint function but it gives no real output or error message.

All predictors are binary categorical data, except for "Number of Births per Year". The dependent outcome variable "Financial Sustainability" has 3 categories (best, good, poor)
###Set working directory
setwd("C:/Users/Melanie/OneDrive")

###install and library brglm2 package for analysis
install.packages("brglm2")
library(brglm2)

###install and library readxl package to read in data
install.packages("readxl")
library(readxl)

###Read in the data, make the outcome a factor
birthcenter<-read_excel("birthcenterdata")
birthcenter$Financial Sustainability<-as.factor(birthcenter$Financial Sustainability)
bccomplete<-birthcenter[complete.cases(birthcenter),]

Model D: uses "1" as baseline to compare "good" to "poor" and "excellent" to "poor."

###Model D shows each estimated coefficient and associated standard errors
modelD <- brmultinom(Financial Sustainability ~ Number of Births per Year +
Liability Insurance+ Accreditation +Urban/Suburban +
For Profit + Over 3 years +
Licensure Availability,data=bccomplete,ref=1)

summarizes the model

summary(modelD)

Odds ratios

exp(coefficients(modelD))

confidence intervals

confint(modelD,level = 0.95)

confint(modelD,level = 0.95)
2.5 % 97.5 %

Thank you for any / all thoughts + suggestions.

@ikosmidis
Copy link
Owner

Thanks for reporting this. This is just an oversight on my behalf in implementing a confint method for brmultinom. I will do this in the upcoming version. In the meantime, you can get confidence intervals using the non-exported function from nnet:

nnet:::confint.multinom(modelD, level = 0.95)

As expected the lower endpoints here (with the default level = 0.95) are the same to

sD <- summary(modelD)
sD$coefficients - qnorm(0.975) * sD$standard.errors

and the upper to

sD$coefficients + qnorm(0.975) * sD$standard.errors

PS:

  1. Just noticed that you send me an email on that, which unfortunately ended up in the wrong directory. Sorry. Here is the right place for these things
  2. I could not reproduce your example because I could not access "birthcenterdata". If you find any other issues, perhaps try to produce a minimally reproducible example using the examples in the help files (?brmultinom in this case).

ikosmidis added a commit that referenced this issue Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants