Creates tables to describe different objects (see list of supported objects
in report()
).
Arguments
- x
The R object that you want to report (see list of of supported objects above).
- ...
Arguments passed to or from other methods.
Examples
# \donttest{
library(report)
# Miscellaneous
r <- report_table(sessionInfo())
r
#> Package | Version | Reference
#> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#> Matrix | 1.4.1 |
#> R | 4.2.0 | R Core Team (2022). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
#> Rcpp | 1.0.8.3 | Dirk Eddelbuettel and Romain Francois (2011). Rcpp: Seamless R and C++ Integration. Journal of Statistical Software, 40(8), 1-18, <doi:10.18637/jss.v040.i08>.
#> bayestestR | 0.12.1 | Makowski, D., Ben-Shachar, M., & Lüdecke, D. (2019). bayestestR: Describing Effects and their Uncertainty, Existence and Significance within the Bayesian Framework. Journal of Open Source Software, 4(40), 1541. doi:10.21105/joss.01541
#> dplyr | 1.0.9 |
#> lavaan | 0.6.11 | Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. https://doi.org/10.18637/jss.v048.i02
#> lme4 | 1.1.29 |
#> performance | 0.9.1 | Lüdecke et al., (2021). performance: An R Package for Assessment, Comparison and Testing of Statistical Models. Journal of Open Source Software, 6(60), 3139. https://doi.org/10.21105/joss.03139
#> report | 0.5.1.2 | Makowski, D., Ben-Shachar, M.S., Patil, I. & Lüdecke, D. (2020). Automated Results Reporting as a Practical Tool to Improve Reproducibility and Methodological Best Practices Adoption. CRAN. Available from https://github.com/easystats/report. doi: .
#> rstanarm | 2.21.3 | Goodrich B, Gabry J, Ali I & Brilleman S. (2022). rstanarm: Bayesian applied regression modeling via Stan. R package version 2.21.3 https://mc-stan.org/rstanarm.
summary(r)
#> Package | Version
#> ---------------------
#> Matrix | 1.4.1
#> R | 4.2.0
#> Rcpp | 1.0.8.3
#> bayestestR | 0.12.1
#> dplyr | 1.0.9
#> lavaan | 0.6.11
#> lme4 | 1.1.29
#> performance | 0.9.1
#> report | 0.5.1.2
#> rstanarm | 2.21.3
# Data
report_table(iris$Sepal.Length)
#> Mean | SD | Median | MAD | Min | Max | n_Obs | Skewness | Kurtosis | percentage_Missing
#> --------------------------------------------------------------------------------------------
#> 5.84 | 0.83 | 5.80 | 1.04 | 4.30 | 7.90 | 150 | 0.31 | -0.55 | 0.00
report_table(as.character(round(iris$Sepal.Length, 1)))
#> n_Entries | n_Obs | n_Missing | percentage_Missing
#> --------------------------------------------------
#> 35.00 | 150 | 0 | 0.00
report_table(iris$Species)
#> Level | n_Obs | percentage_Obs
#> -----------------------------------
#> setosa | 50 | 33.33
#> versicolor | 50 | 33.33
#> virginica | 50 | 33.33
report_table(iris)
#> Variable | Level | n_Obs | percentage_Obs | Mean | SD | Median | MAD | Min | Max | Skewness | Kurtosis | percentage_Missing
#> -----------------------------------------------------------------------------------------------------------------------------------------
#> Sepal.Length | | 150 | | 5.84 | 0.83 | 5.80 | 1.04 | 4.30 | 7.90 | 0.31 | -0.55 | 0.00
#> Sepal.Width | | 150 | | 3.06 | 0.44 | 3.00 | 0.44 | 2.00 | 4.40 | 0.32 | 0.23 | 0.00
#> Petal.Length | | 150 | | 3.76 | 1.77 | 4.35 | 1.85 | 1.00 | 6.90 | -0.27 | -1.40 | 0.00
#> Petal.Width | | 150 | | 1.20 | 0.76 | 1.30 | 1.04 | 0.10 | 2.50 | -0.10 | -1.34 | 0.00
#> Species | setosa | 50 | 33.33 | | | | | | | | |
#> Species | versicolor | 50 | 33.33 | | | | | | | | |
#> Species | virginica | 50 | 33.33 | | | | | | | | |
# h-tests
report_table(t.test(mpg ~ am, data = mtcars))
#> Warning: Unable to retrieve data from htest object. Using t_to_d() approximation.
#> Welch Two Sample t-test
#>
#> Parameter | Group | Mean_Group1 | Mean_Group2 | Difference | 95% CI | t(18.33) | p | d | d CI
#> ------------------------------------------------------------------------------------------------------------------------
#> mpg | am | 17.15 | 24.39 | -7.24 | [-11.28, -3.21] | -3.77 | 0.001 | -1.76 | [-2.82, -0.67]
#>
#> Alternative hypothesis: two.sided
# ANOVAs
report_table(aov(Sepal.Length ~ Species, data = iris))
#> For one-way between subjects designs, partial eta squared is equivalent to eta squared.
#> Returning eta squared.
#> Parameter | Sum_Squares | df | Mean_Square | F | p | Eta2 | Eta2 95% CI
#> -----------------------------------------------------------------------------------
#> Species | 63.21 | 2 | 31.61 | 119.26 | < .001 | 0.62 | [0.54, 1.00]
#> Residuals | 38.96 | 147 | 0.27 | | | |
# GLMs
report_table(lm(Sepal.Length ~ Petal.Length * Species, data = iris))
#> Parameter | Coefficient | 95% CI | t(144) | p | Std. Coef. | Std. Coef. 95% CI | Fit
#> ------------------------------------------------------------------------------------------------------------------------------
#> (Intercept) | 4.21 | [ 3.41, 5.02] | 10.34 | < .001 | 0.49 | [-1.03, 2.01] |
#> Petal Length | 0.54 | [ 0.00, 1.09] | 1.96 | 0.052 | 1.16 | [-0.01, 2.32] |
#> Species [versicolor] | -1.81 | [-2.99, -0.62] | -3.02 | 0.003 | -0.88 | [-2.41, 0.65] |
#> Species [virginica] | -3.15 | [-4.41, -1.90] | -4.97 | < .001 | -1.75 | [-3.32, -0.18] |
#> Petal Length * Species [versicolor] | 0.29 | [-0.30, 0.87] | 0.97 | 0.334 | 0.61 | [-0.63, 1.85] |
#> Petal Length * Species [virginica] | 0.45 | [-0.12, 1.03] | 1.56 | 0.120 | 0.97 | [-0.26, 2.19] |
#> | | | | | | |
#> AIC | | | | | | | 106.77
#> BIC | | | | | | | 127.84
#> R2 | | | | | | | 0.84
#> R2 (adj.) | | | | | | | 0.83
#> Sigma | | | | | | | 0.34
report_table(glm(vs ~ disp, data = mtcars, family = "binomial"))
#> Parameter | Coefficient | 95% CI | z | p | Std. Coef. | Std. Coef. 95% CI | Fit
#> ---------------------------------------------------------------------------------------------------
#> (Intercept) | 4.14 | [ 1.81, 7.44] | 2.98 | 0.003 | -0.85 | [-2.42, 0.27] |
#> disp | -0.02 | [-0.04, -0.01] | -3.03 | 0.002 | -2.68 | [-4.90, -1.27] |
#> | | | | | | |
#> AIC | | | | | | | 26.70
#> BIC | | | | | | | 29.63
#> Tjur's R2 | | | | | | | 0.53
#> Sigma | | | | | | | 0.87
#> Log_loss | | | | | | | 0.35
# Mixed models
if (require("lme4")) {
model <- lme4::lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris)
report_table(model)
}
#> Package 'merDeriv' needs to be installed to compute confidence intervals
#> for random effect parameters.
#> Parameter | Coefficient | 95% CI | t(146) | p | Effects | Group | Std. Coef. | Std. Coef. 95% CI | Fit
#> ------------------------------------------------------------------------------------------------------------------------------
#> (Intercept) | 2.50 | [1.19, 3.82] | 3.75 | < .001 | fixed | | -1.46e-13 | [-1.49, 1.49] |
#> Petal Length | 0.89 | [0.76, 1.01] | 13.93 | < .001 | fixed | | 1.89 | [ 1.63, 2.16] |
#> | 1.08 | | | | random | Species | | |
#> | 0.34 | | | | random | Residual | | |
#> | | | | | | | | |
#> AIC | | | | | | | | | 127.79
#> AICc | | | | | | | | | 128.07
#> BIC | | | | | | | | | 139.84
#> R2 (conditional) | | | | | | | | | 0.97
#> R2 (marginal) | | | | | | | | | 0.66
#> Sigma | | | | | | | | | 0.34
# Bayesian models
if (require("rstanarm")) {
model <- stan_glm(Sepal.Length ~ Species, data = iris, refresh = 0, iter = 600)
report_table(model, effectsize_method = "basic")
}
#> Parameter | Median | 95% CI | pd | % in ROPE | Rhat | ESS | Prior | Std. Median | Std_Median 95% CI | Fit
#> -------------------------------------------------------------------------------------------------------------------------------------------------
#> (Intercept) | 5.00 | [4.86, 5.14] | 100% | 0% | 0.999 | 959.00 | Normal (5.84 +- 2.07) | 0.00 | [0.00, 0.00] |
#> Speciesversicolor | 0.94 | [0.73, 1.14] | 100% | 0% | 0.999 | 877.00 | Normal (0.00 +- 4.38) | 0.53 | [0.42, 0.65] |
#> Speciesvirginica | 1.59 | [1.38, 1.78] | 100% | 0% | 0.998 | 906.00 | Normal (0.00 +- 4.38) | 0.91 | [0.79, 1.02] |
#> | | | | | | | | | |
#> ELPD | | | | | | | | | | -115.95
#> LOOIC | | | | | | | | | | 231.90
#> WAIC | | | | | | | | | | 231.85
#> R2 | | | | | | | | | | 0.62
#> R2 (adj.) | | | | | | | | | | 0.61
#> Sigma | | | | | | | | | | 0.52
# Structural Equation Models (SEM)
if (require("lavaan")) {
structure <- " ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3
dem60 ~ ind60 "
model <- lavaan::sem(structure, data = PoliticalDemocracy)
report_table(model)
}
#> Warning: No column names that matched the required search pattern were found.
#> Parameter | Coefficient | 95% CI | z | p | Component | Fit
#> ----------------------------------------------------------------------------------
#> ind60 =~ x1 | 1.00 | [1.00, 1.00] | | < .001 | Loading |
#> ind60 =~ x2 | 2.18 | [1.91, 2.45] | 15.59 | < .001 | Loading |
#> ind60 =~ x3 | 1.82 | [1.52, 2.12] | 11.96 | < .001 | Loading |
#> dem60 =~ y1 | 1.00 | [1.00, 1.00] | | < .001 | Loading |
#> dem60 =~ y2 | 1.04 | [0.66, 1.43] | 5.33 | < .001 | Loading |
#> dem60 =~ y3 | 0.98 | [0.65, 1.30] | 5.89 | < .001 | Loading |
#> dem60 ~ ind60 | 1.37 | [0.53, 2.21] | 3.20 | 0.001 | Regression |
#> | | | | | |
#> Chi2 | | | | | | 7.98
#> Chi2_df | | | | | | 8.00
#> p_Chi2 | | | | | | 0.44
#> p_Baseline | | | | | | 0.00
#> GFI | | | | | | 0.97
#> AGFI | | | | | | 0.91
#> NFI | | | | | | 0.97
#> NNFI | | | | | | 1.00
#> CFI | | | | | | 1.00
#> RMSEA | | | | | | 0.00
#> RMSEA_CI_low | | | | | | 0.00
#> RMSEA_CI_high | | | | | | 0.14
#> p_RMSEA | | | | | | 0.57
#> RMR | | | | | | 0.10
#> SRMR | | | | | | 0.03
#> RFI | | | | | | 0.95
#> PNFI | | | | | | 0.52
#> IFI | | | | | | 1.00
#> RNI | | | | | | 1.00
#> Loglikelihood | | | | | | -778.27
#> AIC | | | | | | 1582.54
#> BIC | | | | | | 1612.67
#> BIC (adj.) | | | | | | 1571.69
# }