Learn R Programming

⚠️There's a newer version (0.19.0) of this package.Take me there.

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 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 or lme objects). The focus of most functions lies on summary statistics or fit measures for regression models, including generalized linear models and mixed effects 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
  • Especially for mixed models: Design effect, ICC, sample size calculation, convergence and overdispersion tests

Other statistics:

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

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("sjPlot/sjstats")

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.

Copy Link

Version

Install

install.packages('sjstats')

Monthly Downloads

23,262

Version

0.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Lüdecke

Last Published

June 20th, 2016

Functions in sjstats (0.2.0)

efc

Sample dataset from the EUROFAMCARE project
eta_sq

Eta-squared of fitted anova
cv

Coefficient of Variation
deff

Design effects for two-level mixed models
cronb

Cronbach's Alpha for a matrix or data frame
get_re_var

Random effect variances
cramer

Cramer's V for a contingency table
converge_ok

Convergence test for mixed effects models
cod

Tjur's Coefficient of Discrimination
hoslem_gof

Hosmer-Lemeshow Goodness-of-fit-test
mean_n

Row means with min amount of valid values
mic

Mean Inter-Item-Correlation
levene_test

Plot Levene-Test for One-Way-Anova
r2

Compute R-squared of (generalized) linear (mixed) models
icc

Intraclass-Correlation Coefficient
mwu

Mann-Whitney-U-Test
phi

Phi value for contingency tables
merMod_p

Get p-values for merMod objects
odds_to_rr

Get relative risks estimates from logistic regressions
overdisp

Check overdispersion of GL(M)M's
table_values

Expected and relative table values
rse

Residual Standard Error (RSE)
re_var

Random effect variances
rmse

Root Mean Squared Error (RMSE)
reliab_test

Performs a reliability test on an item scale
sjstats-package

Collection of Convenient Functions for Common Statistical Computations
se

Standard Error for variables
weight

Weight a variable
std_beta

Standardized Beta coefficients and CI of lm and mixed models
smpsize_lmm

Sample size for linear mixed models
wtd_sd

Weighted standard deviation for variables
weight2

Weight a variable
wtd_se

Weighted standard error for variables