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).

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. 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("strengejacke/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.10.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Lüdecke

Last Published

June 27th, 2017

Functions in sjstats (0.10.2)

boot_ci

Standard error and confidence intervals for bootstrapped estimates
bootstrap

Generate nonparametric bootstrap replications
check_assumptions

Check model assumptions
chisq_gof

Chi-square goodness-of-fit-test
cv

Coefficient of Variation
cv_error

Test and training error from model cross-validation
cod

Tjur's Coefficient of Discrimination
converge_ok

Convergence test for mixed effects models
deff

Design effects for two-level mixed models
efc

Sample dataset from the EUROFAMCARE project
mean_n

Row means with min amount of valid values
mn

Sum, mean and median for vectors
inequ_trend

Compute trends in status inequalities
levene_test

Levene-Test for One-Way-Anova
odds_to_rr

Get relative risks estimates from logistic regressions or odds ratio values
eta_sq

Eta-squared of fitted anova
get_model_pval

Get p-values from regression model objects
pred_accuracy

Accuracy of predictions from model fit
hoslem_gof

Hosmer-Lemeshow Goodness-of-fit-test
icc

Intraclass-Correlation Coefficient
prop

Proportions of values in a vector
r2

Compute r-squared of (generalized) linear (mixed) models
se

Standard Error for variables or coefficients
se_ybar

Standard error of sample mean for mixed models
pred_vars

Get predictor and response variables from models
rmse

Compute model quality
robust

Robust standard errors for regression models
table_values

Expected and relative table values
var_pop

Calculate population variance and standard deviation
std_beta

Standardized beta coefficients and CI of linear and mixed models
svyglm.nb

Survey-weighted negative binomial generalised linear model
overdisp

Check overdispersion of GL(M)M's
weight

Weight a variable
wtd_sd

Weighted statistics for variables
mwu

Mann-Whitney-U-Test
nhanes_sample

Sample dataset from the National Health and Nutrition Examination Survey
re_var

Random effect variances
phi

Measures of association for contingency tables
reliab_test

Check internal consistency of a test or questionnaire
sjstats-package

Collection of Convenient Functions for Common Statistical Computations
smpsize_lmm

Sample size for linear mixed models