# sjstats v0.17.5

Monthly downloads

## Collection of Convenient Functions for Common Statistical Computations

Collection of convenient functions for common statistical computations,
which are not directly provided by R's base or stats packages.
This package aims at providing, first, shortcuts for statistical
measures, which otherwise could only be calculated with additional
effort (like standard errors or root mean squared errors). Second,
these shortcut functions are generic (if appropriate), and can be
applied not only to vectors, but also to other objects as well
(e.g., the Coefficient of Variation can be computed for vectors,
linear models, or linear mixed models; the r2()-function returns
the r-squared value for 'lm', 'glm', 'merMod' and other model objects).
The focus of most functions lies on summary statistics or fit
measures for regression models, including generalized linear
models, mixed effects models and Bayesian models. However, some
of the functions also deal with other statistical measures,
like Cronbach's Alpha, Cramer's V, Phi etc.

## Readme

# sjstats - Collection of Convenient Functions for Common Statistical Computations

Collection of convenient functions for common statistical computations, which are not directly provided by R's base or stats packages.

This package aims at providing, **first**, shortcuts for statistical measures, which otherwise could only be calculated with additional effort (like standard errors, Cronbach's Alpha or root mean squared errors), or for which currently no functions available.

**Second**, these shortcut functions are generic (if appropriate), and can be applied not only to vectors, but also to other objects as well (e.g., the Coefficient of Variation can be computed for vectors, linear models, or linear mixed models; the `r2()`

-function returns the r-squared value for *lm*, *glm*, *merMod*, *glmmTMB*, or *lme* and other objects).

Most functions of this package are designed as *summary functions*, i.e. they do not transform the input vector; rather, they return a summary, which is sometimes a vector and sometimes a tidy data frame (where column names follow a common convention). The focus of most functions lies on summary statistics or fit measures for regression models, including generalized linear models, mixed effects models or Bayesian models. However, some of the functions deal with other statistical measures, like Cronbach's Alpha, Cramer's V, Phi etc.

The comprised tools include:

- For regression and mixed models: Coefficient of Variation, Root Mean Squared Error, Residual Standard Error, Coefficient of Discrimination, R-squared and pseudo-R-squared values, standardized beta values, p-values
- Especially for mixed models: Design effect, ICC, sample size calculation and convergence tests
- Especially for Bayesian models: Highest Density Interval, region of practical equivalence (rope), Monte Carlo Standard Errors, ratio of number of effective samples, mediation analysis, Test for Practical Equivalence
- Fit and accuracy measures for regression models: Overdispersion tests, accuracy of predictions, test/training-error comparisons, error rate and binned residual plots for logistic regression models
- For anova-tables: Eta-squared, Partial Eta-squared, Omega-squared and Partial Omega-squared statistics

Furthermore, *sjstats* has functions to access information from model objects, which either support more model objects than their *stats* counterparts, or provide easy access to model attributes, like:

`model_frame()`

to get the model frame,`model_family()`

to get information about the model family, link functions etc.,`link_inverse()`

to get the link-inverse function,`pred_vars()`

and`resp_var()`

to get the names of either the dependent or independent variables, or`var_names()`

to get the "cleaned" variables names from a model object (cleaned means, things like`s()`

or`log()`

are removed from the returned character vector with variable names.)

Other statistics:

- Cramer's V, Cronbach's Alpha, Mean Inter-Item-Correlation, Mann-Whitney-U-Test, Item-scale reliability tests

## Documentation

Please visit https://strengejacke.github.io/sjstats/ for documentation and vignettes.

## Installation

### Latest development build

To install the latest development snapshot (see latest changes below), type following commands into the R console:

```
library(devtools)
devtools::install_github("strengejacke/sjstats")
```

Please note the package dependencies when installing from GitHub. The GitHub version of this package may depend on latest GitHub versions of my other packages, so you may need to install those first, if you encounter any problems. Here's the order for installing packages from GitHub:

sjlabelled → sjmisc → sjstats → ggeffects → sjPlot

### Officiale, stable release

To install the latest stable release from CRAN, type following command into the R console:

```
install.packages("sjstats")
```

## Citation

In case you want / have to cite my package, please use `citation('sjstats')`

for citation information.

## Functions in sjstats

Name | Description | |

cv | Compute model quality | |

chisq_gof | Compute model quality | |

is_prime | Find prime numbers | |

inequ_trend | Compute trends in status inequalities | |

bootstrap | Generate nonparametric bootstrap replications | |

mwu | Mann-Whitney-U-Test | |

boot_ci | Standard error and confidence intervals for bootstrapped estimates | |

auto_prior | Create default priors for brms-models | |

nhanes_sample | Sample dataset from the National Health and Nutrition Examination Survey | |

check_assumptions | Check model assumptions | |

se_ybar | Standard error of sample mean for mixed models | |

p_value | Get p-values from regression model objects | |

prop | Proportions of values in a vector | |

std_beta | Standardized beta coefficients and CI of linear and mixed models | |

smpsize_lmm | Sample size for linear mixed models | |

cv_error | Test and training error from model cross-validation | |

mean_n | Row means with min amount of valid values | |

deff | Design effects for two-level mixed models | |

sjstats-package | Collection of Convenient Functions for Common Statistical Computations | |

odds_to_rr | Get relative risks estimates from logistic regressions or odds ratio values | |

mediation | Summary of Bayesian multivariate-response mediation-models | |

overdisp | Deprecated functions | |

svyglm.nb | Survey-weighted negative binomial generalised linear model | |

table_values | Expected and relative table values | |

weight | Weight a variable | |

efc | Sample dataset from the EUROFAMCARE project | |

gmd | Gini's Mean Difference | |

eta_sq | Effect size statistics for anova | |

fish | Sample dataset | |

find_beta | Determining distribution parameters | |

grpmean | Summary of mean values by group | |

wtd_sd | Weighted statistics for tests and variables | |

reexports | Objects exported from other packages | |

robust | Robust standard errors for regression models | |

phi | Measures of association for contingency tables | |

scale_weights | Rescale design weights for multilevel analysis | |

se | Standard Error for variables or coefficients | |

tidy_stan | Tidy summary output for stan models | |

var_pop | Calculate population variance and standard deviation | |

No Results! |

## Vignettes of sjstats

Name | ||

anova-statistics.Rmd | ||

bayesian-statistics.Rmd | ||

mixedmodels-statistics.Rmd | ||

No Results! |

## Last month downloads

## Details

Type | Package |

Encoding | UTF-8 |

Date | 2019-06-04 |

License | GPL-3 |

URL | https://github.com/strengejacke/sjstats, https://strengejacke.github.io/sjstats |

BugReports | https://github.com/strengejacke/sjstats/issues |

RoxygenNote | 6.1.1 |

VignetteBuilder | knitr |

NeedsCompilation | no |

Packaged | 2019-06-04 12:32:17 UTC; mail |

Repository | CRAN |

Date/Publication | 2019-06-04 13:10:02 UTC |

imports | bayestestR (>= 0.2.0) , broom , dplyr , emmeans , insight (>= 0.3.0) , lme4 , magrittr , MASS , modelr , performance (>= 0.2.0) , purrr , rlang , sjlabelled (>= 1.0.17) , sjmisc (>= 2.7.8) , tidyr |

suggests | brms , car , coin , ggplot2 , graphics , httr , knitr , mediation , nlme , pbkrtest (>= 0.4-7) , pwr , rstan , rstanarm , sandwich , sjPlot , survey , testthat , VGAM , Zelig |

depends | R (>= 3.2) , stats , utils |

Contributors |

#### Include our badge in your README

```
[![Rdoc](http://www.rdocumentation.org/badges/version/sjstats)](http://www.rdocumentation.org/packages/sjstats)
```