“From R to Manuscript”
report
’s primary goal is to bridge the gap between R’s output and the formatted results contained in your manuscript. It automatically produces reports of models and dataframes according to best practice guidelines (e.g., APA’s style guide), ensuring standardization and quality in results reporting.
## We fitted a linear model to predict Sepal.Length with Species. The model's explanatory power is substantial (R2 = 0.62, adj. R2 = 0.61). The model's intercept is at 5.01. Within this model:
##
## - The effect of Species (versicolor) is positive and can be considered as very large and significant (beta = 0.93, 95% CI [0.73, 1.13], p < .001, std. beta = 1.12).
## - The effect of Species (virginica) is positive and can be considered as very large and significant (beta = 1.58, 95% CI [1.38, 1.79], p < .001, std. beta = 1.91).
The package documentation can be found here. Check-out these tutorials:
report
is a young package in need of affection. You can easily be a part of the developing community of this open-source software and improve science by doing the following:
Don’t be shy, try to code and submit a pull request (See the contributing guide). Even if it’s not perfect, we will help you make it great!
The report
package works in a two step fashion. First, you create a report
object with the report()
function (which takes different arguments depending on the type of object you are reporting). Then, this report object can be displayed either textually, using to_text()
, or as a table, using to_table()
. Moreover, you can access a more detailed (but less digested) version of the report using to_fulltext()
and to_fulltable()
. Finally, to_values()
makes it easy to access all the internals of a model.
Currently supported objects by report include cor.test
, t.test
correlation
, glm
, lme4::merMod
, rstanarm::stanreg
.
The report()
function works on a variety of models, as well as dataframes:
## The data contains 150 observations of the following variables:
## - Sepal.Length: Mean = 5.84, SD = 0.83, [4.30, 7.90].
## - Sepal.Width: Mean = 3.06, SD = 0.44, [2.00, 4.40].
## - Petal.Length: Mean = 3.76, SD = 1.77, [1.00, 6.90].
## - Petal.Width: Mean = 1.20, SD = 0.76, [0.10, 2.50].
## - Species: 3 levels: setosa (n = 50); versicolor (n = 50) and virginica (n = 50).
These reports nicely work within the tidyverse workflow:
## The Pearson's product-moment correlation between iris$Sepal.Length and iris$Petal.Length is positive, significant and large (r = 0.87, p < .001).
You can also create tables with the to_table()
and to_fulltable()
functions:
# Table report for a linear model
lm(Sepal.Length ~ Petal.Length + Species, data=iris) %>%
report() %>%
to_table()
## Parameter | Coefficient | 95% CI | p | Coefficient (std.) | Fit
## -------------------------------------------------------------------------------------
## (Intercept) | 3.68 | [3.47, 3.89] | < .001 | 1.50 |
## Petal.Length | 0.90 | [0.78, 1.03] | < .001 | 1.93 |
## Speciesversicolor | -1.60 | [-1.98, -1.22] | < .001 | -1.93 |
## Speciesvirginica | -2.12 | [-2.66, -1.58] | < .001 | -2.56 |
## | | | | |
## R2 | | | | | 0.84
## R2 (adj.) | | | | | 0.83
Finally, you can also find more details using to_fulltext()
:
# Full report for a Bayesian logistic mixed model with effect sizes
library(rstanarm)
stan_glmer(vs ~ mpg + (1|cyl), data=mtcars, family="binomial") %>%
report(standardize="full", effsize="cohen1988") %>%
to_fulltext()
## We fitted a Bayesian logistic mixed model (estimated using MCMC sampling with 4 chains of 2000
## iterations and a warmup of 1000) to predict vs with mpg (formula = vs ~ mpg). The model included
## cyl as random effects (formula = ~1 | cyl). Priors over parameters were set as normal (mean = 0.00,
## SD = 0.41) distributions. The Region of Practical Equivalence (ROPE) percentage was defined as the
## proportion of the posterior distribution within the [-0.18, 0.18] range. The 89% Credible Intervals
## (CIs) were based on Highest Density Intervals (HDI). Parameters were scaled by the mean and the SD
## of the response variable. Effect sizes were labelled following Cohen's (1988) recommendations.
##
## The model's explanatory power is substantial (R2's median = 0.57, 89% CI [0.42, 0.69] Within this
## model, the explanatory power related to the fixed effects alone (marginal R2's median) is of 0.27
## (89% CI [0.00, 0.48]). The model's intercept, corresponding to vs = 0, mpg = 0 and cyl = 0, is at
## -5.16 (89% CI [-12.09, 2.10], 1.55% in ROPE, std. median = 0.00). Within this model:
##
## - The effect of mpg has a probability of 86.00% of being positive and can be considered as medium
## and not significant (median = 0.23, 89% CI [-0.11, 0.56], 38.10% in ROPE, std. median = 1.41). The
## algorithm successfuly converged (Rhat = 1.001) and the estimates can be considered as stable (ESS =
## 1276).