This function creates a nice looking table of regression results for a polr (MASS) model. Input either a polr object or dataframe, outcome variable, vector of covariates, method, and type of analysis (univariate or multiple regression). The function returns a dataframe of formatted regression results and prints the results table using kable or htmlTable.
1 2 3 4 5 |
fit |
polr model object [fit or method/covs/out are REQUIRED]. |
df |
Dataframe [fit or df/method/covs/out]. |
method |
Character. Model type in quotes ("logisitc", "probit", "loglog", "cloglog", "cauchit"). Default is "logistic". |
covs |
Character. Vector of covariates to include in model [fit or df/method/covs/out are REQUIRED]. |
out |
Character. Outcome for regression model [fit or df/method/covs/out are REQUIRED]. |
regtype |
Logical. Should the covariates be run separately ("uni") or together in a multiple regression model ("multi"). Deafult is "multi". |
exp |
Logical. Option to exponentiate coefficients and CI's. Default is NA (estimates exponentiated for logistic method by default). |
estname |
Character. Label for regression estimate. Default is NA (program will choose a reasonable name depending on model type). |
refcat |
Logical. If TRUE the table will create a separate line for the reference category. Default is FALSE. |
labels |
Character. Vector of labels for covariates. Default is NA (use variable names). |
type2 |
Logical. If TRUE, type II p-values will be added to the table. Default is FALSE. |
type3 |
Logical, If TRUE, type III p-values will be added to the table. Default is FALSE. |
est.dec |
Numeric. Number of decimal places for estimates. Default is 2. |
ci.dec |
Numeric. Number of decimal places for 95 percent confidence interval. Default is 2. |
pval.dec |
Numeric. Number of decimal places for pvalues. Must be an integer from 1 to 4. Default is 3. |
color |
Character. Color to use for htmlTable striping. Default is "#EEEEEE" (light grey). Use "white" for no striping. |
kable |
Logical. If TRUE, table will be formatted using the kable packge. Default is TRUE. |
htmlTable |
Logical. If TRUE, the table will be printed using htmlTable. Default is FALSE. |
title |
Character. Optional title above table. Default is "". |
footer |
Logical. If TRUE, table will include a footnote with model details. Default is TRUE. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.