close
Skip to content

junedsiddique/ordinalTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ordinalTools: Tools for working with output from ordinal regression models

Description

ordinalTools is a package for working with output from ordinal regression models. As currently implemented, the package uses output from ordinal logistic regressions fit using the `polr()’ function from the package MASS to calculate means based on user-specified covariate constrasts. Standard errors are estimated either using the delta method or bootstrapping.

Basic Features

  • The package contains a single function named ordinal_means() where the only required argument is object, an object of class polr.

  • Methods for standard generics are provided, i.e., coef(), summary(), confint(), and print().

  • Bootstrap standard errors and confidence intervals can be estimated using se.type=“bootstrap” and by specifying the data frame used to fit the original polr regression model.

  • If two contrasts are specified, the function will also calculate the difference in means based on the two contrasts as well as its standard error and confidence interval.

Basic Use

Let y denote an ordinal outcome, and x1 and x2 covariates. An ordinal logistic regression model model with y as outcome and x1 and x2 as covariates is fitted using the polr package

library(MASS)
polr.fit <- polr(y ~ x1 + x2, data = DF, Hess=TRUE)

Using the polr.fit object, we can calculate the mean of y for various levels of the covariates x1 and x2

fit <- ordinal_means(polr.fit, contrast1=c(0,0), contrast2=c(1,0))

summary(fit)
confint(fit)

To calculate bootstrap standard errors and bootstrap confidence intervals, one must specify the data frame used in the polr call.

fit <- ordinal_means(polr.fit, data=DF, contrast1=c(0,0), contrast2=c(1,0),
                     se.type="bootstrap", R=100, conf.level = 0.95)

summary(fit)
confint(fit)

Installation

The development version of the package can be installed from GitHub using the devtools package:

devtools::install_github("junedsiddique/ordinalTools")

About

Tools for Working with Output from Ordinal Models

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages