{"@attributes":{"version":"2.0"},"channel":{"title":"Posts on easystats","link":"https:\/\/easystats.github.io\/blog\/posts\/","description":"Recent content in Posts on easystats","generator":"Hugo -- gohugo.io","language":"en","lastBuildDate":"Thu, 27 Jan 2022 00:00:00 +0000","item":[{"title":"Happy birthday easystats! A retrospective","link":"https:\/\/easystats.github.io\/blog\/posts\/easystats_threeyears\/","pubDate":"Thu, 27 Jan 2022 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/easystats_threeyears\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n\n\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"happy-birthday-easystats\" class=\"section level2\">\n<h2>Happy birthday <em>easystats<\/em>!<\/h2>\n<p>Two years ago, which feels like yesterday, we celebrated the <a href=\"https:\/\/easystats.github.io\/easystats\"><strong>easystats<\/strong><\/a> project\u2019s <a href=\"https:\/\/easystats.github.io\/blog\/posts\/easystats_oneyear\/\">first anniversary<\/a>.<\/p>\n<p>Wow, those were simpler times! One could travel for pleasure, party with dozens of people and have a face-to-face conversation, and the thing that spread like a wildfire around the globe was everyone\u2019s obsession with The Weeknd\u2019s <a href=\"https:\/\/www.youtube.com\/watch?v=4NRXx6U8ABQ\"><em>Blinding Lights<\/em><\/a>!<\/p>\n<p>At any rate, since the pandemic did not affect GitHub in any way, our free and open-source fanatic souls have made sure that this project keeps progressing, sometimes in leaps and bounds, while other times slow as grey clouds in the sky.<\/p>\n<p><strong>What has happened since? A lot!<\/strong><\/p>\n<div id=\"go-forth-and-multiply\" class=\"section level3\">\n<h3>\u201cGo Forth and Multiply\u201d<\/h3>\n<p>The <strong>easystats<\/strong> project has evolved a lot, and currently comprises a whopping 10 packages! These modular packages, each with its own unique purview, connect with each other to form a unifying, consistent, and most importantly, <strong>easy-to-use<\/strong> framework for statistical modeling, visualization, and reporting in the R programming language! \ud83d\udd78\ufe0f<\/p>\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/logo_wall.png\" width=\"70%\" \/><\/p>\n<p>Let\u2019s take a closer look at this structure.<\/p>\n<p>First, at the bottom, we have the foundation packages upon which this whole edifice rests:<\/p>\n<ul>\n<li><p><a href=\"https:\/\/easystats.github.io\/insight\"><strong>insight<\/strong><\/a>: \ud83d\udd2e This dependency-free low-level helper package provides a unified portal to extract information about a wide range of statistical models. If you (as a user or a developer) have ever felt frustrated by the diversity of objects in R and the APIs they provide and how one can create (S3) methods out of this madness, this is just the package for you!<\/p><\/li>\n<li><p><a href=\"https:\/\/easystats.github.io\/datawizard\"><strong>datawizard<\/strong><\/a>: \ud83e\uddd9 The most recent addition to the ecosystem! This package forms the data wrangling backend for the entire ecosystem and can be just what you are looking for if you want to do <em>tidyverse<\/em>-like data wrangling but wish to avoid adding dependencies to your project.<\/p><\/li>\n<\/ul>\n<p>We then have specialized packages to extract additional information from statistical models.<\/p>\n<ul>\n<li><p><a href=\"https:\/\/easystats.github.io\/bayestestR\"><strong>bayestestR<\/strong><\/a>: \ud83d\udc7b A package that provides utility tools for manipulating and visualizing Bayesian statistical models.<\/p><\/li>\n<li><p><a href=\"https:\/\/easystats.github.io\/effectsize\"><strong>effectsize<\/strong><\/a>: \ud83d\udc09 A one-stop solution for computing pretty much every effect size known to mankind, well, almost every. \ud83d\ude05<\/p><\/li>\n<li><p><a href=\"https:\/\/easystats.github.io\/correlation\"><strong>correlation<\/strong><\/a>: \ud83d\udd17 A package dedicated to computing and visualizing probably the most comprehensive suite of correlations.<\/p><\/li>\n<li><p><a href=\"https:\/\/easystats.github.io\/modelbased\"><strong>modelbased<\/strong><\/a>: \ud83d\udcc8 A utility package to work with predictions from statistical models, and can be used to compute and visualize marginal means or contrast analyses.<\/p><\/li>\n<\/ul>\n<p>The information about statistical models are extracted and aggregated by the following two packages:<\/p>\n<ul>\n<li><p><a href=\"https:\/\/easystats.github.io\/performance\"><strong>performance<\/strong><\/a>: \ud83d\udcaa Computes, analyzes, and tests the performance of statistical model(s).<\/p><\/li>\n<li><p><a href=\"https:\/\/easystats.github.io\/parameters\"><strong>parameters<\/strong><\/a>: \ud83d\udcca Extracts a comprehensive dataframe of almost any statistical model\u2019s parameters and provides helpers to present them in elegant tables and plots.<\/p><\/li>\n<\/ul>\n<p>Finally, the two high-level packages utilize all the other packages to communicate results from statistical analyses, either graphically or textually.<\/p>\n<ul>\n<li><p><a href=\"https:\/\/easystats.github.io\/see\"><strong>see<\/strong><\/a>: \ud83c\udfa8 This package forms the visualization backend for the entire ecosystem and interfaces with <em>ggplot2<\/em> to support plotting methods for various <em>easystats<\/em> objects.<\/p><\/li>\n<li><p><a href=\"https:\/\/easystats.github.io\/report\"><strong>report<\/strong><\/a>: \ud83d\udcdc \ud83c\udf89 This package provides an automated way to create text reports detailing results from statistical analyses.<\/p><\/li>\n<\/ul>\n<p>Except for <em>datawizard<\/em>, <em>report<\/em>, and <em>modelbased<\/em> packages, which are still in their teenage years, the rest of the packages are legally permitted to drive your statistical analysis as they have been published in peer-reviewed journals<a href=\"#fn1\" class=\"footnote-ref\" id=\"fnref1\"><sup>1<\/sup><\/a> and enjoy a regular health checkup with a large suite of unit tests.<\/p>\n<\/div>\n<div id=\"soaring-like-an-eagle\" class=\"section level3\">\n<h3>Soaring Like an Eagle!<\/h3>\n<p>To our utmost delight, these packages have already been downloaded in total <strong>over 6 million times<\/strong>! \ud83e\udd2f<\/p>\n<p>It has been an overwhelming experience to see the warm welcome this project has received in the <code>#rstats<\/code> community on <a href=\"https:\/\/twitter.com\/easystats4u\">Twitter<\/a> and LinkedIn.<\/p>\n<\/div>\n<div id=\"brotherly-love-easystats-is-now-used-in-many-packages\" class=\"section level3\">\n<h3>Brotherly love: <em>easystats<\/em> is now used in many packages<\/h3>\n<p>Not only have the packages gained popularity among users, but also fellow R developers have started to rely on <em>easystats<\/em> packages for their own project (e.g., <em>marginaleffects<\/em>, <em>dotwhisker<\/em>, <em>ggstatsplot<\/em>, <em>sjPlot<\/em>, <em>cvms<\/em>, <em>jsmodule<\/em>, <em>neatStats<\/em>, etc.).<\/p>\n<p>We think that other developers may wish to rely on this project for the following (primary) reasons:<\/p>\n<ul>\n<li><p>0 external, non-base-R hard dependencies.<\/p><\/li>\n<li><p>Rapid response from our developer team in fixing bugs or supporting feature requests, sometimes even in a matter of hours (it helps that the team covers a span of 11 time zones!).<\/p><\/li>\n<li><p>Great documentation with plenty of examples and richly detailed tutorials.<\/p><\/li>\n<li><p>A diverse developer team of statisticians, researchers, and software engineers that pay attention to the holistic development of the packages.<\/p><\/li>\n<\/ul>\n<p>So in case you have been in two minds thus far about whether you want to use these packages in your own package development, we would highly recommend that you get in touch and communicate your concerns with us. We will do our best to assuage them. \ud83e\udd17<\/p>\n<\/div>\n<div id=\"things-we-learned\" class=\"section level3\">\n<h3>Things we learned<\/h3>\n<ul>\n<li><p>We choose to believe that <strong>easystats<\/strong> is a rags-to-riches story. An open-science project, conceived by early career researchers, born and nursed in the academic environment with neither funding nor part of anyone\u2019s research program, and with no direct obligation or pressure to work on it, now has a global community of many thousands of users. They say necessity is the mother of invention, and boy we have tried to be inventive in terms of managing our resources to push out high-quality software in a quick period with $0 in funding. Even if we get any funding someday, we will carry these hard-earned lessons with us. \ud83d\udcaa<\/p><\/li>\n<li><p>All of us contribute to this project in our free time and have surprisingly never met each other (yet \ud83e\udd1e). This has also taught us the value, fruitfulness, and the sheer joy of online global collaboration, although we are well aware that all of us live in developed countries and enjoy the privilege of good internet connectivity.<\/p><\/li>\n<li><p>Another thing we learned is that our laptops look prettier with <em>easystats<\/em> package stickers. \ud83d\ude0a<\/p><\/li>\n<\/ul>\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/stickers.jpg\" \/><!-- --><\/p>\n<p>If you also want to make your laptops prettier, <a href=\"https:\/\/twitter.com\/easystats4u\/status\/1461674060283269123?s=20\">get in touch<\/a>!<\/p>\n<\/div>\n<div id=\"future-plans\" class=\"section level3\">\n<h3>Future plans<\/h3>\n<p>This project is now approaching a stage where we can start thinking about finally publishing the meta-package <em>easystats<\/em> on CRAN, which will give users a single entry point to access the entire ecosystem\u2019s functionality. This also means you won\u2019t have to update several packages every morning to get the ecosystem working, woohoo!<\/p>\n<p>Afterwards, we will be ready to release the first stable version (<code>1.0<\/code>) of most - if not all - of our packages. This means that there will be less focus on actively adding new features (or making breaking changes) and concentrating more on the dissemination - and training - of the existing functionality (If your institution or local group of R users are interested in hearing more about these packages, please let us know. We will be happy to organize workshops and give talks!).<\/p>\n<p>We are also considering the possibility of writing a book to give a more comprehensive and cohesive account of the project. As detailed as our package websites are and as succinct as the individual journal publications for packages are, none of them yet clearly illustrate end-to-end use of <em>easystats<\/em> project in a statistical analysis project. That\u2019s a longer-term goal, which requires time and support. Again, we welcome all good souls to contact us if they\u2019re interested in contributing.<\/p>\n<\/div>\n<div id=\"acknowledgments\" class=\"section level3\">\n<h3>Acknowledgments<\/h3>\n<p>Last but not the least, we want to finish this post by thanking <strong>you, the <em>easystats<\/em> user<\/strong>, for encouraging us to continue to pursue our passion project. We couldn\u2019t have done this without your constant feedback and love. Cheers!<\/p>\n<p><em>And if you\u2019re not yet a user or a contributor, what are you waiting for?!<\/em><\/p>\n<\/div>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>Note that <em>easystats<\/em> is a project under active development, and is always on the lookout for new contributors. Thus, do not hesitate to <a href=\"https:\/\/twitter.com\/easystats4u\">contact us<\/a> if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-updated\" class=\"section level2\">\n<h2>Stay updated<\/h2>\n<p>To keep yourself apprised of the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <em>easystats<\/em> team on Twitter:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/bwiernik\">@bmwiernik<\/a><\/li>\n<\/ul>\n<\/div>\n<div class=\"footnotes footnotes-end-of-document\">\n<hr \/>\n<ol>\n<li id=\"fn1\"><p>You can use <code>citation()<\/code> function to see reference for each package.<a href=\"#fnref1\" class=\"footnote-back\">\u21a9\ufe0e<\/a><\/p><\/li>\n<\/ol>\n<\/div>\n"},{"title":"You write R packages and functions? This package will change your life!","link":"https:\/\/easystats.github.io\/blog\/posts\/insight_whyshouldyou\/","pubDate":"Mon, 01 Feb 2021 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/insight_whyshouldyou\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/insight\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"what-is-it\" class=\"section level2\">\n<h2>What is it?<\/h2>\n<p>We are talking about the <a href=\"https:\/\/github.com\/easystats\/insight\"><strong>insight package<\/strong><\/a>. It is what allows other packages, like <strong>easystats<\/strong> (<a href=\"https:\/\/github.com\/easystats\/parameters\">parameters<\/a>, <a href=\"https:\/\/github.com\/easystats\/effectsize\">effectsize<\/a>, <a href=\"https:\/\/github.com\/easystats\/performance\">performance<\/a>, <a href=\"https:\/\/github.com\/easystats\/report\">report<\/a>, \u2026) or <a href=\"https:\/\/github.com\/IndrajeetPatil\/ggstatsplot\"><strong>ggstatsplot<\/strong><\/a>, <a href=\"https:\/\/github.com\/strengejacke\/sjstats\/\"><strong>sjstats<\/strong><\/a> or <a href=\"https:\/\/github.com\/vincentarelbundock\/modelsummary\"><strong>modelsummary<\/strong><\/a> to be as powerful as they are, supporting tons of different R models. So why make you life hard when you can be like them, and rely on <strong>insight<\/strong>?<\/p>\n<p>It is made for developers (and users) that do some <strong>postprocessing<\/strong> of different models (e.g., extracting stuff like parameters, values, data, names, specifications, predictions, priors, etc.), whether it is to nicely display their results or to do further computation.<\/p>\n<p>If you work with, and around, different R models, then <strong>this package is a must-have that will change your life<\/strong>.<\/p>\n<\/div>\n<div id=\"whats-the-problem\" class=\"section level2\">\n<h2>What\u2019s the problem<\/h2>\n<p>Because R has so many different packages, different models were implemented by different people in a different way. As a consequence, there are different ways of accessing the same stuff from each model.<\/p>\n<p>For example, let\u2019s say you want to find the <strong>names of the predictors<\/strong> (the independent variables) of a linear model. One way would be like this:<\/p>\n<pre class=\"r\"><code>model_lm &lt;- lm(mpg ~ drat * wt, data=mtcars)\n\nnames(model_lm$model)[-1]<\/code><\/pre>\n<pre><code>## [1] &quot;drat&quot; &quot;wt&quot;<\/code><\/pre>\n<p>But what in the case of a lme4\u2019s mixed model? Well the solution is a bit different, plus it\u2019s not easy to drop the random factors\u2026<\/p>\n<pre class=\"r\"><code>model_lmer &lt;- lme4::lmer(mpg ~ drat * wt + (1|cyl), data=mtcars)\n\nnames(model_lmer@frame)[-1]<\/code><\/pre>\n<pre><code>## [1] &quot;drat&quot; &quot;wt&quot;   &quot;cyl&quot;<\/code><\/pre>\n<p>And what in the case of a GAMM4\u2019s general additive model?<\/p>\n<pre class=\"r\"><code>model_gam &lt;- gamm4::gamm4(mpg ~ drat + wt + s(qsec), data=mtcars)\n\nhead(names(model_gam$gam$model)[-1], -3)<\/code><\/pre>\n<pre><code>## [1] &quot;drat&quot; &quot;wt&quot;   &quot;qsec&quot;<\/code><\/pre>\n<p>Again different! Maybe you could do something like that, but then you have to account for <strong>all the edgecases<\/strong> and so on. And trust us, <strong>that\u2019s a lot of work<\/strong> to have a robust and bug-free solution.<\/p>\n<\/div>\n<div id=\"how-insight-addresses-it\" class=\"section level2\">\n<h2>How \u2018insight\u2019 addresses it<\/h2>\n<p><strong>insight<\/strong> allows you to extract stuff from all models in a consistent and robust way. For instance, for the fixed predictors of the examples above, here\u2019s how you would do it with insight:<\/p>\n<pre class=\"r\"><code>library(insight)\n\nfind_predictors(model_lm)<\/code><\/pre>\n<pre><code>## $conditional\n## [1] &quot;drat&quot; &quot;wt&quot;<\/code><\/pre>\n<pre class=\"r\"><code>find_predictors(model_lmer)<\/code><\/pre>\n<pre><code>## $conditional\n## [1] &quot;drat&quot; &quot;wt&quot;<\/code><\/pre>\n<pre class=\"r\"><code>find_predictors(model_gam)<\/code><\/pre>\n<pre><code>## $conditional\n## [1] &quot;drat&quot; &quot;wt&quot;   &quot;qsec&quot;<\/code><\/pre>\n<p><strong>Boom!<\/strong> One function that works for all the models. And that\u2019s not all, <strong>insight<\/strong> can help you extract data, parameters, intercepts, degrees of freedom, sigma, variance, predicted values, variable names, interaction terms, random factors, smooth terms, etc. etc. Basically, everything you might need. And if what you need is not there, just <a href=\"https:\/\/github.com\/easystats\/insight\/issues\"><strong>ask for it<\/strong><\/a>.<\/p>\n<p>You can check all that <strong>insight<\/strong> can do <a href=\"https:\/\/easystats.github.io\/insight\/reference\/index.html\"><strong>here<\/strong><\/a>.<\/p>\n<\/div>\n<div id=\"more-reasons-to-use-it\" class=\"section level2\">\n<h2>More reasons to use it<\/h2>\n<p>If you\u2019re worried about adding a new dependency to your package, don\u2019t be! Because <strong>insight<\/strong> is super light: it itself has <strong>no dependencies<\/strong>. So it\u2019s a safe choice to add and rely on!<\/p>\n<p>It includes other useful <strong>features that you don\u2019t know you absolutely need<\/strong>, like value formatting, nice printing of text, table and data.frames exporting and much more! Check out them <a href=\"https:\/\/easystats.github.io\/insight\/reference\/index.html\"><strong>here<\/strong><\/a>.<\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p><em>easystats<\/em> is a project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/LDtrx\">@LeoDutriaux<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"New formatting features in the parameters package","link":"https:\/\/easystats.github.io\/blog\/posts\/parameters_new_models\/","pubDate":"Thu, 21 Jan 2021 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/parameters_new_models\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>You probably already have heard of the <a href=\"https:\/\/easystats.github.io\/parameters\/\"><em>parameters<\/em> package<\/a>, a light-weight package to <strong>extract, compute and explore the parameters of statistical models<\/strong> using R (if not, there is a related <a href=\"https:\/\/joss.theoj.org\/papers\/10.21105\/joss.02445\">publication<\/a> introducing the package\u2019s main features).<\/p>\n<p>In this post, we like to introduce a new feature that facilitates nicely rendered output in <strong>markdown<\/strong> or <strong>HTML<\/strong> format (including <strong>PDFs<\/strong>). This allows you to easily create pretty tables of model summaries, for a large variety of models.<\/p>\n<p>The <em>parameters<\/em> package, together with the <a href=\"https:\/\/easystats.github.io\/insight\/\"><em>insight<\/em> package<\/a>, provides those tools to format the layout and style of tables from model parameters. The easy way is using the <code>model_parameters()<\/code> function, where usually don\u2019t have to take care about formatting and layout, at least not for simple purposes like printing to the console or inside rmarkdown documents. However, sometimes you may want to do the formatting steps manually. This blog post introduces the various functions that are used for parameters table formatting.<\/p>\n<div id=\"an-example-model\" class=\"section level2\">\n<h2>An Example Model<\/h2>\n<p>We start with a model that does not make much sense, but it is useful for demonstrating the formatting functions.<\/p>\n<pre class=\"r\"><code>data(iris)\niris$Petlen &lt;- cut(iris$Petal.Length, breaks = c(0, 3, 7))\nmodel &lt;- lm(Sepal.Width ~ poly(Sepal.Length, 2) + Species + Petlen, data = iris)\n\nsummary(model)<\/code><\/pre>\n<pre><code>## \n## Call:\n## lm(formula = Sepal.Width ~ poly(Sepal.Length, 2) + Species + \n##     Petlen, data = iris)\n## \n## Residuals:\n##     Min      1Q  Median      3Q     Max \n## -0.7742 -0.1490 -0.0056  0.1666  0.6973 \n## \n## Coefficients:\n##                        Estimate Std. Error t value Pr(&gt;|t|)    \n## (Intercept)              3.8127     0.0582   65.50  &lt; 2e-16 ***\n## poly(Sepal.Length, 2)1   4.0602     0.4668    8.70    7e-15 ***\n## poly(Sepal.Length, 2)2  -1.3024     0.3149   -4.14    6e-05 ***\n## Speciesversicolor       -1.0056     0.2781   -3.62  0.00041 ***\n## Speciesvirginica        -0.9913     0.2851   -3.48  0.00067 ***\n## Petlen(3,7]             -0.1360     0.2818   -0.48  0.63019    \n## ---\n## Signif. codes:  0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1\n## \n## Residual standard error: 0.28 on 144 degrees of freedom\n## Multiple R-squared:  0.615,  Adjusted R-squared:  0.602 \n## F-statistic:   46 on 5 and 144 DF,  p-value: &lt;2e-16<\/code><\/pre>\n<\/div>\n<div id=\"formatting-parameter-names\" class=\"section level2\">\n<h2>Formatting Parameter Names<\/h2>\n<p>As we can see, in such cases, the standard R output looks a bit cryptic, although all necessary and important information is included in the summary. The formatting of coefficients for polynomial transformation is difficult to read, factors grouped with <code>cut()<\/code> always require a short time of thinking to find out which of the bound (in this case, <code>Petlen(3,7]<\/code>, 3 and 7) is included in the range, and names of factor levels are directly concatenated to the name of the factor variable.<\/p>\n<p>Thus, the first step would be to format the parameter names, which can be done with <code>format_parameters()<\/code> from the <em>parameters<\/em> package:<\/p>\n<pre class=\"r\"><code>library(parameters)\nformat_parameters(model)<\/code><\/pre>\n<pre><code>##                 (Intercept)      poly(Sepal.Length, 2)1 \n##               &quot;(Intercept)&quot; &quot;Sepal.Length [1st degree]&quot; \n##      poly(Sepal.Length, 2)2           Speciesversicolor \n## &quot;Sepal.Length [2nd degree]&quot;      &quot;Species [versicolor]&quot; \n##            Speciesvirginica                 Petlen(3,7] \n##       &quot;Species [virginica]&quot;              &quot;Petlen [4-7]&quot;<\/code><\/pre>\n<p><code>format_parameters()<\/code> returns a (named) character vector with the original coefficients as <em>names<\/em> of each character element, and the formatted names of the coefficients as values of the character vector. Let\u2019s look at the results again:<\/p>\n<pre class=\"r\"><code>cat(format_parameters(model), sep = &quot;\\n&quot;)<\/code><\/pre>\n<pre><code>## (Intercept)\n## Sepal.Length [1st degree]\n## Sepal.Length [2nd degree]\n## Species [versicolor]\n## Species [virginica]\n## Petlen [4-7]<\/code><\/pre>\n<p>Now variable names and factor levels, but also polynomial terms or even factors grouped with <code>cut()<\/code> are much more readable. Factor levels are separated from the variable name, inside brackets. Same for the coefficients of the different polynomial degrees. And the exact range for <code>cut()<\/code>-factors is also clearer now.<\/p>\n<\/div>\n<div id=\"standardizing-column-names-of-parameter-tables\" class=\"section level2\">\n<h2>Standardizing Column Names of Parameter Tables<\/h2>\n<p>As seen above, the <code>summary()<\/code> returns columns named <code>Estimate<\/code>, <code>t value<\/code> or <code>Pr(&gt;|t|)<\/code>. While <code>Estimate<\/code> is not specific for certain models, <code>t value<\/code> is. For logistic regression models, you would get <code>z value<\/code>. Some packages alter the names, so you get just <code>t<\/code> or <code>t-value<\/code> etc.<\/p>\n<p><code>model_parameters()<\/code> also uses context-specific column names, where applicable:<\/p>\n<pre class=\"r\"><code>colnames(model_parameters(model))<\/code><\/pre>\n<pre><code>## [1] &quot;Parameter&quot;   &quot;Coefficient&quot; &quot;SE&quot;          &quot;CI_low&quot;      &quot;CI_high&quot;    \n## [6] &quot;t&quot;           &quot;df_error&quot;    &quot;p&quot;<\/code><\/pre>\n<p>For Bayesian models, <code>Coefficient<\/code> is usually named <code>Median<\/code> etc. While this makes sense from a user perspective, because you instantly know which type of statistic or coefficient you have, it becomes difficult when you need a generic naming scheme to access model parameters when the input model is unknown. This is the typical approach from the <em>broom<\/em> package, where you get \u201cstandardized\u201d column names:<\/p>\n<pre class=\"r\"><code>library(broom)\ncolnames(tidy(model))<\/code><\/pre>\n<pre><code>## [1] &quot;term&quot;      &quot;estimate&quot;  &quot;std.error&quot; &quot;statistic&quot; &quot;p.value&quot;<\/code><\/pre>\n<p>To deal with such situations, the <em>insight<\/em> package provides a <code>standardize_names()<\/code> function, which exactly does that: standardizing the column names of the input. In the following example, you see that the statistic-column is no longer named <code>t<\/code>, but <code>statistic<\/code>. <code>df_error<\/code> or <code>df_residuals<\/code> will be renamed to <code>df<\/code>.<\/p>\n<pre class=\"r\"><code>library(insight)\nlibrary(magrittr)\nmodel %&gt;% \n  model_parameters() %&gt;% \n  standardize_names() %&gt;% \n  colnames()<\/code><\/pre>\n<pre><code>## [1] &quot;Parameter&quot;   &quot;Coefficient&quot; &quot;SE&quot;          &quot;CI_low&quot;      &quot;CI_high&quot;    \n## [6] &quot;Statistic&quot;   &quot;df&quot;          &quot;p&quot;<\/code><\/pre>\n<p>Furthermore, you can request \u201cbroom\u201d-style for column names:<\/p>\n<pre class=\"r\"><code>model %&gt;% \n  model_parameters() %&gt;% \n  standardize_names(style = &quot;broom&quot;) %&gt;% \n  colnames()<\/code><\/pre>\n<pre><code>## [1] &quot;term&quot;      &quot;estimate&quot;  &quot;std.error&quot; &quot;conf.low&quot;  &quot;conf.high&quot; &quot;statistic&quot;\n## [7] &quot;df.error&quot;  &quot;p.value&quot;<\/code><\/pre>\n<\/div>\n<div id=\"formatting-column-names-and-columns\" class=\"section level2\">\n<h2>Formatting Column Names and Columns<\/h2>\n<p>Beside formatting parameter names (coefficient names) using <code>format_parameters()<\/code>, we can do even more to make the output more readable. Let\u2019s look at an example that includes confidence intervals.<\/p>\n<pre class=\"r\"><code>cbind(summary(model)$coefficients, confint(model))<\/code><\/pre>\n<pre><code>##                        Estimate Std. Error t value Pr(&gt;|t|) 2.5 % 97.5 %\n## (Intercept)                3.81      0.058   65.50 4.6e-109  3.70   3.93\n## poly(Sepal.Length, 2)1     4.06      0.467    8.70  7.0e-15  3.14   4.98\n## poly(Sepal.Length, 2)2    -1.30      0.315   -4.14  6.0e-05 -1.92  -0.68\n## Speciesversicolor         -1.01      0.278   -3.62  4.1e-04 -1.56  -0.46\n## Speciesvirginica          -0.99      0.285   -3.48  6.7e-04 -1.55  -0.43\n## Petlen(3,7]               -0.14      0.282   -0.48  6.3e-01 -0.69   0.42<\/code><\/pre>\n<p>We can get a similar tabular output using <em>broom<\/em>.<\/p>\n<pre class=\"r\"><code>tidy(model, conf.int = TRUE)<\/code><\/pre>\n<pre><code>## # A tibble: 6 x 7\n##   term                 estimate std.error statistic   p.value conf.low conf.high\n##   &lt;chr&gt;                   &lt;dbl&gt;     &lt;dbl&gt;     &lt;dbl&gt;     &lt;dbl&gt;    &lt;dbl&gt;     &lt;dbl&gt;\n## 1 (Intercept)             3.81     0.0582    65.5   4.61e-109    3.70      3.93 \n## 2 poly(Sepal.Length, ~    4.06     0.467      8.70  7.00e- 15    3.14      4.98 \n## 3 poly(Sepal.Length, ~   -1.30     0.315     -4.14  5.98e-  5   -1.92     -0.680\n## 4 Speciesversicolor      -1.01     0.278     -3.62  4.12e-  4   -1.56     -0.456\n## 5 Speciesvirginica       -0.991    0.285     -3.48  6.72e-  4   -1.55     -0.428\n## 6 Petlen(3,7]            -0.136    0.282     -0.482 6.30e-  1   -0.693     0.421<\/code><\/pre>\n<p>Some improvements according to readability could be collapsing and formatting the confidence intervals, and maybe the p-values. This would require some effort, for instance, to format the values of the lower and upper confidence intervals and collapsing them into one column. However, the <code>format_table()<\/code> function is a convenient function that does all the work for you.<\/p>\n<p><code>format_table()<\/code> requires a data frame with model parameters as input, however, there are some requirements to make <code>format_table()<\/code> work. In particular, the column names must follow a certain pattern to be recognized, and this pattern may either be the naming convention from <em>broom<\/em> or the <a href=\"https:\/\/easystats.github.io\/easystats\/\"><em>easystats<\/em> packages<\/a>.<\/p>\n<pre class=\"r\"><code>model %&gt;% \n  tidy(conf.int = TRUE) %&gt;% \n  format_table()<\/code><\/pre>\n<pre><code>##                     term estimate std.error statistic p.value       conf.int\n## 1            (Intercept)     3.81      0.06     65.50  &lt; .001 [ 3.70,  3.93]\n## 2 poly(Sepal.Length, 2)1     4.06      0.47      8.70  &lt; .001 [ 3.14,  4.98]\n## 3 poly(Sepal.Length, 2)2    -1.30      0.31     -4.14  &lt; .001 [-1.92, -0.68]\n## 4      Speciesversicolor    -1.01      0.28     -3.62  &lt; .001 [-1.56, -0.46]\n## 5       Speciesvirginica    -0.99      0.29     -3.48  &lt; .001 [-1.55, -0.43]\n## 6            Petlen(3,7]    -0.14      0.28     -0.48  0.630  [-0.69,  0.42]<\/code><\/pre>\n<p>When the parameters table also includes degrees of freedom, and the degrees of freedom are the same for each parameter, then this information is included in the statistic-column. This is usually the default for <code>model_parameters()<\/code>:<\/p>\n<pre class=\"r\"><code>model %&gt;% \n  model_parameters() %&gt;% \n  format_table()<\/code><\/pre>\n<pre><code>##                   Parameter Coefficient   SE         95% CI t(144)      p\n## 1               (Intercept)        3.81 0.06 [ 3.70,  3.93]  65.50 &lt; .001\n## 2 Sepal.Length [1st degree]        4.06 0.47 [ 3.14,  4.98]   8.70 &lt; .001\n## 3 Sepal.Length [2nd degree]       -1.30 0.31 [-1.92, -0.68]  -4.14 &lt; .001\n## 4      Species [versicolor]       -1.01 0.28 [-1.56, -0.46]  -3.62 &lt; .001\n## 5       Species [virginica]       -0.99 0.29 [-1.55, -0.43]  -3.48 &lt; .001\n## 6              Petlen [4-7]       -0.14 0.28 [-0.69,  0.42]  -0.48 0.630<\/code><\/pre>\n<\/div>\n<div id=\"exporting-the-parameters-table\" class=\"section level2\">\n<h2>Exporting the Parameters Table<\/h2>\n<p>Finally, <code>export_table()<\/code> from <em>insight<\/em> formats the data frame and returns a character vector that can be printed to the console or inside rmarkdown documents. The data frame then looks more \u201ctable-like\u201d.<\/p>\n<pre class=\"r\"><code>data(mtcars)\ncat(export_table(mtcars[1:8, 1:5]))<\/code><\/pre>\n<pre><code>##   mpg | cyl |   disp |  hp | drat\n## ---------------------------------\n## 21.00 |   6 | 160.00 | 110 | 3.90\n## 21.00 |   6 | 160.00 | 110 | 3.90\n## 22.80 |   4 | 108.00 |  93 | 3.85\n## 21.40 |   6 | 258.00 | 110 | 3.08\n## 18.70 |   8 | 360.00 | 175 | 3.15\n## 18.10 |   6 | 225.00 | 105 | 2.76\n## 14.30 |   8 | 360.00 | 245 | 3.21\n## 24.40 |   4 | 146.70 |  62 | 3.69<\/code><\/pre>\n<p>Putting all this together allows us to create nice tabular outputs of parameters tables. This can be done using <em>broom<\/em>:<\/p>\n<pre class=\"r\"><code>model %&gt;% \n  tidy(conf.int = TRUE) %&gt;% \n  format_table() %&gt;% \n  export_table() %&gt;% \n  cat()<\/code><\/pre>\n<pre><code>## term                   | estimate | std.error | statistic | p.value |       conf.int\n## ------------------------------------------------------------------------------------\n## (Intercept)            |     3.81 |      0.06 |     65.50 |  &lt; .001 | [ 3.70,  3.93]\n## poly(Sepal.Length, 2)1 |     4.06 |      0.47 |      8.70 |  &lt; .001 | [ 3.14,  4.98]\n## poly(Sepal.Length, 2)2 |    -1.30 |      0.31 |     -4.14 |  &lt; .001 | [-1.92, -0.68]\n## Speciesversicolor      |    -1.01 |      0.28 |     -3.62 |  &lt; .001 | [-1.56, -0.46]\n## Speciesvirginica       |    -0.99 |      0.29 |     -3.48 |  &lt; .001 | [-1.55, -0.43]\n## Petlen(3,7]            |    -0.14 |      0.28 |     -0.48 |  0.630  | [-0.69,  0.42]<\/code><\/pre>\n<p>Or, in a simpler way and with much more options (like standardizing, robust standard errors, bootstrapping, \u2026) using <code>model_parameters()<\/code>, which <code>print()<\/code>-method does all these steps automatically:<\/p>\n<pre class=\"r\"><code>model_parameters(model)<\/code><\/pre>\n<pre><code>## Parameter                 | Coefficient |   SE |         95% CI | t(144) |      p\n## ---------------------------------------------------------------------------------\n## (Intercept)               |        3.81 | 0.06 | [ 3.70,  3.93] |  65.50 | &lt; .001\n## Sepal.Length [1st degree] |        4.06 | 0.47 | [ 3.14,  4.98] |   8.70 | &lt; .001\n## Sepal.Length [2nd degree] |       -1.30 | 0.31 | [-1.92, -0.68] |  -4.14 | &lt; .001\n## Species [versicolor]      |       -1.01 | 0.28 | [-1.56, -0.46] |  -3.62 | &lt; .001\n## Species [virginica]       |       -0.99 | 0.29 | [-1.55, -0.43] |  -3.48 | &lt; .001\n## Petlen [4-7]              |       -0.14 | 0.28 | [-0.69,  0.42] |  -0.48 | 0.630<\/code><\/pre>\n<\/div>\n<div id=\"formatting-the-parameters-table-in-markdown\" class=\"section level2\">\n<h2>Formatting the Parameters Table in Markdown<\/h2>\n<p><code>export_table()<\/code> provides a few options to generate tables in markdown-format. This allows to easily render nice-looking tables inside markdown-documents. First of all, use <code>format = \"markdown\"<\/code> to activate the markdown-formatting. <code>caption<\/code> can be used to add a table caption. Furthermore, <code>align<\/code> allows to choose an alignment for all table columns, or to specify the alignment for each column individually.<\/p>\n<p>The following table has six columns. Using <code>align = \"lcccrr\"<\/code> would left-align the first column, center columns two to four, and right-align the last two columns.<\/p>\n<pre class=\"r\"><code>model %&gt;% \n  tidy(conf.int = TRUE) %&gt;% \n  # parenthesis look better in markdown-tables, so we use &quot;brackets&quot; here\n  format_table(ci_brackets = c(&quot;(&quot;, &quot;)&quot;)) %&gt;% \n  export_table(format = &quot;markdown&quot;, caption = &quot;My Table&quot;, align = &quot;lcccrr&quot;)<\/code><\/pre>\n<table>\n<caption>My Table<\/caption>\n<thead>\n<tr class=\"header\">\n<th align=\"left\">term<\/th>\n<th align=\"center\">estimate<\/th>\n<th align=\"center\">std.error<\/th>\n<th align=\"center\">statistic<\/th>\n<th align=\"right\">p.value<\/th>\n<th align=\"right\">conf.int<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"odd\">\n<td align=\"left\">(Intercept)<\/td>\n<td align=\"center\">3.81<\/td>\n<td align=\"center\">0.06<\/td>\n<td align=\"center\">65.50<\/td>\n<td align=\"right\">&lt; .001<\/td>\n<td align=\"right\">( 3.70, 3.93)<\/td>\n<\/tr>\n<tr class=\"even\">\n<td align=\"left\">poly(Sepal.Length, 2)1<\/td>\n<td align=\"center\">4.06<\/td>\n<td align=\"center\">0.47<\/td>\n<td align=\"center\">8.70<\/td>\n<td align=\"right\">&lt; .001<\/td>\n<td align=\"right\">( 3.14, 4.98)<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td align=\"left\">poly(Sepal.Length, 2)2<\/td>\n<td align=\"center\">-1.30<\/td>\n<td align=\"center\">0.31<\/td>\n<td align=\"center\">-4.14<\/td>\n<td align=\"right\">&lt; .001<\/td>\n<td align=\"right\">(-1.92, -0.68)<\/td>\n<\/tr>\n<tr class=\"even\">\n<td align=\"left\">Speciesversicolor<\/td>\n<td align=\"center\">-1.01<\/td>\n<td align=\"center\">0.28<\/td>\n<td align=\"center\">-3.62<\/td>\n<td align=\"right\">&lt; .001<\/td>\n<td align=\"right\">(-1.56, -0.46)<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td align=\"left\">Speciesvirginica<\/td>\n<td align=\"center\">-0.99<\/td>\n<td align=\"center\">0.29<\/td>\n<td align=\"center\">-3.48<\/td>\n<td align=\"right\">&lt; .001<\/td>\n<td align=\"right\">(-1.55, -0.43)<\/td>\n<\/tr>\n<tr class=\"even\">\n<td align=\"left\">Petlen(3,7]<\/td>\n<td align=\"center\">-0.14<\/td>\n<td align=\"center\">0.28<\/td>\n<td align=\"center\">-0.48<\/td>\n<td align=\"right\">0.630<\/td>\n<td align=\"right\">(-0.69, 0.42)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code>print_md()<\/code> is a convenient wrapper around <code>format_table()<\/code> and <code>export_table(format = \"markdown\")<\/code>, and allows to directly format the output of functions like <code>model_parameters()<\/code>, <code>simulate_parameters()<\/code> or other <em>parameters<\/em> functions in markdown-format.<\/p>\n<p>These tables are also nicely formatted when knitting markdown-documents into Word or PDF. <code>print_md()<\/code> applies some default settings that have proven to work well for markdown, PDF or Word tables.<\/p>\n<pre class=\"r\"><code>model_parameters(model) %&gt;% print_md()<\/code><\/pre>\n<table>\n<thead>\n<tr class=\"header\">\n<th align=\"left\">Parameter<\/th>\n<th align=\"center\">Coefficient<\/th>\n<th align=\"center\">SE<\/th>\n<th align=\"center\">95% CI<\/th>\n<th align=\"center\">t(144)<\/th>\n<th align=\"center\">p<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"odd\">\n<td align=\"left\">(Intercept)<\/td>\n<td align=\"center\">3.81<\/td>\n<td align=\"center\">0.06<\/td>\n<td align=\"center\">(3.70, 3.93)<\/td>\n<td align=\"center\">65.50<\/td>\n<td align=\"center\">&lt; .001<\/td>\n<\/tr>\n<tr class=\"even\">\n<td align=\"left\">Sepal.Length (1st degree)<\/td>\n<td align=\"center\">4.06<\/td>\n<td align=\"center\">0.47<\/td>\n<td align=\"center\">(3.14, 4.98)<\/td>\n<td align=\"center\">8.70<\/td>\n<td align=\"center\">&lt; .001<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td align=\"left\">Sepal.Length (2nd degree)<\/td>\n<td align=\"center\">-1.30<\/td>\n<td align=\"center\">0.31<\/td>\n<td align=\"center\">(-1.92, -0.68)<\/td>\n<td align=\"center\">-4.14<\/td>\n<td align=\"center\">&lt; .001<\/td>\n<\/tr>\n<tr class=\"even\">\n<td align=\"left\">Species (versicolor)<\/td>\n<td align=\"center\">-1.01<\/td>\n<td align=\"center\">0.28<\/td>\n<td align=\"center\">(-1.56, -0.46)<\/td>\n<td align=\"center\">-3.62<\/td>\n<td align=\"center\">&lt; .001<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td align=\"left\">Species (virginica)<\/td>\n<td align=\"center\">-0.99<\/td>\n<td align=\"center\">0.29<\/td>\n<td align=\"center\">(-1.55, -0.43)<\/td>\n<td align=\"center\">-3.48<\/td>\n<td align=\"center\">&lt; .001<\/td>\n<\/tr>\n<tr class=\"even\">\n<td align=\"left\">Petlen (4-7)<\/td>\n<td align=\"center\">-0.14<\/td>\n<td align=\"center\">0.28<\/td>\n<td align=\"center\">(-0.69, 0.42)<\/td>\n<td align=\"center\">-0.48<\/td>\n<td align=\"center\">0.630<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>A similar option is <code>print_html()<\/code>, which is a convenient wrapper for <code>format_table()<\/code> and <code>export_table(format = \"html\")<\/code>. Using HTML in markdown has the advantage that it will be properly rendered when exporting to PDF.<\/p>\n<pre class=\"r\"><code>model_parameters(model) %&gt;% print_html()<\/code><\/pre>\n<style>html {\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;\n}\n\n#bnpcayxojb .gt_table {\n  display: table;\n  border-collapse: collapse;\n  margin-left: auto;\n  margin-right: auto;\n  color: #333333;\n  font-size: 16px;\n  font-weight: normal;\n  font-style: normal;\n  background-color: #FFFFFF;\n  width: auto;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #A8A8A8;\n  border-right-style: none;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #A8A8A8;\n  border-left-style: none;\n  border-left-width: 2px;\n  border-left-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_heading {\n  background-color: #FFFFFF;\n  text-align: center;\n  border-bottom-color: #FFFFFF;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_title {\n  color: #333333;\n  font-size: 125%;\n  font-weight: initial;\n  padding-top: 4px;\n  padding-bottom: 4px;\n  border-bottom-color: #FFFFFF;\n  border-bottom-width: 0;\n}\n\n#bnpcayxojb .gt_subtitle {\n  color: #333333;\n  font-size: 85%;\n  font-weight: initial;\n  padding-top: 0;\n  padding-bottom: 4px;\n  border-top-color: #FFFFFF;\n  border-top-width: 0;\n}\n\n#bnpcayxojb .gt_bottom_border {\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_col_headings {\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_col_heading {\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: normal;\n  text-transform: inherit;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n  vertical-align: bottom;\n  padding-top: 5px;\n  padding-bottom: 6px;\n  padding-left: 5px;\n  padding-right: 5px;\n  overflow-x: hidden;\n}\n\n#bnpcayxojb .gt_column_spanner_outer {\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: normal;\n  text-transform: inherit;\n  padding-top: 0;\n  padding-bottom: 0;\n  padding-left: 4px;\n  padding-right: 4px;\n}\n\n#bnpcayxojb .gt_column_spanner_outer:first-child {\n  padding-left: 0;\n}\n\n#bnpcayxojb .gt_column_spanner_outer:last-child {\n  padding-right: 0;\n}\n\n#bnpcayxojb .gt_column_spanner {\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  vertical-align: bottom;\n  padding-top: 5px;\n  padding-bottom: 6px;\n  overflow-x: hidden;\n  display: inline-block;\n  width: 100%;\n}\n\n#bnpcayxojb .gt_group_heading {\n  padding: 8px;\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: initial;\n  text-transform: inherit;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n  vertical-align: middle;\n}\n\n#bnpcayxojb .gt_empty_group_heading {\n  padding: 0.5px;\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: initial;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  vertical-align: middle;\n}\n\n#bnpcayxojb .gt_from_md > :first-child {\n  margin-top: 0;\n}\n\n#bnpcayxojb .gt_from_md > :last-child {\n  margin-bottom: 0;\n}\n\n#bnpcayxojb .gt_row {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n  margin: 10px;\n  border-top-style: solid;\n  border-top-width: 1px;\n  border-top-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n  vertical-align: middle;\n  overflow-x: hidden;\n}\n\n#bnpcayxojb .gt_stub {\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: initial;\n  text-transform: inherit;\n  border-right-style: solid;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n  padding-left: 12px;\n}\n\n#bnpcayxojb .gt_summary_row {\n  color: #333333;\n  background-color: #FFFFFF;\n  text-transform: inherit;\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n}\n\n#bnpcayxojb .gt_first_summary_row {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_grand_summary_row {\n  color: #333333;\n  background-color: #FFFFFF;\n  text-transform: inherit;\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n}\n\n#bnpcayxojb .gt_first_grand_summary_row {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n  border-top-style: double;\n  border-top-width: 6px;\n  border-top-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_striped {\n  background-color: rgba(128, 128, 128, 0.05);\n}\n\n#bnpcayxojb .gt_table_body {\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_footnotes {\n  color: #333333;\n  background-color: #FFFFFF;\n  border-bottom-style: none;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 2px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_footnote {\n  margin: 0px;\n  font-size: 90%;\n  padding: 4px;\n}\n\n#bnpcayxojb .gt_sourcenotes {\n  color: #333333;\n  background-color: #FFFFFF;\n  border-bottom-style: none;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 2px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n}\n\n#bnpcayxojb .gt_sourcenote {\n  font-size: 90%;\n  padding: 4px;\n}\n\n#bnpcayxojb .gt_left {\n  text-align: left;\n}\n\n#bnpcayxojb .gt_center {\n  text-align: center;\n}\n\n#bnpcayxojb .gt_right {\n  text-align: right;\n  font-variant-numeric: tabular-nums;\n}\n\n#bnpcayxojb .gt_font_normal {\n  font-weight: normal;\n}\n\n#bnpcayxojb .gt_font_bold {\n  font-weight: bold;\n}\n\n#bnpcayxojb .gt_font_italic {\n  font-style: italic;\n}\n\n#bnpcayxojb .gt_super {\n  font-size: 65%;\n}\n\n#bnpcayxojb .gt_footnote_marks {\n  font-style: italic;\n  font-size: 65%;\n}\n<\/style>\n<div id=\"bnpcayxojb\" style=\"overflow-x:auto;overflow-y:auto;width:auto;height:auto;\"><table class=\"gt_table\">\n  <thead class=\"gt_header\">\n    <tr>\n      <th colspan=\"6\" class=\"gt_heading gt_title gt_font_normal\" style>Regression Model<\/th>\n    <\/tr>\n    <tr>\n      <th colspan=\"6\" class=\"gt_heading gt_subtitle gt_font_normal gt_bottom_border\" style><\/th>\n    <\/tr>\n  <\/thead>\n  <thead class=\"gt_col_headings\">\n    <tr>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\">Parameter<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">Coefficient<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">SE<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">95% CI<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">t(144)<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">p<\/th>\n    <\/tr>\n  <\/thead>\n  <tbody class=\"gt_table_body\">\n    <tr>\n      <td class=\"gt_row gt_left\">(Intercept)<\/td>\n      <td class=\"gt_row gt_center\">3.81<\/td>\n      <td class=\"gt_row gt_center\">0.06<\/td>\n      <td class=\"gt_row gt_center\">(3.70, 3.93)<\/td>\n      <td class=\"gt_row gt_center\">65.50<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Sepal.Length (1st degree)<\/td>\n      <td class=\"gt_row gt_center\">4.06<\/td>\n      <td class=\"gt_row gt_center\">0.47<\/td>\n      <td class=\"gt_row gt_center\">(3.14, 4.98)<\/td>\n      <td class=\"gt_row gt_center\">8.70<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Sepal.Length (2nd degree)<\/td>\n      <td class=\"gt_row gt_center\">-1.30<\/td>\n      <td class=\"gt_row gt_center\">0.31<\/td>\n      <td class=\"gt_row gt_center\">(-1.92, -0.68)<\/td>\n      <td class=\"gt_row gt_center\">-4.14<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Species (versicolor)<\/td>\n      <td class=\"gt_row gt_center\">-1.01<\/td>\n      <td class=\"gt_row gt_center\">0.28<\/td>\n      <td class=\"gt_row gt_center\">(-1.56, -0.46)<\/td>\n      <td class=\"gt_row gt_center\">-3.62<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Species (virginica)<\/td>\n      <td class=\"gt_row gt_center\">-0.99<\/td>\n      <td class=\"gt_row gt_center\">0.29<\/td>\n      <td class=\"gt_row gt_center\">(-1.55, -0.43)<\/td>\n      <td class=\"gt_row gt_center\">-3.48<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Petlen (4-7)<\/td>\n      <td class=\"gt_row gt_center\">-0.14<\/td>\n      <td class=\"gt_row gt_center\">0.28<\/td>\n      <td class=\"gt_row gt_center\">(-0.69, 0.42)<\/td>\n      <td class=\"gt_row gt_center\">-0.48<\/td>\n      <td class=\"gt_row gt_center\">0.630 <\/td>\n    <\/tr>\n  <\/tbody>\n  <tfoot class=\"gt_sourcenotes\"><\/tfoot>\n  \n<\/table><\/div>\n<p><code>print_md()<\/code> and <code>print_html()<\/code> are considered as main functions for users who want to generate nicely rendered tables inside markdown-documents. A wrapper around these both is <code>display()<\/code>, which either calls <code>print_md()<\/code> or <code>print_html()<\/code>.<\/p>\n<pre class=\"r\"><code>model_parameters(model) %&gt;% display(format = &quot;html&quot;)<\/code><\/pre>\n<style>html {\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;\n}\n\n#pkgjjiaexd .gt_table {\n  display: table;\n  border-collapse: collapse;\n  margin-left: auto;\n  margin-right: auto;\n  color: #333333;\n  font-size: 16px;\n  font-weight: normal;\n  font-style: normal;\n  background-color: #FFFFFF;\n  width: auto;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #A8A8A8;\n  border-right-style: none;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #A8A8A8;\n  border-left-style: none;\n  border-left-width: 2px;\n  border-left-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_heading {\n  background-color: #FFFFFF;\n  text-align: center;\n  border-bottom-color: #FFFFFF;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_title {\n  color: #333333;\n  font-size: 125%;\n  font-weight: initial;\n  padding-top: 4px;\n  padding-bottom: 4px;\n  border-bottom-color: #FFFFFF;\n  border-bottom-width: 0;\n}\n\n#pkgjjiaexd .gt_subtitle {\n  color: #333333;\n  font-size: 85%;\n  font-weight: initial;\n  padding-top: 0;\n  padding-bottom: 4px;\n  border-top-color: #FFFFFF;\n  border-top-width: 0;\n}\n\n#pkgjjiaexd .gt_bottom_border {\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_col_headings {\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_col_heading {\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: normal;\n  text-transform: inherit;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n  vertical-align: bottom;\n  padding-top: 5px;\n  padding-bottom: 6px;\n  padding-left: 5px;\n  padding-right: 5px;\n  overflow-x: hidden;\n}\n\n#pkgjjiaexd .gt_column_spanner_outer {\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: normal;\n  text-transform: inherit;\n  padding-top: 0;\n  padding-bottom: 0;\n  padding-left: 4px;\n  padding-right: 4px;\n}\n\n#pkgjjiaexd .gt_column_spanner_outer:first-child {\n  padding-left: 0;\n}\n\n#pkgjjiaexd .gt_column_spanner_outer:last-child {\n  padding-right: 0;\n}\n\n#pkgjjiaexd .gt_column_spanner {\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  vertical-align: bottom;\n  padding-top: 5px;\n  padding-bottom: 6px;\n  overflow-x: hidden;\n  display: inline-block;\n  width: 100%;\n}\n\n#pkgjjiaexd .gt_group_heading {\n  padding: 8px;\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: initial;\n  text-transform: inherit;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n  vertical-align: middle;\n}\n\n#pkgjjiaexd .gt_empty_group_heading {\n  padding: 0.5px;\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: initial;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  vertical-align: middle;\n}\n\n#pkgjjiaexd .gt_from_md > :first-child {\n  margin-top: 0;\n}\n\n#pkgjjiaexd .gt_from_md > :last-child {\n  margin-bottom: 0;\n}\n\n#pkgjjiaexd .gt_row {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n  margin: 10px;\n  border-top-style: solid;\n  border-top-width: 1px;\n  border-top-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 1px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 1px;\n  border-right-color: #D3D3D3;\n  vertical-align: middle;\n  overflow-x: hidden;\n}\n\n#pkgjjiaexd .gt_stub {\n  color: #333333;\n  background-color: #FFFFFF;\n  font-size: 100%;\n  font-weight: initial;\n  text-transform: inherit;\n  border-right-style: solid;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n  padding-left: 12px;\n}\n\n#pkgjjiaexd .gt_summary_row {\n  color: #333333;\n  background-color: #FFFFFF;\n  text-transform: inherit;\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n}\n\n#pkgjjiaexd .gt_first_summary_row {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_grand_summary_row {\n  color: #333333;\n  background-color: #FFFFFF;\n  text-transform: inherit;\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n}\n\n#pkgjjiaexd .gt_first_grand_summary_row {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  padding-left: 5px;\n  padding-right: 5px;\n  border-top-style: double;\n  border-top-width: 6px;\n  border-top-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_striped {\n  background-color: rgba(128, 128, 128, 0.05);\n}\n\n#pkgjjiaexd .gt_table_body {\n  border-top-style: solid;\n  border-top-width: 2px;\n  border-top-color: #D3D3D3;\n  border-bottom-style: solid;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_footnotes {\n  color: #333333;\n  background-color: #FFFFFF;\n  border-bottom-style: none;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 2px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_footnote {\n  margin: 0px;\n  font-size: 90%;\n  padding: 4px;\n}\n\n#pkgjjiaexd .gt_sourcenotes {\n  color: #333333;\n  background-color: #FFFFFF;\n  border-bottom-style: none;\n  border-bottom-width: 2px;\n  border-bottom-color: #D3D3D3;\n  border-left-style: none;\n  border-left-width: 2px;\n  border-left-color: #D3D3D3;\n  border-right-style: none;\n  border-right-width: 2px;\n  border-right-color: #D3D3D3;\n}\n\n#pkgjjiaexd .gt_sourcenote {\n  font-size: 90%;\n  padding: 4px;\n}\n\n#pkgjjiaexd .gt_left {\n  text-align: left;\n}\n\n#pkgjjiaexd .gt_center {\n  text-align: center;\n}\n\n#pkgjjiaexd .gt_right {\n  text-align: right;\n  font-variant-numeric: tabular-nums;\n}\n\n#pkgjjiaexd .gt_font_normal {\n  font-weight: normal;\n}\n\n#pkgjjiaexd .gt_font_bold {\n  font-weight: bold;\n}\n\n#pkgjjiaexd .gt_font_italic {\n  font-style: italic;\n}\n\n#pkgjjiaexd .gt_super {\n  font-size: 65%;\n}\n\n#pkgjjiaexd .gt_footnote_marks {\n  font-style: italic;\n  font-size: 65%;\n}\n<\/style>\n<div id=\"pkgjjiaexd\" style=\"overflow-x:auto;overflow-y:auto;width:auto;height:auto;\"><table class=\"gt_table\">\n  <thead class=\"gt_header\">\n    <tr>\n      <th colspan=\"6\" class=\"gt_heading gt_title gt_font_normal\" style>Regression Model<\/th>\n    <\/tr>\n    <tr>\n      <th colspan=\"6\" class=\"gt_heading gt_subtitle gt_font_normal gt_bottom_border\" style><\/th>\n    <\/tr>\n  <\/thead>\n  <thead class=\"gt_col_headings\">\n    <tr>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\">Parameter<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">Coefficient<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">SE<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">95% CI<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">t(144)<\/th>\n      <th class=\"gt_col_heading gt_columns_bottom_border gt_center\" rowspan=\"1\" colspan=\"1\">p<\/th>\n    <\/tr>\n  <\/thead>\n  <tbody class=\"gt_table_body\">\n    <tr>\n      <td class=\"gt_row gt_left\">(Intercept)<\/td>\n      <td class=\"gt_row gt_center\">3.81<\/td>\n      <td class=\"gt_row gt_center\">0.06<\/td>\n      <td class=\"gt_row gt_center\">(3.70, 3.93)<\/td>\n      <td class=\"gt_row gt_center\">65.50<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Sepal.Length (1st degree)<\/td>\n      <td class=\"gt_row gt_center\">4.06<\/td>\n      <td class=\"gt_row gt_center\">0.47<\/td>\n      <td class=\"gt_row gt_center\">(3.14, 4.98)<\/td>\n      <td class=\"gt_row gt_center\">8.70<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Sepal.Length (2nd degree)<\/td>\n      <td class=\"gt_row gt_center\">-1.30<\/td>\n      <td class=\"gt_row gt_center\">0.31<\/td>\n      <td class=\"gt_row gt_center\">(-1.92, -0.68)<\/td>\n      <td class=\"gt_row gt_center\">-4.14<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Species (versicolor)<\/td>\n      <td class=\"gt_row gt_center\">-1.01<\/td>\n      <td class=\"gt_row gt_center\">0.28<\/td>\n      <td class=\"gt_row gt_center\">(-1.56, -0.46)<\/td>\n      <td class=\"gt_row gt_center\">-3.62<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Species (virginica)<\/td>\n      <td class=\"gt_row gt_center\">-0.99<\/td>\n      <td class=\"gt_row gt_center\">0.29<\/td>\n      <td class=\"gt_row gt_center\">(-1.55, -0.43)<\/td>\n      <td class=\"gt_row gt_center\">-3.48<\/td>\n      <td class=\"gt_row gt_center\">&lt; .001<\/td>\n    <\/tr>\n    <tr>\n      <td class=\"gt_row gt_left\">Petlen (4-7)<\/td>\n      <td class=\"gt_row gt_center\">-0.14<\/td>\n      <td class=\"gt_row gt_center\">0.28<\/td>\n      <td class=\"gt_row gt_center\">(-0.69, 0.42)<\/td>\n      <td class=\"gt_row gt_center\">-0.48<\/td>\n      <td class=\"gt_row gt_center\">0.630 <\/td>\n    <\/tr>\n  <\/tbody>\n  <tfoot class=\"gt_sourcenotes\"><\/tfoot>\n  \n<\/table><\/div>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p><em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/LDtrx\">@LeoDutriaux<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"In defence of the 95% CI","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_95\/","pubDate":"Tue, 12 May 2020 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_95\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><strong>TLDR:<\/strong> <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><strong>BayestestR<\/strong><\/a> <strong>currently uses a 89% threshold by default for Credible Intervals (CI). Should we change that? If so, by what?<\/strong> <a href=\"https:\/\/github.com\/easystats\/bayestestR\/issues\/250\"><strong><em>Join the discussion here.<\/em><\/strong><\/a><\/p>\n<p>Magical numbers, or conventional thresholds, have bad press in statistics, and there are many of them. For instance, <strong>.05<\/strong> (for the <em>p<\/em>-value), or the <strong>95%<\/strong> range for the <strong>Confidence Interval<\/strong> (CI). Indeed, why 95 and not 94 or 90?<\/p>\n<p>One of the issue that traditional confidence intervals are often being interpreted as a description of the uncertainty surrounding a parameter\u2019s value. Almost as if the estimation resulted in a <strong>probability distribution<\/strong>, from which the confidence interval is describing the <em>width<\/em>.<\/p>\n<p>Well the traditional confidence interval is <strong>not that<\/strong>, and this probabilistic interpretation pertains in fact to the <strong><em>Credible<\/em><\/strong> <strong>Interval<\/strong> obtained via Bayesian methods. Indeed, in the Bayesian framework, parameters of a model are given as probability distributions that we need to describe (see this <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayestestR.html\">gentle introduction to Bayes<\/a>).<\/p>\n<p>And as you might know, <em>some<\/em> Bayesianists tend to think that their philosophy is superior to that of the frequentist empire (<em>could be true though<\/em>). Also, as the Bayesian field is growing, people see it as a new world and a promissing opportunity to make things right, and correct the mistakes that have been poisoning the old world.<\/p>\n<p>This has led experts to question the validity of this 95% range, which appeared as arbitrary, and closely related to the <em>p<\/em>-value and the notion of <strong>significance<\/strong> (<em>ewww<\/em>). This, as well as because of some computational reasons (related to the stability of the bounds of a distribution in relationship with the number of samples), has led some to move away from 95%, and use for instance 90%. Recently, the great McElreath, in his awesome book <a href=\"https:\/\/xcelab.net\/rm\/statistical-rethinking\/\"><strong>Statistical Rethinking<\/strong><\/a>, made the case for using 89%, to underline the arbitrary nature of such threshold.<\/p>\n<p>However, there might be a few arguments that could potentially be made <strong>in favour<\/strong> of this \u201cmagical value\u201d.<\/p>\n<div id=\"reproducibility-and-continuation\" class=\"section level2\">\n<h2>Reproducibility and continuation<\/h2>\n<p>The scientific landscape, especially in social and neuro- sciences, has been recently shaken by the so-called <strong>reproducibility crisis<\/strong>. People realized that the science they trusted was akin to a collossus with clay feet: many \u201cfacts\u201d and published results were not replicable, and most of them were not <strong>reproducible<\/strong>. The full steps to go from data to results were either not provided, or not described with enough details to allow other researchers to apply the exact same pipeline, with the end goal of <em>comparing<\/em> the results.<\/p>\n<p>Indeed, most scientific results, or result numbers, are relative, in the sense that they are to be interpreted in the context of a method, measure, field or context. <strong>People sometimes joke that a correlation of .70 is a disaster in physics but a miracle in psychology<\/strong>. As such, it is important that we take this continuity of science into account when making decisions. Let\u2019s say everybody, from Newton and Copernicus, used <code>Pi = 3.10<\/code>. Should we change that? Sure, because it\u2019s a <em>bad<\/em> number and a bad approximation, and using <code>Pi = 3.14<\/code> is <em>objectively<\/em> better. But in the case where there is no strong reason to do so, should we change conventions, just for the sake of change?<\/p>\n<p>By switching to reporting 89% intervals, mainly for the sake of heightening the wall between the Bayesian and the frequentist worlds, it seems like it kind of goes against this idea of continuity and additivity of scientific results. And I\u2019m not sure the benefits outweight the drawbacks.<\/p>\n<\/div>\n<div id=\"purpose-of-such-interval\" class=\"section level2\">\n<h2>Purpose of such <em>interval<\/em><\/h2>\n<p>People often use the credible interval to describe the <strong>uncertainty<\/strong> related to their parameters, because <strong>uncertainty<\/strong> is key and should be embraced. But you might ask, why not use another index of uncertainty, - and dispersion, such as for instance the standard deviation <strong>SD<\/strong>?<\/p>\n<p>Well, some people describe both, but in that case you might also add the MAD, and all ranges of the credible interval. In fact, you might as well return the whole density plot (though if you can, it\u2019s the best thing to do. And do check out the great <a href=\"https:\/\/github.com\/mjskay\/tidybayes\/\"><strong>tidybayes package<\/strong> for awesome visualization tools<\/a>).<\/p>\n<p>So, what are the advantages of the CI over the SD? Well, one difference is that the CI bounds are often seen as an approximation of the limits of a distribution (or its plausible region). What does it mean? Take this example. Let\u2019s imagine this distribution of mean 0 and SD 1 made of a lot of points:<\/p>\n<pre class=\"r\"><code>library(bayestestR)<\/code><\/pre>\n<pre><code>## Note: The default CI width (currently `ci=0.89`) might change in future versions (see https:\/\/github.com\/easystats\/bayestestR\/discussions\/250). To prevent any issues, please set it explicitly when using bayestestR functions, via the &#39;ci&#39; argument.<\/code><\/pre>\n<pre class=\"r\"><code>library(see)\n\nx &lt;- distribution_normal(10^6, mean = 0, sd = 1)\n\nplot(estimate_density(x)) +\n  theme_modern()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_95_files\/figure-html\/unnamed-chunk-2-1.png\" width=\"672\" \/><\/p>\n<p>While this empirical distribution of values has real bounds (it has a minimum and a maximum value), these are merely a computational \u201cartifact\u201d. In theory, this distribution covers the whole range of real values, extending until infinity (and beyond). All values are <em>possible<\/em>, albeit very very very very <strong>unlikely<\/strong>. But despite this mathematical fact, our chunking-loving brain understands that the important stuff is happening somewhere between -3 and 3.<\/p>\n<p>As such, the uncertainty interval can be used to convey a rough (and artificial) sense of the limits of the likely area. Having edges of plausibility is arguably more intuitive than a single dispersion index, such as SD, facilitating decision making (for instance, if this range covers 0) and interpretations.<\/p>\n<\/div>\n<div id=\"relationship-with-the-sd\" class=\"section level2\">\n<h2>Relationship with the SD<\/h2>\n<p>Alright, we see how returning a credible interval is useful and provides intuitive information about the \u201climits\u201d of a continuous distribution. On the other hand, the SD is such a mathematical marvel, tied with other useful concepts such as <em>z<\/em>-scores, standardization etc. It is indeed tempting to return both the CI and the SD. But as we said, reporting too much information can also hinder the readibility of a document, so which one to pick (if we had to)?<\/p>\n<p>Moreover, the SD can also be used to describe the width of a distribution. For instance, we know that the bulk of a normal distribution lies within 6 SD around the mean. In the case above, the majority of points fall within -3 SD to 3 SD. When I say the bulk, it\u2019s about 99.7% of the values, which arguably includes also quite improbable values.<\/p>\n<p>So what if we restricted the range a bit, and took the range from -2 SD to 2 SD? Interestingly, such range includes, <em>you guessed it<\/em>, about 95% of the values (95.45).<\/p>\n<pre class=\"r\"><code>library(ggplot2)\n\nplot(ci(x, ci=0.95)) +\n  scale_x_continuous(breaks = -3:3) +\n  theme_modern()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_95_files\/figure-html\/unnamed-chunk-3-1.png\" width=\"672\" \/><\/p>\n<p>That means that we can roughly approximate the 95% range from the SD\u2026 and <em>vice versa<\/em>. If a 95% range is [2, 10], it means that the SD is probably somewhere around <code>(10 - 2) \/ 4 = 2<\/code>. And this means that there is a rough correspondance between the 95% CI and the SD, connecting these two concepts in a more general and intuitive understanding of a distribution<\/p>\n<p><strong>I see you coming<\/strong>. <em>\u201cBut this approximation is only true for normal distributions and posterior distributions are not (or should not be) always normal\u201d<\/em>. <em>\u201cThis is misguided and will create more confusion in the minds of the padawan\u201d<\/em>. It\u2019s true that this relationship is not an absolute mathematical truth, but merely a heuristic that could foster the embrace of a deeper understanding of uncertainty. Could it be misleading? I\u2019m not sure.<\/p>\n<p>All in all, these are some elements that could be made to support the usage of the 95% range. They might not be the strongest arguments, which opens up a debate.<\/p>\n<\/div>\n<div id=\"what-do-you-think\" class=\"section level2\">\n<h2>What do you think?<\/h2>\n<p>In our package <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><strong>bayestestR<\/strong><\/a>, we previously used <code>0.89<\/code> by default, that returned the 89% CI. But as we like to challenge ourselves, we are looking for arguments in favour, or against, its change.<\/p>\n<p>Thus, we\u2019d like to invite you to give your opinion or vote on the <a href=\"https:\/\/github.com\/easystats\/bayestestR\/issues\/250\">dedicated issue<\/a>. Thanks :)<\/p>\n<p><strong><em>Note: this is an opinion article written by me and that it does not necessarily reflect the opinions of the other easystats members, nor the opinion of my family, my people and that of the Human species.<\/em><\/strong><\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p><em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/LDtrx\">@LeoDutriaux<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"Multilevel Correlations: A New Method for Common Problems","link":"https:\/\/easystats.github.io\/blog\/posts\/correlation_multilevel\/","pubDate":"Tue, 14 Apr 2020 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/correlation_multilevel\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>In this tutorial, we will introduce <strong>multilevel correlations<\/strong> (or <em>hierarchical<\/em> \/ <em>random-effects<\/em> correlations) and how to compute them using the new <a href=\"https:\/\/github.com\/easystats\/correlation\"><strong>correlations<\/strong><\/a> package from the <a href=\"https:\/\/github.com\/easystats\"><strong>easystats suite<\/strong><\/a>.<\/p>\n<p>You can install the updated version and load the package as follows:<\/p>\n<pre class=\"r\"><code>install.packages(&quot;correlation&quot;)\nlibrary(correlation)<\/code><\/pre>\n<div id=\"data\" class=\"section level2\">\n<h2>Data<\/h2>\n<p>Imagine we have an experiment in which <strong>10 individuals<\/strong> completed a task with <strong>100 trials<\/strong>. For each of the 1000 total trials, we measured two things, <strong>V1<\/strong> and <strong>V2<\/strong>, and our research aims at <strong>investingating the link between these two variables<\/strong>.<\/p>\n<p>We will generate data using the <a href=\"https:\/\/easystats.github.io\/correlation\/reference\/simulate_simpson.html\"><code>simulate_simpson()<\/code><\/a> function from the <code>correlation<\/code> package installed above.<\/p>\n<pre class=\"r\"><code>data &lt;- simulate_simpson(n=100, groups=10)<\/code><\/pre>\n<p>Now let\u2019s visualize the two variables:<\/p>\n<pre class=\"r\"><code>library(ggplot2)\n\nggplot(data, aes(x=V1, y=V2)) + \n  geom_point() +\n  geom_smooth(colour=&quot;black&quot;, method=&quot;lm&quot;, se=FALSE) +\n  theme_classic()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/correlation_multilevel_files\/figure-html\/unnamed-chunk-5-1.png\" width=\"672\" \/><\/p>\n<p>That seems pretty straightfoward! It seems like there is a <strong>negative correlation<\/strong> between V1 and V2. Let\u2019s test this.<\/p>\n<\/div>\n<div id=\"simple-correlation\" class=\"section level2\">\n<h2>Simple correlation<\/h2>\n<pre class=\"r\"><code>correlation(data)<\/code><\/pre>\n<pre><code>## Parameter1 | Parameter2 |     r |         95% CI | t(998) |      p |  Method | n_Obs\n## ------------------------------------------------------------------------------------\n## V1         |         V2 | -0.84 | [-0.86, -0.82] | -48.77 | &lt; .001 | Pearson |  1000\n## \n## p-value adjustment method: Holm (1979)<\/code><\/pre>\n<p>Indeed, there is <strong>strong, negative and significant correlation<\/strong> between V1 and V2. Great, can we go ahead and <strong>publish these results in PNAS<\/strong>?<\/p>\n<\/div>\n<div id=\"the-simpsons-paradox\" class=\"section level2\">\n<h2>The Simpson\u2019s Paradox<\/h2>\n<p>Hold on sunshine! Ever heard of something called the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Simpson%27s_paradox\"><strong>Simpson\u2019s Paradox<\/strong><\/a>?<\/p>\n<p>Let\u2019s colour our datapoints by group (by individuals):<\/p>\n<pre class=\"r\"><code>library(ggplot2)\n\nggplot(data, aes(x=V1, y=V2)) + \n  geom_point(aes(colour=Group)) +\n  geom_smooth(aes(colour=Group), method=&quot;lm&quot;, se=FALSE) + \n  geom_smooth(colour=&quot;black&quot;, method=&quot;lm&quot;, se=FALSE) + \n  theme_classic()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/correlation_multilevel_files\/figure-html\/unnamed-chunk-7-1.png\" width=\"672\" \/><\/p>\n<p><em>Mmh<\/em>, interesting. It seems like, for each subject, the relationship is different. The negative general trend seems to be created by <strong>differences between the groups<\/strong> and could be spurious!<\/p>\n<p><strong>Multilevel <em>(as in multi-group)<\/em> correlations allow us to account for differences between groups<\/strong>. It is based on a partialization of the group variable, entered as a random factor in a mixed linear regression.<\/p>\n<p>You can compute them with the <a href=\"https:\/\/github.com\/easystats\/correlation\"><strong>correlations<\/strong><\/a> package by setting the <code>multilevel<\/code> arguent to <code>TRUE<\/code>.<\/p>\n<pre class=\"r\"><code>correlation(data, multilevel = TRUE)<\/code><\/pre>\n<pre><code>## Parameter1 | Parameter2 |    r |           CI | t(998) |      p |  Method | n_Obs\n## ---------------------------------------------------------------------------------\n## V1         |         V2 | 0.50 | [0.45, 0.55] |  18.24 | &lt; .001 | Pearson |  1000\n## \n## p-value adjustment method: Holm (1979)<\/code><\/pre>\n<p><strong>Dayum!<\/strong> We were too hasty in our conclusions! Taking the group into account seems to be super important.<\/p>\n<p>Note: In this simple case where only two variables are of interest, it would be of course best to directly proceed using a mixed regression model instead of correlations. That being said, the latter can be useful for exploratory analysis, when multiple variables are of interest, or in combination with a network or structural approach.<\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p><em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/LDtrx\">@LeoDutriaux<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"The ulimate package for correlations (by easystats)","link":"https:\/\/easystats.github.io\/blog\/posts\/correlation_presentation\/","pubDate":"Wed, 18 Mar 2020 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/correlation_presentation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/correlation\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"the-correlation-package\" class=\"section level2\">\n<h2>The correlation package<\/h2>\n<p>The <a href=\"https:\/\/github.com\/easystats\"><strong>easystats project<\/strong><\/a> continues to grow with its more recent addition, a package devoted to <strong>correlations<\/strong>. Check-out its <a href=\"https:\/\/github.com\/easystats\/correlation\"><strong>webpage here<\/strong><\/a>!<\/p>\n<p>It\u2019s lightweight, easy to use, and allows for the computation of many different kinds of correlations, such as <strong>partial<\/strong> correlations, <strong>Bayesian<\/strong> correlations, <strong>multilevel<\/strong> correlations, <strong>polychoric<\/strong> correlations, <strong>biweight<\/strong>, <strong>percentage bend<\/strong> or <strong>Sheperd\u2019s Pi<\/strong> correlations (types of <strong>robust<\/strong> correlation), <strong>distance<\/strong> correlation (a type of <strong>non-linear<\/strong> correlation) and more, also allowing for combinations between them (for instance, <em>Bayesian partial multilevel correlation<\/em>).<\/p>\n<p>You can install and load the package as follows:<\/p>\n<pre class=\"r\"><code>install.packages(&quot;correlation&quot;)\nlibrary(correlation)<\/code><\/pre>\n<\/div>\n<div id=\"examples\" class=\"section level2\">\n<h2>Examples<\/h2>\n<p>The main function is <a href=\"https:\/\/easystats.github.io\/correlation\/reference\/correlation.html\"><code>correlation()<\/code><\/a>, which builds on top of <a href=\"https:\/\/easystats.github.io\/correlation\/reference\/cor_test.html\"><code>cor_test()<\/code><\/a> and comes with a number of possible options.<\/p>\n<\/div>\n<div id=\"correlation-details-and-matrix\" class=\"section level2\">\n<h2>Correlation details and matrix<\/h2>\n<pre class=\"r\"><code>cor &lt;- correlation(iris)\ncor<\/code><\/pre>\n<pre><code>## Parameter1   |   Parameter2 |     r |         95% CI | t(148) |      p |  Method | n_Obs\n## ----------------------------------------------------------------------------------------\n## Sepal.Length |  Sepal.Width | -0.12 | [-0.27,  0.04] |  -1.44 | 0.152  | Pearson |   150\n## Sepal.Length | Petal.Length |  0.87 | [ 0.83,  0.91] |  21.65 | &lt; .001 | Pearson |   150\n## Sepal.Length |  Petal.Width |  0.82 | [ 0.76,  0.86] |  17.30 | &lt; .001 | Pearson |   150\n## Sepal.Width  | Petal.Length | -0.43 | [-0.55, -0.29] |  -5.77 | &lt; .001 | Pearson |   150\n## Sepal.Width  |  Petal.Width | -0.37 | [-0.50, -0.22] |  -4.79 | &lt; .001 | Pearson |   150\n## Petal.Length |  Petal.Width |  0.96 | [ 0.95,  0.97] |  43.39 | &lt; .001 | Pearson |   150\n## \n## p-value adjustment method: Holm (1979)<\/code><\/pre>\n<p>The output is not a square matrix, but a <strong>(tidy) dataframe with all correlations tests per row<\/strong>. One can also obtain a <strong>matrix<\/strong> using:<\/p>\n<pre class=\"r\"><code>summary(cor)<\/code><\/pre>\n<pre><code>## Parameter    | Petal.Width | Petal.Length | Sepal.Width\n## -------------------------------------------------------\n## Sepal.Length |     0.82*** |      0.87*** |       -0.12\n## Sepal.Width  |    -0.37*** |     -0.43*** |            \n## Petal.Length |     0.96*** |              |<\/code><\/pre>\n<p>Note that one can also obtain the full, <strong>square<\/strong> and redundant matrix using:<\/p>\n<pre class=\"r\"><code>as.table(cor)<\/code><\/pre>\n<pre><code>## Parameter    | Sepal.Length | Sepal.Width | Petal.Length | Petal.Width\n## ----------------------------------------------------------------------\n## Sepal.Length |      1.00*** |       -0.12 |      0.87*** |     0.82***\n## Sepal.Width  |        -0.12 |     1.00*** |     -0.43*** |    -0.37***\n## Petal.Length |      0.87*** |    -0.43*** |      1.00*** |     0.96***\n## Petal.Width  |      0.82*** |    -0.37*** |      0.96*** |     1.00***<\/code><\/pre>\n<\/div>\n<div id=\"grouped-dataframes\" class=\"section level2\">\n<h2>Grouped dataframes<\/h2>\n<p>The function also supports <strong>stratified correlations<\/strong>, all within the <em>tidyverse<\/em> workflow!<\/p>\n<pre class=\"r\"><code>library(dplyr)\n\niris %&gt;% \n  select(Species, Petal.Width, Sepal.Length, Sepal.Width) %&gt;%\n  group_by(Species) %&gt;% \n  correlation()<\/code><\/pre>\n<pre><code>## Group      |   Parameter1 |   Parameter2 |    r |        95% CI | t(48) |      p |  Method | n_Obs\n## --------------------------------------------------------------------------------------------------\n## setosa     |  Petal.Width | Sepal.Length | 0.28 | [ 0.00, 0.52] |  2.01 | 0.101  | Pearson |    50\n## setosa     |  Petal.Width |  Sepal.Width | 0.23 | [-0.05, 0.48] |  1.66 | 0.104  | Pearson |    50\n## setosa     | Sepal.Length |  Sepal.Width | 0.74 | [ 0.59, 0.85] |  7.68 | &lt; .001 | Pearson |    50\n## versicolor |  Petal.Width | Sepal.Length | 0.55 | [ 0.32, 0.72] |  4.52 | &lt; .001 | Pearson |    50\n## versicolor |  Petal.Width |  Sepal.Width | 0.66 | [ 0.47, 0.80] |  6.15 | &lt; .001 | Pearson |    50\n## versicolor | Sepal.Length |  Sepal.Width | 0.53 | [ 0.29, 0.70] |  4.28 | &lt; .001 | Pearson |    50\n## virginica  |  Petal.Width | Sepal.Length | 0.28 | [ 0.00, 0.52] |  2.03 | 0.048  | Pearson |    50\n## virginica  |  Petal.Width |  Sepal.Width | 0.54 | [ 0.31, 0.71] |  4.42 | &lt; .001 | Pearson |    50\n## virginica  | Sepal.Length |  Sepal.Width | 0.46 | [ 0.20, 0.65] |  3.56 | 0.002  | Pearson |    50\n## \n## p-value adjustment method: Holm (1979)<\/code><\/pre>\n<\/div>\n<div id=\"bayesian-correlations\" class=\"section level2\">\n<h2>Bayesian Correlations<\/h2>\n<p>It is very easy to switch to a <strong>Bayesian framework<\/strong>.<\/p>\n<pre class=\"r\"><code>correlation(iris, bayesian=TRUE)<\/code><\/pre>\n<pre><code>## Parameter1   |   Parameter2 |   rho |         95% CI |     pd | % in ROPE |     BF |         Prior |           Method | n_Obs\n## -----------------------------------------------------------------------------------------------------------------------------\n## Sepal.Length |  Sepal.Width | -0.11 | [-0.25,  0.02] | 90.77% |    44.17% |  0.509 | Beta (3 +- 3) | Bayesian Pearson |   150\n## Sepal.Length | Petal.Length |  0.86 | [ 0.83,  0.89] |   100% |        0% | &gt; 1000 | Beta (3 +- 3) | Bayesian Pearson |   150\n## Sepal.Length |  Petal.Width |  0.80 | [ 0.76,  0.85] |   100% |        0% | &gt; 1000 | Beta (3 +- 3) | Bayesian Pearson |   150\n## Sepal.Width  | Petal.Length | -0.41 | [-0.52, -0.30] |   100% |        0% | &gt; 1000 | Beta (3 +- 3) | Bayesian Pearson |   150\n## Sepal.Width  |  Petal.Width | -0.35 | [-0.47, -0.24] |   100% |     0.02% | &gt; 1000 | Beta (3 +- 3) | Bayesian Pearson |   150\n## Petal.Length |  Petal.Width |  0.96 | [ 0.95,  0.97] |   100% |        0% | &gt; 1000 | Beta (3 +- 3) | Bayesian Pearson |   150<\/code><\/pre>\n<\/div>\n<div id=\"tetrachoric-polychoric-biserial-biweight\" class=\"section level2\">\n<h2>Tetrachoric, Polychoric, Biserial, Biweight\u2026<\/h2>\n<p>The <code>correlation<\/code> package also supports different types of methods, which can deal with correlations <strong>between factors<\/strong>!<\/p>\n<pre class=\"r\"><code>correlation(iris, include_factors = TRUE, method = &quot;auto&quot;)<\/code><\/pre>\n<pre><code>## Parameter1         |         Parameter2 |     r |         95% CI | t(148) |      p |         Method | n_Obs\n## -----------------------------------------------------------------------------------------------------------\n## Sepal.Length       |        Sepal.Width | -0.12 | [-0.27,  0.04] |  -1.44 | 0.452  |        Pearson |   150\n## Sepal.Length       |       Petal.Length |  0.87 | [ 0.83,  0.91] |  21.65 | &lt; .001 |        Pearson |   150\n## Sepal.Length       |        Petal.Width |  0.82 | [ 0.76,  0.86] |  17.30 | &lt; .001 |        Pearson |   150\n## Sepal.Length       |     Species.setosa | -0.72 | [-0.79, -0.63] | -12.53 | &lt; .001 | Point-biserial |   150\n## Sepal.Length       | Species.versicolor |  0.08 | [-0.08,  0.24] |   0.97 | 0.452  | Point-biserial |   150\n## Sepal.Length       |  Species.virginica |  0.64 | [ 0.53,  0.72] |  10.08 | &lt; .001 | Point-biserial |   150\n## Sepal.Width        |       Petal.Length | -0.43 | [-0.55, -0.29] |  -5.77 | &lt; .001 |        Pearson |   150\n## Sepal.Width        |        Petal.Width | -0.37 | [-0.50, -0.22] |  -4.79 | &lt; .001 |        Pearson |   150\n## Sepal.Width        |     Species.setosa |  0.60 | [ 0.49,  0.70] |   9.20 | &lt; .001 | Point-biserial |   150\n## Sepal.Width        | Species.versicolor | -0.47 | [-0.58, -0.33] |  -6.44 | &lt; .001 | Point-biserial |   150\n## Sepal.Width        |  Species.virginica | -0.14 | [-0.29,  0.03] |  -1.67 | 0.392  | Point-biserial |   150\n## Petal.Length       |        Petal.Width |  0.96 | [ 0.95,  0.97] |  43.39 | &lt; .001 |        Pearson |   150\n## Petal.Length       |     Species.setosa | -0.92 | [-0.94, -0.89] | -29.13 | &lt; .001 | Point-biserial |   150\n## Petal.Length       | Species.versicolor |  0.20 | [ 0.04,  0.35] |   2.51 | 0.066  | Point-biserial |   150\n## Petal.Length       |  Species.virginica |  0.72 | [ 0.63,  0.79] |  12.66 | &lt; .001 | Point-biserial |   150\n## Petal.Width        |     Species.setosa | -0.89 | [-0.92, -0.85] | -23.41 | &lt; .001 | Point-biserial |   150\n## Petal.Width        | Species.versicolor |  0.12 | [-0.04,  0.27] |   1.44 | 0.452  | Point-biserial |   150\n## Petal.Width        |  Species.virginica |  0.77 | [ 0.69,  0.83] |  14.66 | &lt; .001 | Point-biserial |   150\n## Species.setosa     | Species.versicolor | -0.88 | [-0.91, -0.84] | -22.43 | &lt; .001 |    Tetrachoric |   150\n## Species.setosa     |  Species.virginica | -0.88 | [-0.91, -0.84] | -22.43 | &lt; .001 |    Tetrachoric |   150\n## Species.versicolor |  Species.virginica | -0.88 | [-0.91, -0.84] | -22.43 | &lt; .001 |    Tetrachoric |   150\n## \n## p-value adjustment method: Holm (1979)<\/code><\/pre>\n<\/div>\n<div id=\"partial-correlations\" class=\"section level2\">\n<h2>Partial Correlations<\/h2>\n<p>It also supports <strong>partial correlations<\/strong>:<\/p>\n<pre class=\"r\"><code>iris %&gt;% \n  correlation(partial = TRUE) %&gt;% \n  summary()<\/code><\/pre>\n<pre><code>## Parameter    | Petal.Width | Petal.Length | Sepal.Width\n## -------------------------------------------------------\n## Sepal.Length |    -0.34*** |      0.72*** |     0.63***\n## Sepal.Width  |     0.35*** |     -0.62*** |            \n## Petal.Length |     0.87*** |              |<\/code><\/pre>\n<\/div>\n<div id=\"gaussian-graphical-models-ggms\" class=\"section level2\">\n<h2>Gaussian Graphical Models (GGMs)<\/h2>\n<p>Such partial correlations can also be represented as <strong>Gaussian graphical models<\/strong>, an increasingly popular tool in psychology:<\/p>\n<pre class=\"r\"><code>library(see) # for plotting\nlibrary(ggraph) # needs to be loaded\n\nmtcars %&gt;% \n  correlation(partial = TRUE) %&gt;% \n  plot()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/correlation_presentation_files\/figure-html\/unnamed-chunk-13-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p><em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/LDtrx\">@LeoDutriaux<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"The p-direction: A Bayesian equivalent of the p-value?","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_pd\/","pubDate":"Wed, 26 Feb 2020 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_pd\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>The Bayesian framework is powerful and allows for an incredible amount of flexibility and control over your analysis. That being said, newcomers often struggle with a lot of new concepts and tools and could benefit from some <strong>familiar grounding<\/strong>. And the <em>p<\/em>-value is a very familiar index (although paradoxically often misunderstood, but that\u2019s another topic).<\/p>\n<p><strong>Is there an equivalent of the <em>p<\/em>-value?<\/strong> Well, depends on what \u201cequivalent\u201d means. Some might argue that the <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayes_factors.html\"><strong>Bayes factor<\/strong><\/a> is some sort of equivalent, i.e., a value that can be used for decisions and interpretation of results. <a href=\"https:\/\/www.youtube.com\/watch?v=Ip8Ci5KUVRc&amp;t=408s\">Some others<\/a> would suggest that the <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/p_map.html\">MAP-based <em>p<\/em>-value<\/a> is another alternative.<\/p>\n<p>Based on a simulation study <a href=\"https:\/\/www.frontiersin.org\/articles\/10.3389\/fpsyg.2019.02767\/full\">(Makowski et al., 2019)<\/a>, we think that the <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/probability_of_direction.html\"><strong>probability of direction<\/strong><\/a> (<em>p<\/em>-direction, or <em>pd<\/em>) is the closest <strong><em>statistical<\/em> equivalent to the <em>p<\/em>-value<\/strong>. The <em>statistical<\/em> is important here, simply meaning that the two indices are strongly correlated. That being said, they are <strong>not <em>conceptually<\/em> equivalent<\/strong> (as we argue in the paper, the <em>pd<\/em> is an index of effect <em>existence<\/em>, rather than <em>significance<\/em>).<\/p>\n<p>Here\u2019s a short example.<\/p>\n<div id=\"frequentist-regression\" class=\"section level2\">\n<h2>Frequentist regression<\/h2>\n<p>First, you can install (or update) the necessary packages by running the following (it\u2019s important that the <em>insight<\/em> package version must be &gt;= 0.8.1):<\/p>\n<pre class=\"r\"><code>install.packages(c(&quot;insight&quot;, &quot;bayestestR&quot;, &quot;parameters&quot;))<\/code><\/pre>\n<p>Let\u2019s start by running a simple linear regression and displaying its result with the <a href=\"https:\/\/easystats.github.io\/parameters\/\"><strong>parameters<\/strong><\/a> package.<\/p>\n<pre class=\"r\"><code>library(parameters)\n\nmodel &lt;- lm(disp ~ carb, data = mtcars)\nparameters(model)<\/code><\/pre>\n<pre><code>## Parameter   | Coefficient |    SE |          95% CI | t(30) |     p\n## -------------------------------------------------------------------\n## (Intercept) |      145.48 | 41.58 | [60.56, 230.40] |  3.50 | 0.001\n## carb        |       30.31 | 12.87 | [ 4.02,  56.59] |  2.35 | 0.025<\/code><\/pre>\n<p>The <em>p<\/em>-value of the linear relationship between the two variable is of <em>.025<\/em> (the second row in the <em>p<\/em> column). What does a Bayesian analysis tells us?<\/p>\n<\/div>\n<div id=\"bayesian-regression-with-flat-priors\" class=\"section level2\">\n<h2>Bayesian regression (with flat priors)<\/h2>\n<p>As you might know, a Bayesian analysis is close to a maximum likelihood analysis (the typical frequentist paradigm) when no information is given by the prior (and the result is only driven by the data). This is the case with <strong>flat priors<\/strong>, that give equivalent likelihood to each and every one of your wildest dreams (see the <a href=\"https:\/\/cran.r-project.org\/web\/packages\/rstanarm\/vignettes\/priors.html\"><em>How to Specify Flat Priors (and why you typically shouldn\u2019t)<\/em><\/a> section).<\/p>\n<p>Let\u2019s fit the same regression as above within a Bayesian framework with a flat prior (i.e., by setting them as <code>NULL<\/code>).<\/p>\n<pre class=\"r\"><code>library(bayestestR)\nlibrary(rstanarm)\n\nmodel &lt;-\n  stan_glm(\n    disp ~ carb,\n    data = mtcars,\n    priors = NULL,\n    prior_intercept = NULL\n  )<\/code><\/pre>\n<pre class=\"r\"><code>parameters(model)<\/code><\/pre>\n<pre><code>## Parameter   | Median |          89% CI |     pd | % in ROPE |  Rhat |   ESS |                Prior\n## --------------------------------------------------------------------------------------------------\n## (Intercept) | 145.87 | [77.91, 215.41] | 99.94% |     0.14% | 1.000 | 52545 |       Uniform ( +- )\n## carb        |  30.22 | [ 9.10,  51.92] | 98.68% |     8.89% | 1.000 | 52711 | Normal (0 +- 191.83)<\/code><\/pre>\n<p>It tells us that the <em>p<\/em>-direction is of 98.80%, i.e., <code>0.9880<\/code> (note that your results can slightly vary due to the random nature of the sampling; you can increase the number of iterations to get more stable results). We can quickly visualize its meaning as follows (with the <a href=\"https:\/\/github.com\/easystats\/see\"><strong>see<\/strong><\/a> package):<\/p>\n<pre class=\"r\"><code>library(see)\n\nplot(p_direction(model))<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_pd_files\/figure-html\/unnamed-chunk-7-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"from-p-direction-to-p-value\" class=\"section level2\">\n<h2>From <em>p<\/em>-direction to <em>p<\/em>-value<\/h2>\n<p>We can convert this value to a <em>p<\/em>-value using the following function:<\/p>\n<pre class=\"r\"><code>pd_to_p(0.9880)<\/code><\/pre>\n<pre><code>## [1] 0.024<\/code><\/pre>\n<p>As we can see, we are not far from the frequentist <em>p<\/em>-value!<\/p>\n<p>But again, we need to underline that the <em>p<\/em>-direction has a <strong>different meaning and interpretation<\/strong>. It refers to the <em>probability that the effect is positive or negative (depending on the median\u2019s sign)<\/em>. But like the <em>p<\/em>-value, it cannot either be used to <strong>support a lack of an effect<\/strong> (for that, <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/region_of_practical_equivalence.html\">ROPE-based indices<\/a> or <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayes_factors.html\">Bayes factors<\/a> might be more appropriate).<\/p>\n<p>Moreover, when using <strong>informative priors<\/strong> centred at 0, a Bayesian analysis will always lead to \u201cless significant\u201d effects, as the prior will pull the posterior towards 0. This is a natural way of penalizing results, which <strong>is a good thing<\/strong>.<\/p>\n<p>In conclusion, make sure you understand the indices you use (for instance by <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayestestR.html\"><strong>checking-out our gentle intro to Bayesian analysis<\/strong><\/a>)!<\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p><em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/easystats4u\">@easystats4u<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/LDtrx\">@LeoDutriaux<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"easystats: one year already. What's next?","link":"https:\/\/easystats.github.io\/blog\/posts\/easystats_oneyear\/","pubDate":"Thu, 23 Jan 2020 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/easystats_oneyear\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"happy-birthday-easystats\" class=\"section level2\">\n<h2>Happy birthday easystats!<\/h2>\n<p>About a year ago, I <a href=\"https:\/\/github.com\/DominiqueMakowski\">(Dom)<\/a> sadly realised that the R package I was maintaining (<a href=\"https:\/\/github.com\/neuropsychology\/psycho.R\"><em>psycho<\/em><\/a>) was drifting more and more away from its original scope, getting drown under a pile of unrelated and under-documented features that I kept on adding as my R skills improved. <strong>Something had to be done.<\/strong><\/p>\n<p>I decided to get in touch with <a href=\"https:\/\/github.com\/strengejacke\">Daniel<\/a>, <em>aka<\/em> <strong>strengejacke<\/strong> (for mysterious and very confusing reasons), the author of the <a href=\"https:\/\/github.com\/strengejacke\"><em>sjverse<\/em><\/a>, a collection of awesome packages which scope wasn\u2019t too distant from my own one. Quickly, we realised that beyond facing similar issues, we shared the same vision: <strong>Make R stats easy again<\/strong>.<\/p>\n<p>We were also agreeing on a possible way of reaching this goal. Build a new collection of packages that would work together to provide a smooth experience to getting stats, and all that entails, done in R (note that we preferred the workflow to be <em>easy<\/em> rather than <em>tidy<\/em>\u2026 ;p). Most importantly, we shared the same values, including a commitment to open-science, a desire for collaborative development, a focus on user- and beginner- friendliness, and a dedication to the Force.<\/p>\n<p>And just like that, <a href=\"https:\/\/github.com\/orgs\/easystats\/\"><strong>easystats was born<\/strong><\/a>.<\/p>\n<p>But this project wouldn\u2019t have grown, nor still exist, if we hadn\u2019t manage to bring in the <strong>most talented people<\/strong>, creating an awesome <a href=\"https:\/\/github.com\/orgs\/easystats\/people\">team<\/a> which diversity in experience and skills offers an incredibly valuable resource. Shout-out to the ultimate Bayes master <a href=\"https:\/\/github.com\/mattansb\">@mattansb<\/a>, to our socio-political expert <a href=\"https:\/\/github.com\/pdwaggoner\">@pdwaggoner<\/a>, to <a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a>, the compulsive model supporter and author of the famous <a href=\"https:\/\/github.com\/IndrajeetPatil\/ggstatsplot\"><em>ggstatsplot<\/em><\/a>, to our big-daddy-markdown-mate <a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a>, to the best dinosaur stats explainer <a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a> and to the <a href=\"https:\/\/github.com\/jacob-long\/interactions\"><em>interaction<\/em><\/a> genius <a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a>. A big thank you to this great team. Make sure to check-out their awesome work and research!<\/p>\n<p>Together in one year, we created <strong>9 packages<\/strong>, pushed 7 of them to <strong>CRAN<\/strong> (which have now been downloaded more than <strong>half a million times<\/strong> <em>(!!!)<\/em>), wrote many <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong>blogposts<\/strong><\/a>, and made just about a thousand <a href=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/misc\/notthememe.jpg\">memes<\/a>. But most importantly, we all <strong>learned a lot<\/strong>, as this project partly became the opportunity for us to drastically improve our R, stats, programming and light-saber skills. Moreover, it also ended up being a great occasion and place to have <strong>fun<\/strong>, contribute to the <strong>community<\/strong>, and become part of a <strong>network<\/strong> of talented and open-minded people with similar interests. And that is, by far, one of the biggest take-away.<\/p>\n<p>And yet, although fun is good, it doesn\u2019t make for a living (unless you\u2019re Mr Bean). And the <strong>easystats<\/strong> project also turned out to be a legit academic research project with legit academic outcomes. This year, we published <strong>3 papers<\/strong> (<a href=\"https:\/\/joss.theoj.org\/papers\/10.21105\/joss.01412\"><em>insight<\/em><\/a>]; <a href=\"https:\/\/joss.theoj.org\/papers\/10.21105\/joss.01541\"><em>bayestestR<\/em><\/a> and <a href=\"https:\/\/doi.org\/10.3389\/fpsyg.2019.02767\">another Bayes-related one<\/a>) related to easystats, and we plan on keeping up <em>at least<\/em> that rhythm for the year to come <em>(now might be your chance to get involved ;)<\/em>.<\/p>\n<p>Aside from publications, we also plan on releasing the remaining packages (What do I hear? \u201cfixing <a href=\"https:\/\/github.com\/easystats\/report\"><em>report<\/em><\/a>\u201d?), continue improving the existing ones and adding even more awesome features and documentation.<\/p>\n<p>All in all, <strong>easystats<\/strong> is a living and breathing demonstration of how an open-science project can be born, keep growing and improving like an old wine. And the beauty, and tragedy, lies in the fact that it\u2019s arguably against all the odds offered by the current academic system. We have <strong>no funding<\/strong> (however, very interested in getting some\u2026 <em>*wink wink*<\/em>), no initial publication goals, and no direct obligation or pressure to work to it. We are all contributing to it on our <strong>free time<\/strong>, out of <strong>pure enthusiasm<\/strong> and interest in making this place a lil\u2019 bit better.<\/p>\n<p>So, as a closing note, because happiness is only useful when it is shared, we\u2019d like to thank <strong>you, user of easystats<\/strong>, for directly contributing to our passion. Cheers!<\/p>\n<p><em>\u2026And if you\u2019re not yet a user or a contributor\u2026 what are you waiting for?!<\/em><\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>Note that <em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<div id=\"stay-tuned\" class=\"section level2\">\n<h2>Stay tuned<\/h2>\n<p>To be updated about the <em>upcoming features<\/em> and cool R or data science stuff, you can <strong>follow the packages on GitHub<\/strong> (click on one <a href=\"https:\/\/github.com\/easystats\">of the easystats package<\/a>) and then on the <strong>Watch<\/strong> button on the top right corner) as well as the <strong>easystats team on twitter and online<\/strong>:<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/strengejacke\">@strengejacke<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/Dom_Makowski\">@DominiqueMakowski<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/mattansb\">@mattansb<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/patilindrajeets\">@IndrajeetPatil<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/humanfactorsio\">@humanfactors<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jonaslindeloev\">@lindeloev<\/a><\/li>\n<li><a href=\"https:\/\/twitter.com\/jacobandrewlong\">@jacob-long<\/a><\/li>\n<li><a href=\"https:\/\/pdwaggoner.github.io\/\">@pdwaggoner<\/a><\/li>\n<\/ul>\n<\/div>\n"},{"title":"Comparison of indices of significance in the Bayesian framework","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_evidence_ani\/","pubDate":"Tue, 17 Dec 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_evidence_ani\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>The <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><strong>bayestestR<\/strong><\/a> package has several functions to compute indices of effect existence and significance in a Bayesian framework, like <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/p_direction.html\"><code>p_direction()<\/code><\/a> or <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/bayesfactor_parameters.html\"><code>bayesfactor_parameters()<\/code><\/a>.<\/p>\n<p>The accuracy of these indices is affected by various sources of uncertainty, such as sample size or noise. <a href=\"https:\/\/twitter.com\/Dom_Makowski\/status\/1204027373542203394?s=20\">Using the package<\/a>, we have created a small animation that demontrates how new evidence updates the posterior distribution and thereby indices of existence and significance:<\/p>\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/bayestestR\/evidence_accumulation.gif\" \/><\/p>\n<p>If you\u2019d like to know more (statistical) details about these indices, we have recently published a paper with a simulation study (available for free!), demonstrating how such indices behave in the context of different sources of uncertainty:<\/p>\n<ul>\n<li>Makowski, D., Ben-Shachar, M. S., Chen, S. H., &amp; L\u00fcdecke, D. (2019). <em>Indices of Effect Existence and Significance in the Bayesian Framework. Frontiers in Psychology, 10<\/em>, 2767. doi: <a href=\"https:\/\/doi.org\/10.3389\/fpsyg.2019.02767\">10.3389\/fpsyg.2019.02767<\/a><\/li>\n<\/ul>\n<p>In this paper, you\u2019ll also find fancy figures like this one, showing the relationship between Bayesian indices and the frequentist <em>p<\/em>-value:<\/p>\n<p><img src=\"https:\/\/raw.githubusercontent.com\/easystats\/easystats\/master\/man\/figures\/bayestestR\/Figure4-small.png\" \/><\/p>\n<p><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/p>\n"},{"title":"News from easystats: updated parameters and see packages.","link":"https:\/\/easystats.github.io\/blog\/posts\/parameters_and_see_update\/","pubDate":"Mon, 25 Nov 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/parameters_and_see_update\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/parameters\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><img src=\"https:\/\/github.com\/easystats\/see\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"new-features-of-the-parameters-and-see-package\" class=\"section level2\">\n<h2>New Features of the parameters and see Package<\/h2>\n<p>We\u2019re excited to announce some news from the <a href=\"https:\/\/github.com\/easystats\/easystats\">easystats-project<\/a>. Two packages were updated recently, the <a href=\"https:\/\/easystats.github.io\/parameters\"><strong>parameters<\/strong>-package<\/a> and our visualization-toolbox, the <a href=\"http:\/\/easystats.github.io\/see\"><strong>see<\/strong>-package<\/a>.<\/p>\n<p>Before we start introducing some of the new features, we\u2019d like to explain why you need the <strong>see<\/strong>-package to create plots for functions from other <em>easystats<\/em> packages. So, the <strong>see<\/strong>-package not only includes additional geoms, color scales and themes for <strong>ggplot2<\/strong>, but - maybe more important - also provides <code>plot()<\/code>-methods for many functions from the various <em>easystats<\/em> packages. By separating the plotting functionality from our core packages, packages from the easystats-project don\u2019t rely nor import any other packages! This means that you can safely use them as dependencies in your own packages, without the risk of butterfly effects (a small change in a distant downstream dependency with unexpected upstream consequences).<\/p>\n<\/div>\n<div id=\"print-and-plot-your-model-parameters\" class=\"section level2\">\n<h2>Print and Plot your Model Parameters<\/h2>\n<p>The <a href=\"https:\/\/easystats.github.io\/parameters\/reference\/model_parameters.html\"><code>model_parameters()<\/code><\/a> function in the <strong>parameters<\/strong>-package is simlar to <code>broom::tidy()<\/code> - it returns a summary of the model parameters as a clean, consistent data frame. <a href=\"https:\/\/easystats.github.io\/parameters\/reference\/standardize_names.html\"><code>standardize_names()<\/code><\/a> can be used to return a data frame with column names as they are used in other packages (like <strong>broom<\/strong>).<\/p>\n<p><code>model_parameters()<\/code> supports many different models, including mixed or Bayesian regression models. It comes with nice <code>print()<\/code> and <code>plot()<\/code> methods.<\/p>\n<div id=\"examples---zero-inflated-mixed-models-with-glmmtmb\" class=\"section level3\">\n<h3>Examples - Zero Inflated Mixed Models with glmmTMB<\/h3>\n<p>The first example is a zero-inflated mixed model, fitted with the <strong>glmmTMB<\/strong>-package. <code>model_parameters()<\/code> creates separate tables for different model components (like zero-inflated components).<\/p>\n<pre class=\"r\"><code>library(glmmTMB)\ndata(Salamanders)\nmodel &lt;- glmmTMB(\n  count ~ spp + mined + (1 | site),\n  ziformula = ~mined,\n  family = poisson(),\n  data = Salamanders\n)\n\nmodel_parameters(model)<\/code><\/pre>\n<pre><code>## # Fixed Effects\n## \n## Parameter   | Log-Mean |   SE |         95% CI |     z |      p\n## ---------------------------------------------------------------\n## (Intercept) |    -0.36 | 0.28 | [-0.90,  0.18] | -1.30 | 0.194 \n## spp [PR]    |    -1.27 | 0.24 | [-1.74, -0.80] | -5.27 | &lt; .001\n## spp [DM]    |     0.27 | 0.14 | [ 0.00,  0.54] |  1.95 | 0.051 \n## spp [EC-A]  |    -0.57 | 0.21 | [-0.97, -0.16] | -2.75 | 0.006 \n## spp [EC-L]  |     0.67 | 0.13 | [ 0.41,  0.92] |  5.20 | &lt; .001\n## spp [DES-L] |     0.63 | 0.13 | [ 0.38,  0.87] |  4.96 | &lt; .001\n## spp [DF]    |     0.12 | 0.15 | [-0.17,  0.40] |  0.78 | 0.435 \n## mined [no]  |     1.27 | 0.27 | [ 0.74,  1.80] |  4.72 | &lt; .001\n## \n## # Zero-Inflated\n## \n## Parameter   | Log-Odds |   SE |         95% CI |     z |      p\n## ---------------------------------------------------------------\n## (Intercept) |     0.79 | 0.27 | [ 0.26,  1.32] |  2.90 | 0.004 \n## mined [no]  |    -1.84 | 0.31 | [-2.46, -1.23] | -5.87 | &lt; .001<\/code><\/pre>\n<p>If only a specific part of the model should be shown, use the <code>component<\/code>-argument.<\/p>\n<pre class=\"r\"><code>model_parameters(model, component = &quot;zero_inflated&quot;)<\/code><\/pre>\n<pre><code>## Parameter   | Log-Mean |   SE |         95% CI |     z |      p\n## ---------------------------------------------------------------\n## (Intercept) |     0.79 | 0.27 | [ 0.26,  1.32] |  2.90 | 0.004 \n## mined [no]  |    -1.84 | 0.31 | [-2.46, -1.23] | -5.87 | &lt; .001<\/code><\/pre>\n<p><code>plot()<\/code> creates a so called \u201cforest plot\u201d. In case of models with multiple components, parameters are separated into facets by model component.<\/p>\n<pre class=\"r\"><code>result &lt;- model_parameters(model)\nplot(result)<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/parameters_and_see_update_files\/figure-html\/unnamed-chunk-5-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"examples---bayesian-mixed-models-with-brms\" class=\"section level3\">\n<h3>Examples - Bayesian Mixed Models with brms<\/h3>\n<p>For the next example, we download a pre-compiled <strong>brms<\/strong> model to save computation time. For Bayesian models, by default, only \u201cfixed\u201d effects are shown. Using <code>effects = \"all\"<\/code> and <code>component = \"all\"<\/code> allows us to display random effects and the parameters of the zero-inflated model part as well.<\/p>\n<pre class=\"r\"><code># We download the model to save computation time. Here is the code\n# to refit the exact model used below...\n\n# zinb &lt;- read.csv(&quot;http:\/\/stats.idre.ucla.edu\/stat\/data\/fish.csv&quot;)\n# set.seed(123)\n# model &lt;- brm(bf(\n#     count ~ persons + child + camper + (1 | persons),\n#     zi ~ child + camper + (1 | persons)\n#   ),\n#   data = zinb,\n#   family = zero_inflated_poisson()\n# )\nbrms_model &lt;- insight::download_model(&quot;brms_zi_2&quot;)\nresult &lt;- model_parameters(brms_model, effects = &quot;all&quot;, component = &quot;all&quot;)\n\nresult<\/code><\/pre>\n<pre><code>## Parameter   | Median |         89% CI |     pd | % in ROPE |  Rhat |  ESS\n## -------------------------------------------------------------------------\n## (Intercept) |  -0.86 | [-1.37, -0.34] | 98.22% |     1.30% | 1.002 | 1003\n## persons     |   0.84 | [ 0.68,  1.01] |   100% |        0% | 1.002 |  878\n## child       |  -1.15 | [-1.29, -1.00] |   100% |        0% | 1.001 | 2166\n## camper      |   0.73 | [ 0.58,  0.89] |   100% |        0% | 1.000 | 3528\n## \n## Parameter   | Median |         89% CI |     pd | % in ROPE |  Rhat |  ESS\n## -------------------------------------------------------------------------\n## (Intercept) |  -0.65 | [-1.82,  0.47] | 83.17% |     7.80% | 1.000 | 1174\n## child       |   1.86 | [ 1.37,  2.42] |   100% |        0% | 1.002 | 3022\n## camper      |  -0.84 | [-1.40, -0.24] | 98.95% |     1.68% | 1.000 | 3410\n## \n## Parameter   | Median |       89% CI |   pd | % in ROPE |  Rhat | ESS\n## --------------------------------------------------------------------\n## (Intercept) |   0.12 | [0.00, 0.39] | 100% |    45.27% | 1.005 | 819\n## \n## Parameter   | Median |       89% CI |   pd | % in ROPE |  Rhat |  ESS\n## ---------------------------------------------------------------------\n## (Intercept) |   1.32 | [0.48, 2.49] | 100% |        0% | 1.004 | 1331<\/code><\/pre>\n<p><code>plot()<\/code> now creates four facets by default. Note that plots from the <strong>parameters<\/strong>-package create forest plots. If you prefer plots that show the complete posterior distribution, you may rather use functions from the <strong>bayestestRR<\/strong>-package, as shown <a href=\"https:\/\/easystats.github.io\/see\/articles\/bayestestR.html\">here<\/a>.<\/p>\n<pre class=\"r\"><code>plot(result)<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/parameters_and_see_update_files\/figure-html\/unnamed-chunk-7-1.png\" width=\"672\" \/><\/p>\n<p>You can modify the layout with <code>n_columns<\/code>.<\/p>\n<pre class=\"r\"><code>plot(result, n_columns = 1)<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/parameters_and_see_update_files\/figure-html\/unnamed-chunk-8-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"examples---meta-analysis-with-metafor\" class=\"section level3\">\n<h3>Examples - Meta-Analysis with metafor<\/h3>\n<p>Even results from meta-analyses, using the <strong>metafor<\/strong>-package, can be visualized with <strong>parameters<\/strong> and <strong>see<\/strong>.<\/p>\n<pre class=\"r\"><code>library(metafor)\nd &lt;- data.frame(\n  effectsize = c(-0.393, 0.675, 0.282, -1.398),\n  standarderror = c(0.317, 0.317, 0.13, 0.36)\n)\n\nma &lt;- rma(yi = effectsize, sei = standarderror, method = &quot;REML&quot;, data = d)\nresult &lt;- model_parameters(ma)\n\nresult<\/code><\/pre>\n<pre><code>## # Meta-analysis using &#39;metafor&#39;\n## \n## Parameter | Coefficient |   SE |         95% CI |     z |      p | Weight\n## -------------------------------------------------------------------------\n## Study 1   |       -0.39 | 0.32 | [-1.01,  0.23] | -1.24 | 0.215  |   9.95\n## Study 2   |        0.68 | 0.32 | [ 0.05,  1.30] |  2.13 | 0.033  |   9.95\n## Study 3   |        0.28 | 0.13 | [ 0.03,  0.54] |  2.17 | 0.030  |  59.17\n## Study 4   |       -1.40 | 0.36 | [-2.10, -0.69] | -3.88 | &lt; .001 |   7.72\n## Overall   |       -0.18 | 0.44 | [-1.05,  0.68] | -0.42 | 0.676  |<\/code><\/pre>\n<p>Above you see the coefficients, their standard errors and the \u201cweight\u201d, based on the inverse variance. When you plot the results, the dot-geoms have different sizes, depending on the weight of the study (similar to <code>metafor::forest()<\/code>).<\/p>\n<pre class=\"r\"><code>plot(result)<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/parameters_and_see_update_files\/figure-html\/unnamed-chunk-10-1.png\" width=\"672\" \/><\/p>\n<p><strong>Check out<\/strong> more examples and documentation <a href=\"https:\/\/easystats.github.io\/parameters\/\"><strong>here (for <em>parameters<\/em><\/strong>)<\/a> and <a href=\"https:\/\/easystats.github.io\/see\/\"><strong>here (for <em>see<\/em><\/strong>)<\/a>.<\/p>\n<\/div>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>Note that <em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"More models, more features: what's new in 'parameters' 0.2.0","link":"https:\/\/easystats.github.io\/blog\/posts\/parameters_v2\/","pubDate":"Mon, 30 Sep 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/parameters_v2\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/parameters\/raw\/master\/man\/figures\/figure1.png\" \/><!-- --><\/p>\n<p>The <a href=\"https:\/\/github.com\/easystats\"><strong>easystats project<\/strong><\/a> continues to grow, expanding its capabilities and features, and the <a href=\"https:\/\/github.com\/easystats\/parameters\"><strong><code>parameters<\/code><\/strong><\/a> package 0.2.0 update is now on CRAN.<\/p>\n<p>The primary goal of this package is to provide utilities for <strong>processing the parameters<\/strong> of various statistical models. It is useful for end-users as well as developers, as it is a <strong>lightweight<\/strong> and open-developed package.<\/p>\n<p>The main function, <a href=\"https:\/\/easystats.github.io\/parameters\/articles\/model_parameters.html\"><code>model_parameters()<\/code><\/a>, can be seen as an alternative to <code>broom::tidy()<\/code>. However, the package also include many more useful <a href=\"https:\/\/easystats.github.io\/parameters\/reference\/index.html\">features<\/a>, some of which are described in our <strong>improved documentation<\/strong>:<\/p>\n<div id=\"improved-documentation\" class=\"section level2\">\n<h2>Improved Documentation<\/h2>\n<ul>\n<li><p><strong>Parameters Description<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/easystats.github.io\/parameters\/articles\/model_parameters.html\">Guide to parameters description<\/a><\/li>\n<\/ul><\/li>\n<li><p><strong>Parameters Engineering<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/easystats.github.io\/parameters\/articles\/bootstrapping.html\">Guide to bootstrapped parameters<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/parameters\/articles\/standardization.html\">Guide to standardized parameters<\/a><\/li>\n<\/ul><\/li>\n<li><p><strong>Parameters Selection<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/easystats.github.io\/parameters\/articles\/parameters_selection.html\">Guide to parameters selection<\/a><\/li>\n<\/ul><\/li>\n<li><p><strong>Dimension Reduction<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/easystats.github.io\/parameters\/articles\/parameters_reduction.html\">Guide to feature reduction (PCA, cMDS, ICA\u2026)<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/parameters\/articles\/efa_cfa.html\">Guide to structural models (EFA, CFA, SEM\u2026)<\/a><\/li>\n<\/ul><\/li>\n<\/ul>\n<\/div>\n<div id=\"improved-support\" class=\"section level2\">\n<h2>Improved Support<\/h2>\n<p>Besides stabilizing and improving the functions for the most popular models (<code>glm()<\/code>, <code>glmer()<\/code>, <code>stan_glm()<\/code>, <code>psych<\/code> and <code>lavaan<\/code>\u2026), the functions <code>p_value()<\/code>, <code>ci()<\/code>, <code>standard_error()<\/code>, <code>standardize()<\/code> and most importantly <code>model_parameters()<\/code> now support many more model objects, including mixed models from packages <em>nlme<\/em>, <em>glmmTMB<\/em> or <em>GLMMadaptive<\/em>, zero-inflated models from package <em>pscl<\/em>, other regression types from packages <em>gam<\/em> or <em>mgcv<\/em>, fixed effects regression models from <em>panelr<\/em>, <em>lfe<\/em>, <em>feisr<\/em> or <em>plm<\/em>, and structural models from <em>FactoMineR<\/em>.<\/p>\n<\/div>\n<div id=\"improved-printing\" class=\"section level2\">\n<h2>Improved Printing<\/h2>\n<p>For models with special components, in particular zero-inflated models, <code>model_parameters()<\/code> separates these components for a clearer output.<\/p>\n<pre><code>## # Fixed Effects\n## \n## Parameter   | Log-Mean |   SE |         95% CI |     z |      p\n## ---------------------------------------------------------------\n## (Intercept) |    -0.36 | 0.28 | [-0.90,  0.18] | -1.30 | 0.194 \n## spp [PR]    |    -1.27 | 0.24 | [-1.74, -0.80] | -5.27 | &lt; .001\n## spp [DM]    |     0.27 | 0.14 | [ 0.00,  0.54] |  1.95 | 0.051 \n## spp [EC-A]  |    -0.57 | 0.21 | [-0.97, -0.16] | -2.75 | 0.006 \n## spp [EC-L]  |     0.67 | 0.13 | [ 0.41,  0.92] |  5.20 | &lt; .001\n## spp [DES-L] |     0.63 | 0.13 | [ 0.38,  0.87] |  4.96 | &lt; .001\n## spp [DF]    |     0.12 | 0.15 | [-0.17,  0.40] |  0.78 | 0.435 \n## mined [no]  |     1.27 | 0.27 | [ 0.74,  1.80] |  4.72 | &lt; .001\n## \n## # Zero-Inflated\n## \n## Parameter   | Log-Odds |   SE |         95% CI |     z |      p\n## ---------------------------------------------------------------\n## (Intercept) |     0.79 | 0.27 | [ 0.26,  1.32] |  2.90 | 0.004 \n## mined [no]  |    -1.84 | 0.31 | [-2.46, -1.23] | -5.87 | &lt; .001<\/code><\/pre>\n<\/div>\n<div id=\"join-the-team\" class=\"section level2\">\n<h2>Join the team<\/h2>\n<p>There is still room for improvement, and some new exciting features are already planned. Feel free to let us know how we could further improve this package!<\/p>\n<p>Note that <em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact one of <a href=\"https:\/\/github.com\/orgs\/easystats\/people\">us<\/a> if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"parameters: a powerful and lightweight alternative to broom to describe your models' coefficients","link":"https:\/\/easystats.github.io\/blog\/posts\/parameters_presentation\/","pubDate":"Tue, 10 Sep 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/parameters_presentation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/parameters\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<p>Okay, <em>\u201can alternative to broom\u201d<\/em> might be a bit of an <strong>overstatement<\/strong> <em>(at least for now\u2026)<\/em><\/p>\n<p>But the <a href=\"https:\/\/github.com\/easystats\/parameters\"><strong><code>parameters<\/code><\/strong><\/a> package, finally on CRAN, already has some cool features!<\/p>\n<div id=\"parameters\" class=\"section level2\">\n<h2>parameters<\/h2>\n<p><a href=\"https:\/\/github.com\/orgs\/easystats\/people\">We<\/a> have recently decided to collaborate around the <a href=\"https:\/\/github.com\/easystats\"><strong>easystats project<\/strong><\/a>, a set of packages designed to make your life <em>easier<\/em>. This project encompasses several packages, devoted for instance to <a href=\"https:\/\/github.com\/easystats\/insight\">model internal access<\/a>, <a href=\"https:\/\/github.com\/easystats\/bayestestR\">Bayesian analysis<\/a>, as well as <a href=\"https:\/\/github.com\/easystats\/performance\">indices of model performance and quality<\/a>.<\/p>\n<p><a href=\"https:\/\/github.com\/easystats\/parameters\"><strong><code>parameters'<\/code><\/strong><\/a> primary goal is to provide utilities for processing the parameters of various statistical models. Beyond computing <strong><em>p<\/em>-values<\/strong>, <strong>CIs<\/strong>, <strong>Bayesian indices<\/strong> and other measures for a wide variety of models, this package implements features like <strong>standardization<\/strong> or <strong>bootstrapping<\/strong> of parameters and models, <strong>feature reduction<\/strong> (feature extraction and variable selection) as well as conversion between indices of <strong>effect size<\/strong>.<\/p>\n<p>The main function of the package is <code>model_parameters()<\/code>, which allows you to extract the parameters and their characteristics from various models in a consistent way. It can be considered as a lightweight alternative to <a href=\"https:\/\/github.com\/tidymodels\/broom\"><code>broom::tidy()<\/code><\/a>, with some notable differences:<\/p>\n<ul>\n<li>The names of the returned dataframe are <strong>specific<\/strong> to their content. For instance, the column containing the statistic is named following the statistic name, i.e., <em>t<\/em>, <em>z<\/em>, etc., instead of a generic name such as <em>statistic<\/em>.<\/li>\n<li>It is able to compute or extract indices not available by default, such as <strong><em>p<\/em> values<\/strong>, <strong>CIs<\/strong>, etc.<\/li>\n<li>It includes <strong>feature engineering<\/strong> capabilities, including <a href=\"https:\/\/easystats.github.io\/parameters\/articles\/bootstrapping.html\"><strong>bootstrapping<\/strong><\/a> and <a href=\"https:\/\/easystats.github.io\/parameters\/articles\/standardization.html\"><strong>standardization<\/strong><\/a> of parameters.<\/li>\n<\/ul>\n<\/div>\n<div id=\"examples\" class=\"section level2\">\n<h2>Examples<\/h2>\n<div id=\"anovas\" class=\"section level3\">\n<h3>ANOVAs<\/h3>\n<pre class=\"r\"><code>df &lt;- iris\ndf$Sepal.Big &lt;- ifelse(df$Sepal.Width &gt;= 3, &quot;Yes&quot;, &quot;No&quot;)\n\nmodel &lt;- aov(Sepal.Length ~ Sepal.Big, data = df)\nmodel_parameters(model, eta_squared = &quot;partial&quot;)<\/code><\/pre>\n<pre><code>## Parameter | Sum_Squares |  df | Mean_Square |    F |     p | Eta2\n## -----------------------------------------------------------------\n## Sepal.Big |        1.10 |   1 |        1.10 | 1.61 | 0.207 | 0.01\n## Residuals |      101.07 | 148 |        0.68 |      |       |<\/code><\/pre>\n<\/div>\n<div id=\"mixed-models\" class=\"section level3\">\n<h3>Mixed models<\/h3>\n<pre class=\"r\"><code>library(lme4)\n\nmodel &lt;- lmer(Sepal.Width ~ Petal.Length + Petal.Width + (1|Species), data = iris)\nmodel_parameters(model, standardize = &quot;refit&quot;)<\/code><\/pre>\n<pre><code>## Parameter    | Coefficient |   SE |        95% CI |   t(145) |      p\n## ---------------------------------------------------------------------\n## (Intercept)  |    3.53e-13 | 1.51 | [-2.96, 2.96] | 2.33e-13 | &gt; .999\n## Petal.Length |        0.59 | 0.26 | [ 0.08, 1.10] |     2.26 | 0.024 \n## Petal.Width  |        1.07 | 0.24 | [ 0.60, 1.53] |     4.49 | &lt; .001<\/code><\/pre>\n<p>And you can also <strong>directly plot the parameters<\/strong> with the see package!<\/p>\n<pre class=\"r\"><code>library(see)\n\nlmer(Sepal.Width ~ Petal.Length * Petal.Width + (1|Species), data = iris) %&gt;% \n  model_parameters() %&gt;% \n  plot()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/parameters_presentation_files\/figure-html\/unnamed-chunk-7-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"bayesian-models\" class=\"section level3\">\n<h3>Bayesian models<\/h3>\n<pre class=\"r\"><code>library(rstanarm)\n\nmodel &lt;- stan_glm(mpg ~ wt + cyl, data = mtcars)\nmodel_parameters(model)<\/code><\/pre>\n<pre><code>## Parameter   | Median |         89% CI |     pd | % in ROPE |  Rhat |  ESS |                   Prior\n## ---------------------------------------------------------------------------------------------------\n## (Intercept) |  39.67 | [36.93, 42.68] |   100% |        0% | 0.999 | 4960 | Normal (20.09 +- 15.07)\n## wt          |  -3.19 | [-4.44, -1.92] | 99.98% |     0.10% | 1.002 | 2033 |  Normal (0.00 +- 15.40)\n## cyl         |  -1.51 | [-2.18, -0.84] | 99.98% |     1.77% | 1.002 | 2272 |   Normal (0.00 +- 8.44)<\/code><\/pre>\n<ul>\n<li><strong>Check out<\/strong> <a href=\"https:\/\/easystats.github.io\/parameters\/\"><strong>more examples and documentation here!<\/strong><\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>There is definitely room for improvement, and some new exciting features are already planned. Feel free to let us know how we could further improve this package!<\/p>\n<p>Note that <em>easystats<\/em> is a new project in active development, looking for contributors and supporters. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"Check your (Mixed) Model for Multicollinearity with 'performance'","link":"https:\/\/easystats.github.io\/blog\/posts\/performance_check_collinearity\/","pubDate":"Tue, 06 Aug 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/performance_check_collinearity\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/performance\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<p>The goal of <a href=\"https:\/\/github.com\/easystats\/performance\"><strong>performance<\/strong><\/a> is to provide lightweight tools to assess and check the quality of your model. It includes functions such as <a href=\"https:\/\/easystats.github.io\/performance\/reference\/r2.html\"><code>r2()<\/code><\/a> for many models (including logistic, mixed and Bayesian models), <a href=\"https:\/\/easystats.github.io\/performance\/reference\/icc.html\"><code>icc()<\/code><\/a> or helpers to <a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_convergence.html\"><code>check_convergence()<\/code><\/a>, <a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_overdispersion.html\"><code>check_overdipsersion()<\/code><\/a> or <a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_zeroinflation.html\"><code>check_zero-inflation()<\/code><\/a> (see a complete list of functions <a href=\"https:\/\/easystats.github.io\/performance\/reference\/index.html\">here<\/a>).<\/p>\n<p>In this posting, we want to focus on <em>multicollinearity<\/em>. Multicollinearity \u201cis a phenomenon in which one predictor variable in a multiple regression model can be linearly predicted from the others\u201d (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Multicollinearity\">source<\/a>), i.e.\u00a0two or more predictors are more or less strongly correlated (also described as <em>non-independent covariates<\/em>). Multicollinearity may lead to severly biased regression coefficients and standard errors.<\/p>\n<p><a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_convergence.html\"><code>check_collinearity()<\/code><\/a> checks your model predictors for collinearity. The function works for \u201csimple\u201d models, but also for mixed models, including zero-inflated mixed models fitted with the <strong>glmmTMB<\/strong> or <strong>GLMMadapative<\/strong> packages. The function provides a nice <code>print()<\/code> and <code>plot()<\/code> method, and examples are shown below.<\/p>\n<div id=\"check-linear-models-for-multicollinearity\" class=\"section level2\">\n<h2>Check Linear Models for Multicollinearity<\/h2>\n<p>First, we fit a simple linear model.<\/p>\n<pre class=\"r\"><code>library(performance)\n\n# fit model\ndata(mtcars)\nmodel &lt;- lm(mpg ~ wt + cyl + gear + disp, data = mtcars)<\/code><\/pre>\n<p>Now let\u2019s check the model. Below you see two columns in the output, one indicating the <em>variance inflation factor<\/em>, <code>VIF<\/code>.<\/p>\n<pre class=\"r\"><code># now check for multicollinearity\ncheck_collinearity(model)<\/code><\/pre>\n<pre><code>## # Check for Multicollinearity\n## \n## Low Correlation\n## \n##  Parameter  VIF Increased SE\n##       gear 1.53         1.24\n## \n## Moderate Correlation\n## \n##  Parameter  VIF Increased SE\n##         wt 5.05         2.25\n##        cyl 5.41         2.33\n##       disp 9.97         3.16<\/code><\/pre>\n<p>The variance inflation factor is a measure to analyze the magnitude of multicollinearity of model terms. A VIF less than 5 indicates a low correlation of that predictor with other predictors. A value between 5 and 10 indicates a moderate correlation, while VIF values larger than 10 are a sign for high, not tolerable correlation of model predictors.<\/p>\n<p>The <code>Increased SE<\/code> column in the output indicates how much larger the standard error is due to the correlation with other predictors.<\/p>\n<p>Now let\u2019s plot the results.<\/p>\n<pre class=\"r\"><code># plot results\nx &lt;- check_collinearity(model)\nplot(x)<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/performance_check_collinearity_files\/figure-html\/unnamed-chunk-5-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"check-zero-inflated-mixed-models-for-multicollinearity\" class=\"section level2\">\n<h2>Check Zero-Inflated Mixed Models for Multicollinearity<\/h2>\n<p>For models with zero-inflation component, multicollinearity may happen both in the <em>count<\/em> as well as the <em>zero-inflation<\/em> component. By default, <code>check_collinearity()<\/code> checks the complete model, however, you can check only certain components of the model using the <code>component<\/code>-argument. In the following example, we will focus on the complete model.<\/p>\n<pre class=\"r\"><code>library(glmmTMB)\ndata(Salamanders)\n\n# create highly correlated pseudo-variable\nset.seed(1)\nSalamanders$cover2 &lt;-\n  Salamanders$cover * runif(n = nrow(Salamanders), min = .7, max = 1.3)\n\n# fit mixed model with zero-inflation\nmodel &lt;- glmmTMB(\n  count ~ spp + mined + cover + cover2 + (1 | site), \n  ziformula = ~ spp + mined, \n  family = truncated_poisson, \n  data = Salamanders\n)\n\n# now check for multicollinearity\ncheck_collinearity(model)<\/code><\/pre>\n<pre><code>## # Check for Multicollinearity\n## \n## * conditional component:\n## \n## Low Correlation\n## \n##  Parameter  VIF Increased SE\n##        spp 1.07         1.04\n##      mined 1.17         1.08\n## \n## High Correlation\n## \n##  Parameter   VIF Increased SE\n##      cover 19.30         4.39\n##     cover2 19.12         4.37\n## \n## * zero inflated component:\n## \n## Low Correlation\n## \n##  Parameter  VIF Increased SE\n##        spp 1.08         1.04\n##      mined 1.08         1.04<\/code><\/pre>\n<p>As you can see, the <code>print()<\/code> method separates the results into the <em>count<\/em> and <em>zero-inflated<\/em> model components for a clearer output. Similar, <code>plot()<\/code> produces facets for each components, so it\u2019s easier to understand.<\/p>\n<pre class=\"r\"><code>plot(check_collinearity(model))<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/performance_check_collinearity_files\/figure-html\/unnamed-chunk-7-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"remedies-for-multicollinearity\" class=\"section level2\">\n<h2>Remedies for Multicollinearity<\/h2>\n<p>Multicollinearity can have different reasons. Probably in many cases it will help to center or standardize the predictors. Sometimes the only way to avoid multicollinearity is to remove one of the predictors with a very high VIF value. Collecting more data may also help, but this is of course not always possible.<\/p>\n<\/div>\n<div id=\"join-easystats\" class=\"section level2\">\n<h2>join easystats<\/h2>\n<p>Note that <a href=\"https:\/\/github.com\/easystats\"><strong><em>easystats<\/em><\/strong><\/a> is a new project in active development, and feedback, suggestions, comments are very welcome! Do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"Testing Contrasts from Bayesian Models with 'emmeans' and 'bayestestR'","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_emmeans\/","pubDate":"Thu, 06 Jun 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_emmeans\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<div id=\"the-problem-with-null-effects\" class=\"section level1\">\n<h1>The Problem with Null Effects<\/h1>\n<p>Say you fit an ANOVA model, predicting the time it takes to solve a puzzle from its shape (round \/ square) and whether it was colored or black and white, and you found that one of the estimated effects, in this case the interaction, was not significant. Say even that it was as non-significant as can be, with <strong><em>p<\/em> = 1.00<\/strong>!<\/p>\n<pre class=\"r\"><code>options(contrasts = c(&#39;contr.sum&#39;, &#39;contr.poly&#39;))\n\ndata(&quot;puzzles&quot;, package = &quot;BayesFactor&quot;)\naov_model &lt;- aov(RT ~ shape*color + Error(ID\/(shape*color)), data = puzzles)\n\nsummary(aov_model)<\/code><\/pre>\n<pre><code>## \n## Error: ID\n##           Df Sum Sq Mean Sq F value Pr(&gt;F)\n## Residuals 11    226    20.6               \n## \n## Error: ID:shape\n##           Df Sum Sq Mean Sq F value Pr(&gt;F)  \n## shape      1   12.0   12.00    7.54  0.019 *\n## Residuals 11   17.5    1.59                 \n## ---\n## Signif. codes:  0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1\n## \n## Error: ID:color\n##           Df Sum Sq Mean Sq F value Pr(&gt;F)   \n## color      1   12.0   12.00    13.9 0.0033 **\n## Residuals 11    9.5    0.86                  \n## ---\n## Signif. codes:  0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1\n## \n## Error: ID:shape:color\n##             Df Sum Sq Mean Sq F value Pr(&gt;F)\n## shape:color  1    0.0    0.00       0      1\n## Residuals   11   30.5    2.77<\/code><\/pre>\n<p>You look at your data, as you were taught to do, and it really does seems like the effect of color <em>is not<\/em> moderated by shape (and vice versa):\n<img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_emmeans_files\/figure-html\/plot_data-1.png\" width=\"672\" \/><\/p>\n<p>But what does this mean? <strong>Can you infer that there isn\u2019t interaction?<\/strong> Are the two simple effects of color truly identical?<\/p>\n<p>Classical statistics has no answer for us here - when the <em>p<\/em>-value is less than alpha (typically 5%) we can reject the null hypothesis, but when <strong><em>p<\/em> &gt; .05<\/strong>, even a lot bigger than 5%, classical (frequentists) statistics <strong>do not allow to infer that the null is true<\/strong>. For this, we need to go Bayesian!<\/p>\n<\/div>\n<div id=\"going-bayesian\" class=\"section level1\">\n<h1>Going Bayesian<\/h1>\n<p>One of the (many) strengths of Bayesian statistics is its ability to support the null hypothesis. Let us fit a <strong>Bayesian mixed model equivalent to the repeated measures ANOVA<\/strong> above, manually specifying weakly informative priors on its effects:<\/p>\n<pre class=\"r\"><code>library(rstanarm)\nstan_model &lt;- stan_lmer(RT ~ shape*color + (1 | ID), data = puzzles,\n                        prior = cauchy(0,c(0.707,0.707,0.5),          # as per Rouder et al., 2012\n                        prior_intercept = student_t(3,0,10),          # weakly informative\n                        prior_aux = exponential(.1),                  # weakly informative\n                        prior_covariance = decov(1,1,1,1))            # weakly informative<\/code><\/pre>\n<p>Using the fantastic <strong><code>emmeans<\/code><\/strong> package, we can explore and extract marginal effects and estimates from our fitted model. For example, we can estimate the main effect for color:<\/p>\n<pre class=\"r\"><code>c_color_main &lt;- pairs(emmeans(stan_model, ~ color))\nc_color_main<\/code><\/pre>\n<pre><code>##  contrast              estimate lower.HPD upper.HPD\n##  color - monochromatic   -0.894     -1.67    -0.147\n## \n## Point estimate displayed: median \n## HPD interval probability: 0.95<\/code><\/pre>\n<p>We can also estimate (based on posterior draws) the difference between the two simple effects for color between the levels of shape:<\/p>\n<pre class=\"r\"><code>em_color_simple &lt;- emmeans(stan_model, ~color * shape)\npairs(em_color_simple, by = &quot;shape&quot;) # simple effects for color<\/code><\/pre>\n<pre><code>## shape = round:\n##  contrast              estimate lower.HPD upper.HPD\n##  color - monochromatic   -0.898     -1.96     0.107\n## \n## shape = square:\n##  contrast              estimate lower.HPD upper.HPD\n##  color - monochromatic   -0.887     -1.89     0.212\n## \n## Point estimate displayed: median \n## HPD interval probability: 0.95<\/code><\/pre>\n<pre class=\"r\"><code>c_color_shape_interaction &lt;- contrast(em_color_simple, interaction = c(&quot;pairwise&quot;,&quot;pairwise&quot;))\nc_color_shape_interaction<\/code><\/pre>\n<pre><code>##  color_pairwise        shape_pairwise estimate lower.HPD upper.HPD\n##  color - monochromatic round - square   0.0108     -1.36      1.38\n## \n## Point estimate displayed: median \n## HPD interval probability: 0.95<\/code><\/pre>\n<p>As we can see, the simple effects are indeed similar, and the difference between them seems very close to 0. Can we quantify the evidence <em>for the null<\/em>?<\/p>\n<div id=\"quantifying-evidence-for-the-null\" class=\"section level2\">\n<h2>Quantifying Evidence for the Null<\/h2>\n<p>One way to quantify evidence in the Bayesian framework is to calculate a <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayes_factors.html\"><strong>Bayes factor<\/strong><\/a> - a measure of relative evidence in favor of one model over another. In our case, we would like to compare a model with an interaction to a model without an interaction. Though we could fit the model without the interaction and compare the two with <code>bayesfactor_models()<\/code>, we\u2019ll use a close approximation using the Savage-Dickey density ratio, which allows for more flexibility. To this end we can use (from <a href=\"https:\/\/github.com\/easystats\/bayestestR\">version 0.2.1, available on GitHub<\/a>) <code>describe_posterior()<\/code> to\u2026 well\u2026 describe our <code>emmeans<\/code> estimates\u2019 posterior distribution, and by comparing the density of the null value (here 0) between the prior and posterior, we can compute the Savage-Dickey Bayes factor! (Note that we will need to pass the original model via <code>bf_prior<\/code> to allow the extraction or prior draw.)<\/p>\n<pre class=\"r\"><code># combine all estimates of interest to one object:\nc_color_all &lt;- rbind(c_color_main,\n                     c_color_shape_interaction)\nc_color_all<\/code><\/pre>\n<pre><code>##  contrast              color_pairwise        shape_pairwise estimate lower.HPD\n##  color - monochromatic .                     .                -0.894     -1.67\n##  .                     color - monochromatic round - square    0.011     -1.36\n##  upper.HPD\n##     -0.147\n##      1.378\n## \n## Point estimate displayed: median \n## HPD interval probability: 0.95<\/code><\/pre>\n<pre class=\"r\"><code>describe_posterior(c_color_all,\n                   estimate = &quot;median&quot;, dispersion = TRUE,\n                   ci = .9, ci_method = &quot;hdi&quot;,\n                   test = c(&quot;bayesfactor&quot;),\n                   bf_prior = stan_model)<\/code><\/pre>\n<table>\n<thead>\n<tr class=\"header\">\n<th><\/th>\n<th align=\"left\">Parameter<\/th>\n<th align=\"right\">Median<\/th>\n<th align=\"right\">MAD<\/th>\n<th align=\"right\">CI<\/th>\n<th align=\"right\">CI_low<\/th>\n<th align=\"right\">CI_high<\/th>\n<th align=\"right\">BF<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"odd\">\n<td>2<\/td>\n<td align=\"left\">color - monochromatic, ., .<\/td>\n<td align=\"right\">-0.894<\/td>\n<td align=\"right\">0.395<\/td>\n<td align=\"right\">90<\/td>\n<td align=\"right\">-1.50<\/td>\n<td align=\"right\">-0.227<\/td>\n<td align=\"right\">3.128<\/td>\n<\/tr>\n<tr class=\"even\">\n<td>1<\/td>\n<td align=\"left\">., color - monochromatic, round - square<\/td>\n<td align=\"right\">0.011<\/td>\n<td align=\"right\">0.700<\/td>\n<td align=\"right\">90<\/td>\n<td align=\"right\">-1.16<\/td>\n<td align=\"right\">1.145<\/td>\n<td align=\"right\">0.272<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>These Bayes factors reveal that a model with a main effect for color is <strong>~3<\/strong> times more likely than a model without this effect, <strong>and<\/strong> that a model <em>without<\/em> an interaction is <strong>~1\/0.22 = 4.5<\/strong> times more likely than a model <em>with<\/em> an interaction! But\u2026 note that a Bayes factor of 4.5 is considered only <a href=\"https:\/\/easystats.github.io\/report\/articles\/interpret_metrics.html#bayes-factor-bf\">moderate evidence in favor of the null effect<\/a>. As we can see, <strong>a <em>p<\/em>-value of 1.0 does not necessarily mean the data strongly supports the null<\/strong>.<\/p>\n<p>Happy Bayesing!<\/p>\n<\/div>\n<div id=\"join-easystats\" class=\"section level2\">\n<h2>join easystats<\/h2>\n<p>Note that <a href=\"https:\/\/github.com\/easystats\"><strong><em>easystats<\/em><\/strong><\/a> is a new project in active development, and feedback, suggestions, comments are very welcome! Do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n<\/div>\n"},{"title":"Become a Bayesian master with bayestestR (0.2)","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_v2\/","pubDate":"Mon, 03 Jun 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_v2\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/bayestestR\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"bayestestr-0.2-is-here\" class=\"section level2\">\n<h2>bayestestR 0.2 is here!<\/h2>\n<p>As you might have heard from <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\">previous posts<\/a>, <a href=\"https:\/\/github.com\/orgs\/easystats\/people\">we<\/a> have recently started to collaborate around the new <a href=\"https:\/\/github.com\/easystats\"><strong>easystats project<\/strong><\/a>, a suite of packages designed to make your life easier. One of the packages, <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><strong>bayestestR<\/strong><\/a>, has just been updated on CRAN.<\/p>\n<p>And this release is <strong>so packed with new features<\/strong> and <strong>improvements<\/strong> that it would be impossible to present them all in one post! We have added the computation of different types of <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayes_factors.html\"><strong>Bayes factors (BF)<\/strong><\/a>, new <a href=\"https:\/\/github.com\/easystats\/see#bayestestr\"><strong>plotting methods<\/strong><\/a> (available in the <code>see<\/code> package), a new meta-function, <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/describe_posterior.html\"><code>describe_posterior<\/code><\/a>, that computes <strong>everything at once<\/strong>, and more\u2026<\/p>\n<p>We also improved the <strong>documentation<\/strong>, with new <strong>tutorials<\/strong> and <strong>articles<\/strong> so that Bayesian analysis can hold no secrets from you. Check them out:<\/p>\n<div id=\"tutorials\" class=\"section level4\">\n<h4>Tutorials<\/h4>\n<ul>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayestestR.html\">Get Started with Bayesian Analysis<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/example1.html\">Example 1: Initiation to Bayesian models<\/a><\/li>\n<\/ul>\n<\/div>\n<div id=\"articles\" class=\"section level4\">\n<h4>Articles<\/h4>\n<ul>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/credible_interval.html\">Credible Intervals (CIs)<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/probability_of_direction.html\">Probability of Direction (pd)<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/region_of_practical_equivalence.html\">Region of Practical Equivalence (ROPE)<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/bayes_factors.html\">Bayes Factors (BF)<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/indicesEstimationComparison.html\">Comparison of Point-Estimates<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/indicesExistenceComparison.html\">Comparison of Indices of Effect Existence<\/a><\/li>\n<li><a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/guidelines.html\">Reporting Guidelines<\/a><\/li>\n<\/ul>\n<p>There are also some <a href=\"https:\/\/easystats.github.io\/bayestestR\/news\/index.html\"><strong>breaking changes<\/strong><\/a>, make sure you check them out!<\/p>\n<\/div>\n<\/div>\n<div id=\"join-the-team\" class=\"section level2\">\n<h2>Join the team<\/h2>\n<p>You\u2019ve spotted <strong>an error<\/strong>, <strong>a bug<\/strong>, <strong>a typo in the documentation<\/strong>? Please help us by opening an <a href=\"https:\/\/github.com\/easystats\/bayestestR\/issues\">issue<\/a> or by making a pull request. There is definitely room for improvement. Feel free to let us know how we could further improve this package!<\/p>\n<p>Also note that <em>easystats<\/em> is a new project in active development. So don\u2019t hesitate to contact us if <strong>you want to get involved :)<\/strong> (you can send one of <a href=\"https:\/\/github.com\/orgs\/easystats\/people\">us<\/a> an email saying, for example, <strong>\u201cleeet me iiiin\u201d<\/strong>)<\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"The 'see' package: beautiful figures for easystats","link":"https:\/\/easystats.github.io\/blog\/posts\/see_presentation\/","pubDate":"Mon, 27 May 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/see_presentation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/see\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<div id=\"the-see-package\" class=\"section level2\">\n<h2>The see package<\/h2>\n<p><a href=\"https:\/\/github.com\/orgs\/easystats\/people\">We<\/a> have recently decided to collaborate around the new <a href=\"https:\/\/github.com\/easystats\"><strong>easystats project<\/strong><\/a>, a set of packages designed to make your life easier. This project encompasses several packages, devoted for instance to <a href=\"https:\/\/github.com\/easystats\/insight\">model access<\/a> or <a href=\"https:\/\/github.com\/easystats\/bayestestR\">Bayesian analysis<\/a>, <a href=\"https:\/\/github.com\/easystats\/performance\">indices of model performance<\/a> or <a href=\"https:\/\/github.com\/easystats\/see\">visualisation<\/a>.<\/p>\n<p><strong><em>Without further ado, please let us introduce the latest addition to the easyverse; the see package!<\/em><\/strong><\/p>\n<p>Essentially, <a href=\"https:\/\/github.com\/easystats\/see\"><code>see<\/code><\/a> is the visualisation companion to other functions and packages in <strong>easystats<\/strong>. See the <strong>list of functions<\/strong> <a href=\"https:\/\/easystats.github.io\/see\/reference\/index.html\">here<\/a>. However, it also includes some nice themes and geoms:<\/p>\n<\/div>\n<div id=\"examples\" class=\"section level2\">\n<h2>Examples<\/h2>\n<ul>\n<li><strong>Better looking points<\/strong> with <strong>modern theme<\/strong> and <strong>flat design colours<\/strong><\/li>\n<\/ul>\n<pre class=\"r\"><code>library(see)\nlibrary(ggplot2)\n\nggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) +\n  geom_point2(size=4, alpha=0.5) +\n  scale_color_flat_d() +\n  theme_modern()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/see_presentation_files\/figure-html\/unnamed-chunk-3-1.png\" width=\"672\" \/><\/p>\n<ul>\n<li><strong>Violin plot<\/strong> with <strong>blackboard theme<\/strong> and <strong>material design colours<\/strong><\/li>\n<\/ul>\n<pre class=\"r\"><code>ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + \n  geom_violindot(fill_dots = &quot;white&quot;) + \n  scale_fill_material_d() +\n  theme_blackboard()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/see_presentation_files\/figure-html\/unnamed-chunk-4-1.png\" width=\"672\" \/><\/p>\n<ul>\n<li><strong>Abyss theme<\/strong><\/li>\n<\/ul>\n<pre class=\"r\"><code>library(bayestestR)\nlibrary(rstanarm)\n\nmodel &lt;- rstanarm::stan_glm(mpg ~ wt + gear + cyl + disp, data = mtcars)\n\nresult &lt;- equivalence_test(model, ci = c(.89, .95))\n\nplot(result) +\n  theme_abyss() +\n  scale_fill_flat()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/see_presentation_files\/figure-html\/unnamed-chunk-6-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>There is definitely room for improvement, and some new exciting features are already planned. Feel free to let us know how we could further improve this package!<\/p>\n<p>To conclude, note that <em>easystats<\/em> is a new project in active development. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"A perfectly normally distributed sample: another post?","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_distribution\/","pubDate":"Mon, 13 May 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_distribution\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>Recently, we published <a href=\"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_rnorm_perfect\/\">a post<\/a> presenting a small convenience function, from the <a href=\"https:\/\/github.com\/easystats\/bayestestR\">bayestestR package<\/a>. This function, named <code>rnorm_perfect<\/code>, generated an empirical distribution (<em>i.e.<\/em>, a vector of values) as close as possible to a desired distribution, in this case the <strong>normal distribution<\/strong>.<\/p>\n<p>It worked like this:<\/p>\n<pre class=\"r\"><code># Generate a perfect sample\nx &lt;- rnorm_perfect(n = 100, mean = 0, sd = 1)\n\n# Visualise it\nlibrary(tidyverse)\n\nx %&gt;% \n  density() %&gt;%  # Compute density function\n  as.data.frame() %&gt;% \n  ggplot(aes(x=x, y=y)) +\n  geom_line()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_distribution_files\/figure-html\/unnamed-chunk-3-1.png\" width=\"672\" \/><\/p>\n<p>This function\u2019s name was initially chosen because of its proximity (argument-wise) with its random counterpart <code>rnorm<\/code> (it has the same arguments, the same order and the same output type). However, we <a href=\"https:\/\/github.com\/easystats\/bayestestR\/issues\/86\">quickly realised<\/a> this this name was not perfect (<em>no pun intended<\/em>), as indeed the obtained distribution was not <em>random<\/em> (and the <code>r<\/code> in <code>rnorm<\/code> stands for <em>random<\/em>).<\/p>\n<p>Thus, after discussion, we decided to change it to <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/distribution.html\"><code>distribution_normal<\/code><\/a>. We also used that opportunity to add other types of \u201cperfect\u201d distributions:<\/p>\n<pre class=\"r\"><code># Generate a perfect sample\nx &lt;- distribution_beta(n = 100, 6, 2)\n\nx %&gt;% \n  density() %&gt;% \n  as.data.frame() %&gt;% \n  ggplot(aes(x=x, y=y)) +\n  geom_line()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_distribution_files\/figure-html\/unnamed-chunk-4-1.png\" width=\"672\" \/><\/p>\n<p>Interestingly, a few days before this update, we received a small email asking:<\/p>\n<blockquote>\n<p>Hi, I saw your blog post and wonder how you define a perfectly normal distribution.<\/p>\n<\/blockquote>\n<p>We responded:<\/p>\n<blockquote>\n<p>that\u2019s actually a good question. I would say an empirical sample having characteristics as close as possible to a canonic Gaussian distribution.<\/p>\n<\/blockquote>\n<p>After an (ironic?) <em>\u201cThanks, most helpful!\u201d<\/em>, <a href=\"https:\/\/xianblog.wordpress.com\/2019\/05\/09\/a-perfectly-normally-distributed-sample\/\">this blog post<\/a> got published, which emphasize on the irrelevance of the <code>r<\/code> prefix in the function name. Thanks to some of the good points raised in this post, we\u2019ve felt the need to update users on this function.<\/p>\n<p>Thus, please note that the <code>rnorm_perfect<\/code> name will be deprecated in the next version, and ultimately removed to avoid further confusion :)<\/p>\n<div id=\"any-other-suggestions\" class=\"section level2\">\n<h2>Any other suggestions?<\/h2>\n<p>Don\u2019t forget, the <a href=\"https:\/\/github.com\/easystats\">easystats project<\/a> (that includes <code>bayestestR<\/code>) is very open to contributions! Remember that you can always <a href=\"https:\/\/github.com\/easystats\/bayestestR\/issues\">make suggestions<\/a> and contribute to the package, to actually help improving it, with the spirit of collaboration, and in the tradition of open science ;)<\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get involved<\/h2>\n<p>Feel free to let us know how we could further improve this package! Also, note that <a href=\"https:\/\/github.com\/easystats\/easystats\"><em>easystats<\/em><\/a>, the project supporting <code>bayestestR<\/code> is in active development. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"Compute R2s and other performance indices for all your models!","link":"https:\/\/easystats.github.io\/blog\/posts\/performance_presentation\/","pubDate":"Tue, 30 Apr 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/performance_presentation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/performance\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<p>Indices of model <strong>performance<\/strong> (<em>i.e.<\/em>, model quality, goodness of fit, predictive accuracy etc.) are very important, both for model <em>comparison<\/em> and model <em>description<\/em> purposes. However, their computation or extraction for a wide variety of models can be complex.<\/p>\n<p><strong><em>To address this, please let us introduce the <\/em><\/strong> <a href=\"https:\/\/github.com\/easystats\/performance\"><strong><code>performance<\/code><\/strong><\/a> <strong><em>package!<\/em><\/strong><\/p>\n<div id=\"performance\" class=\"section level2\">\n<h2>performance<\/h2>\n<p><a href=\"https:\/\/github.com\/orgs\/easystats\/people\">We<\/a> have recently decided to collaborate around the new <a href=\"https:\/\/github.com\/easystats\"><strong>easystats project<\/strong><\/a>, a set of packages designed to make your life <em>easier<\/em> (currently WIP). This project encompasses several packages, devoted for instance to <a href=\"https:\/\/github.com\/easystats\/insight\">model access<\/a> or <a href=\"https:\/\/github.com\/easystats\/bayestestR\">Bayesian analysis<\/a>, as well as <a href=\"https:\/\/github.com\/easystats\/performance\">indices of model performance<\/a>.<\/p>\n<p>The goal of <a href=\"https:\/\/github.com\/easystats\/performance\"><code>performance<\/code><\/a> is to provide lightweight tools to <strong>assess and check the quality of your model<\/strong>. It includes functions such as <a href=\"https:\/\/easystats.github.io\/performance\/reference\/r2.html\"><code>R2<\/code><\/a> for many models (including logistic, mixed and Bayesian models), <a href=\"https:\/\/easystats.github.io\/performance\/reference\/icc.html\"><code>ICC<\/code><\/a> or helpers to check <a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_convergence.html\"><code>convergence<\/code><\/a>, <a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_overdispersion.html\"><code>overdipsersion<\/code><\/a> or <a href=\"https:\/\/easystats.github.io\/performance\/reference\/check_zeroinflation.html\"><code>zero-inflation<\/code><\/a>. See the <strong>list of functions<\/strong> <a href=\"https:\/\/easystats.github.io\/performance\/reference\/index.html\">here<\/a>.<\/p>\n<p><code>performance<\/code> can be installed as follows:<\/p>\n<pre class=\"r\"><code>install.packages(&quot;performance&quot;)  # Install the package\nlibrary(performance)  # Load it<\/code><\/pre>\n<\/div>\n<div id=\"examples\" class=\"section level2\">\n<h2>Examples<\/h2>\n<div id=\"mixed-models\" class=\"section level3\">\n<h3>Mixed Models<\/h3>\n<p>First, we calculate the r-squared value and intra-class correlation coefficient (ICC) for a mixed model, using <a href=\"https:\/\/easystats.github.io\/performance\/reference\/r2.html\"><strong>r2()<\/strong><\/a> and <a href=\"https:\/\/easystats.github.io\/performance\/reference\/icc.html\"><strong>icc()<\/strong><\/a>. <code>r2()<\/code> internally calls the appropriate function for the given model. In case of mixed models this will be <a href=\"https:\/\/easystats.github.io\/performance\/reference\/r2_nakagawa.html\"><strong>r2_nakagawa()<\/strong><\/a>. <code>r2_nakagawa()<\/code> computes the marginal and conditional r-squared values, while <code>icc()<\/code> calculates an adjusted and conditional ICC, both based on the proposals from <em>Nakagawa et al.\u00a02017<\/em>. For more details on the computation of the variances, see <a href=\"https:\/\/easystats.github.io\/insight\/reference\/get_variance.html\"><strong>get_variance()<\/strong><\/a>.<\/p>\n<pre class=\"r\"><code># Load the lme4 package\nlibrary(lme4)\n\n# Fit a mixed model\nmodel &lt;- lmer(Sepal.Width ~ Petal.Length + (1|Species), data = iris)\n\n# compute R2, based on Nakagawa et al. 2017\nr2(model)<\/code><\/pre>\n<pre><code>&gt; # R2 for Mixed Models\n&gt; \n&gt;   Conditional R2: 0.913\n&gt;      Marginal R2: 0.216<\/code><\/pre>\n<pre class=\"r\"><code># compute intra-class correlation coefficient (ICC)\nicc(model)<\/code><\/pre>\n<pre><code>&gt; # Intraclass Correlation Coefficient\n&gt; \n&gt;      Adjusted ICC: 0.889\n&gt;   Conditional ICC: 0.697<\/code><\/pre>\n<p>Now let\u2019s compute <strong>all available<\/strong> indices of performance appropriate for a given model. This can be done via the <a href=\"https:\/\/easystats.github.io\/performance\/reference\/model_performance.html\"><strong>model_performance()<\/strong><\/a>.<\/p>\n<pre class=\"r\"><code># Compute all performance indices\nmodel_performance(model)<\/code><\/pre>\n<pre><code>&gt; # Indices of model performance\n&gt; \n&gt; AIC    |    BIC | R2 (cond.) | R2 (marg.) |  ICC | RMSE | Sigma\n&gt; ---------------------------------------------------------------\n&gt; 106.99 | 119.03 |       0.91 |       0.22 | 0.89 | 0.31 |  0.32<\/code><\/pre>\n<\/div>\n<div id=\"bayesian-mixed-models\" class=\"section level3\">\n<h3>Bayesian Mixed Models<\/h3>\n<p>For Bayesian mixed models, we have the same features available (r-squared, ICC, \u2026). In this example, we focus on the output from <code>model_performance()<\/code> only.<\/p>\n<pre class=\"r\"><code># Load the rstanarm package\nlibrary(rstanarm)\n\n# Fit a Bayesian mixed model\nmodel &lt;- stan_glmer(Sepal.Width ~ Petal.Length + (1|Species), data = iris)\n\n# Compute performance indices\nmodel_performance(model)<\/code><\/pre>\n<pre><code>&gt; # Indices of model performance\n&gt; \n&gt; ELPD   | ELPD_SE | LOOIC | LOOIC_SE |  WAIC |   R2 | R2 (marg.) | R2 (adj.) | RMSE | Sigma\n&gt; ------------------------------------------------------------------------------------------\n&gt; -43.71 |   10.14 | 87.43 |    20.28 | 87.38 | 0.46 |       0.68 |      0.45 | 0.31 |  0.32<\/code><\/pre>\n<ul>\n<li><strong>Don\u2019t forget to check out the<\/strong> <a href=\"https:\/\/easystats.github.io\/performance\/\"><strong>documentation here<\/strong><\/a> <strong>for more!<\/strong><\/li>\n<\/ul>\n<p>More details about <code>performance<\/code>\u2019s features are comming soon, stay tuned ;)<\/p>\n<\/div>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>There is definitely room for improvement, and some new exciting features are already planned. Feel free to let us know how we could further improve this package!<\/p>\n<p>To conclude, note that <em>easystats<\/em> is a new project in active development. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"How to easily generate a perfectly normal distribution","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_rnorm_perfect\/","pubDate":"Wed, 24 Apr 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_rnorm_perfect\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>Many times, for instance when teaching, I needed to quickly and simply generate a <strong>perfectly normally distributed sample<\/strong> to illustrate or show some of its characteristics.<\/p>\n<p>This is now very easy to do with the new <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><code>bayestestR<\/code><\/a> package, which includes the <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/rnorm_perfect.html\"><code>rnorm_perfect<\/code><\/a> function. This function is very similar to the classic <code>rnorm<\/code> (same arguments), with the difference that the generated sample is <em>perfectly<\/em> normal.<\/p>\n<div id=\"example\" class=\"section level2\">\n<h2>Example<\/h2>\n<p><code>bayestestR<\/code> can be installed as follows:<\/p>\n<pre class=\"r\"><code>install.packages(&quot;bayestestR&quot;)  # Install the package\nlibrary(bayestestR)  # Load it<\/code><\/pre>\n<pre class=\"r\"><code># Generate a perfect sample\nx &lt;- rnorm_perfect(n = 100, mean = 0, sd = 1)\n\n# Visualise it\nlibrary(tidyverse)\n\nx %&gt;% \n  density() %&gt;%  # Compute density function\n  as.data.frame() %&gt;% \n  ggplot(aes(x=x, y=y)) +\n  geom_line()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_rnorm_perfect_files\/figure-html\/unnamed-chunk-4-1.png\" width=\"672\" \/><\/p>\n<p>We can also easily color some of the parts of the curve, for instance, the observations lying beyond +2 standard deviations.<\/p>\n<pre class=\"r\"><code>x %&gt;% \n  density() %&gt;%  # Compute density function\n  as.data.frame() %&gt;% \n  mutate(outlier = ifelse(x &gt; 2, &quot;Extreme&quot;, &quot;Not extreme&quot;)) %&gt;% \n  ggplot(aes(x=x, y=y, fill=outlier)) +\n  geom_ribbon(aes(ymin=0, ymax=y)) +\n  theme_classic()<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_rnorm_perfect_files\/figure-html\/unnamed-chunk-5-1.png\" width=\"672\" \/><\/p>\n<\/div>\n<div id=\"bayestestr-and-easystats\" class=\"section level2\">\n<h2>bayestestR and easystats<\/h2>\n<p>More details about <code>bayestestR<\/code>\u2019s features are comming soon, stay tuned ;)<\/p>\n<ul>\n<li><strong>Don\u2019t forget to check out the<\/strong> <a href=\"https:\/\/github.com\/easystats\/bayestestR#documentation\"><strong>documentation here<\/strong><\/a> <strong>for more!<\/strong><\/li>\n<\/ul>\n<p>Feel free to let us know how we could further improve this package! Also, note that <a href=\"https:\/\/github.com\/easystats\/easystats\"><em>easystats<\/em><\/a>, the project supporting <code>bayestestR<\/code> is in active development. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"Describe and understand Bayesian models and posteriors using bayestestR","link":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_presentation\/","pubDate":"Mon, 15 Apr 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/bayestestr_presentation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><img src=\"https:\/\/github.com\/easystats\/bayestestR\/raw\/master\/man\/figures\/logo.png\" width=\"200px\" \/><\/p>\n<p>The <strong>Bayesian framework<\/strong> is quickly gaining popularity among scientists, leading to the growing popularity of packages to fit Bayesian models, such as <a href=\"https:\/\/github.com\/stan-dev\/rstanarm\"><code>rstanarm<\/code><\/a> or <a href=\"https:\/\/github.com\/paul-buerkner\/brms\"><code>brms<\/code><\/a>. However, extracting summary indices from these models to report them in your manuscript can be quite challenging, especially for new users.<\/p>\n<p><strong><em>To address this, please let us introduce<\/em><\/strong> <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><strong><code>bayestestR<\/code><\/strong><\/a><strong>!<\/strong><\/p>\n<div id=\"bayestestr\" class=\"section level2\">\n<h2>bayestestR<\/h2>\n<p><a href=\"https:\/\/github.com\/orgs\/easystats\/people\">We<\/a> have recently decided to collaborate around the new <a href=\"https:\/\/github.com\/easystats\"><strong>easystats<\/strong><\/a> <strong>project<\/strong>, a set of packages designed to make your life <em>easier<\/em> (currently very WIP). As we are also Bayesian enthusiasts, we decided to focus on the development of a package devoted to Bayesian post-processing.<\/p>\n<p>The goal of <a href=\"https:\/\/github.com\/easystats\/bayestestR\"><code>bayestestR<\/code><\/a> is to provide lightweight tools to help <strong>processing and understanding Bayesian models and posterior distributions<\/strong>. It includes several functions used to report and characterise them, such as <a href=\"https:\/\/github.com\/easystats\/bayestestR#highest-density-interval-hdi---the-credible-interval-ci\"><strong>Highest Density Interval (<code>hdi<\/code>)<\/strong><\/a>, the <a href=\"https:\/\/github.com\/easystats\/bayestestR#map-estimate\"><strong>highest Maximum A Posteriori (<code>MAP<\/code>)<\/strong><\/a> or functions to find a suitable <a href=\"https:\/\/github.com\/easystats\/bayestestR#find-ropes-appropriate-range\"><strong>ROPE range<\/strong><\/a>, compute the <a href=\"https:\/\/github.com\/easystats\/bayestestR#rope\"><strong>ROPE percentage<\/strong><\/a> or do an <a href=\"https:\/\/github.com\/easystats\/bayestestR#equivalence-test\"><strong>Equivalence Test<\/strong><\/a>. It also includes more exploratory indices, such as the <a href=\"https:\/\/github.com\/easystats\/bayestestR#probability-of-direction-pd\"><strong>Probability of Direction (<code>pd<\/code>)<\/strong><\/a>, a <a href=\"https:\/\/easystats.github.io\/bayestestR\/articles\/guidelines.html\">numeric <em>equivalent<\/em><\/a> of the frequentist <em>p<\/em> value.<\/p>\n<p><code>bayestestR<\/code> can be installed as follows:<\/p>\n<pre class=\"r\"><code>install.packages(&quot;bayestestR&quot;)  # Install the package\nlibrary(bayestestR)  # Load it<\/code><\/pre>\n<\/div>\n<div id=\"example\" class=\"section level2\">\n<h2>Example<\/h2>\n<p>Let\u2019s check whether the effects of my Bayesian regression can be considered as non-negligible. This can be done via the <a href=\"https:\/\/easystats.github.io\/bayestestR\/reference\/equivalence_test.html#details\"><strong>equivalence test<\/strong><\/a>.<\/p>\n<pre class=\"r\"><code># Load the rstanarm package\nlibrary(rstanarm)\n\n# Fit a Bayesian model\nmodel &lt;- stan_glm(mpg ~ wt + cyl + gear + am + hp, data = mtcars)<\/code><\/pre>\n<pre class=\"r\"><code># Do the test\nequivalence_test(model)<\/code><\/pre>\n<pre><code>## # Test for Practical Equivalence\n## \n##   ROPE: [-0.60 0.60]\n## \n## Parameter   |        H0 | inside ROPE |       89% HDI\n## -----------------------------------------------------\n## (Intercept) |  Rejected |      0.00 % | [27.11 47.28]\n## wt          |  Rejected |      0.00 % | [-4.21 -1.05]\n## cyl         | Undecided |     37.29 % | [-1.92  0.29]\n## gear        | Undecided |     41.56 % | [-2.30  1.74]\n## am          | Undecided |     20.13 % | [-1.29  4.73]\n## hp          |  Accepted |    100.00 % | [-0.05  0.00]<\/code><\/pre>\n<p>Results can also be plotted, to get a better impression of the posterior distributions and the ROPE-coverage.<\/p>\n<pre class=\"r\"><code># Do the test and plot results\nplot(equivalence_test(model))<\/code><\/pre>\n<p><img src=\"https:\/\/easystats.github.io\/blog\/blog\/posts\/bayestestR_presentation_files\/figure-html\/unnamed-chunk-8-1.png\" width=\"672\" \/><\/p>\n<ul>\n<li><strong>Don\u2019t forget to check out the<\/strong> <a href=\"https:\/\/github.com\/easystats\/bayestestR#documentation\"><strong>documentation here<\/strong><\/a> <strong>for more!<\/strong><\/li>\n<\/ul>\n<p>More details about <code>bayestestR<\/code>\u2019s features are comming soon, stay tuned ;)<\/p>\n<\/div>\n<div id=\"get-involved\" class=\"section level2\">\n<h2>Get Involved<\/h2>\n<p>There is definitely room for improvement, and some new exciting features are already planned (BayesFactor objects support, better visualisation methods, etc.). Feel free to let us know how we could further improve this package!<\/p>\n<p>To conclude, note that <em>easystats<\/em> is a new project in active development. Thus, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"A unified syntax for accessing models' information","link":"https:\/\/easystats.github.io\/blog\/posts\/insight_presentation\/","pubDate":"Tue, 02 Apr 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/insight_presentation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>The richness and variety of packages for building and fitting statistical models in R is absolutely astonishing and contributes to the language\u2019s popularity. However, <strong>this diversity makes it hard for developpers<\/strong> that want to create tools that work with different types of models. Indeed, the way to access models\u2019 internal information (such as <strong>parameters names<\/strong>, <strong>formulae<\/strong>, <strong>data<\/strong>, etc.) is <strong>not unified<\/strong>, forcing the developers to spend some time figuring out how to do it for each model type.<\/p>\n<p><strong>This time is over!<\/strong><\/p>\n<div id=\"insight\" class=\"section level2\">\n<h2>Insight<\/h2>\n<p>Recently, <a href=\"https:\/\/github.com\/orgs\/easystats\/people\">we<\/a> have decided to collaborate around the new <a href=\"https:\/\/github.com\/easystats\">easystats<\/a> project, a set of packages designed to make your life easier (currently very work in progress). However, in order to create these packages and functions, <strong>we needed a basis<\/strong>, a stable cornerstone, that would allow the unified way of accessing models information.<\/p>\n<p>And <a href=\"https:\/\/github.com\/easystats\/insight\"><strong><code>insight<\/code><\/strong><\/a> was born.<\/p>\n<p>The goal of insight is to provide tools to help an <strong>easy, intuitive and consistent accesss<\/strong> to information contained in various models. Indeed, although there are generic functions to get information and data from models, many modelling-functions from different packages do not provide such methods to access these information. The insight package aims at closing this gap by providing functions that work for (almost) any model.<\/p>\n<p><code>insight<\/code> can be installed as follows:<\/p>\n<pre class=\"r\"><code>install.packages(&quot;insight&quot;)  # Install from CRAN\nlibrary(insight)  # Load the package<\/code><\/pre>\n<\/div>\n<div id=\"example\" class=\"section level2\">\n<h2>Example<\/h2>\n<p>Let\u2019s see how it works on a very simple regression model:<\/p>\n<pre class=\"r\"><code>model &lt;- lm(Sepal.Length ~ Species, data=iris)<\/code><\/pre>\n<ul>\n<li>Find the <strong>parameters<\/strong>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>find_parameters(model)<\/code><\/pre>\n<pre><code>&gt; $conditional\n&gt; [1] &quot;(Intercept)&quot;       &quot;Speciesversicolor&quot; &quot;Speciesvirginica&quot;<\/code><\/pre>\n<ul>\n<li>Find the <strong>outcome\u2019s name<\/strong>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>find_response(model)<\/code><\/pre>\n<pre><code>&gt; [1] &quot;Sepal.Length&quot;<\/code><\/pre>\n<ul>\n<li>Find the <strong>formula<\/strong>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>find_formula(model)<\/code><\/pre>\n<pre><code>&gt; $conditional\n&gt; Sepal.Length ~ Species\n&gt; \n&gt; attr(,&quot;class&quot;)\n&gt; [1] &quot;insight_formula&quot; &quot;list&quot;<\/code><\/pre>\n<ul>\n<li>Find the <strong>variables in the formula<\/strong>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>find_variables(model)<\/code><\/pre>\n<pre><code>&gt; $response\n&gt; [1] &quot;Sepal.Length&quot;\n&gt; \n&gt; $conditional\n&gt; [1] &quot;Species&quot;<\/code><\/pre>\n<ul>\n<li>Find the <strong>algorithm<\/strong>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>find_algorithm(model)<\/code><\/pre>\n<pre><code>&gt; $algorithm\n&gt; [1] &quot;OLS&quot;<\/code><\/pre>\n<p>Moreover, <code>insight<\/code> also includes functions to deal with <strong>Bayesian<\/strong> (<code>get_priors()<\/code>) and <strong>mixed models<\/strong> (<code>find_random()<\/code>).<\/p>\n<p><code>insight<\/code> works on a high number of models (see the <a href=\"https:\/\/github.com\/easystats\/insight\/blob\/master\/README.md#list-of-supported-packages-and-models\"><strong>list here<\/strong><\/a>), and <strong>continue to grow thanks to your suggestions<\/strong>! As <em>easystats<\/em> is a new project in active development, do not hesitate to contact us if <strong>you want to get involved :)<\/strong><\/p>\n<ul>\n<li><strong>Check out our other blog posts<\/strong> <a href=\"https:\/\/easystats.github.io\/blog\/posts\/\"><strong><em>here<\/em><\/strong><\/a>!<\/li>\n<\/ul>\n<\/div>\n"},{"title":"The end of errors in ANOVA reporting","link":"https:\/\/easystats.github.io\/blog\/posts\/report_anova\/","pubDate":"Thu, 28 Mar 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/report_anova\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p><strong>Psychological science is still massively using analysis of variance (ANOVA)<\/strong>. Despite its relative simplicity, I am very often confronted to <strong>errors in its reporting<\/strong>, for instance in student\u2019s theses or manuscripts, or even published papers (See the excellent <a href=\"http:\/\/statcheck.io\/\">statcheck<\/a> to quickly check the stats of a paper). Beyond the incomplete or just wrong reporting, one can find a tremendous amount of genuine errors (that could influence the results and their interpretation). This error proneness can be at least partly explained by the fact that copy\/pasting the (appropriate) values of any statistical software and formatting them textually is a very annoying and tedious process.<\/p>\n<p><strong>How to end it?<\/strong><\/p>\n<p>We believe that this could be solved (at least, partially) by the <strong>default implementation of current best practices of statistical reporting<\/strong>. A tool that automatically transforms a statistical result into a copy\/pastable text. Of course, this automation cannot be suitable for each and every advanced usage, but could be satisfying for a substantial proportion of use cases. <strong>Implementing this unified, end-user oriented pipeline is the goal of the <a href=\"https:\/\/github.com\/easystats\/report\">report<\/a> package.<\/strong><\/p>\n<div id=\"install-report\" class=\"section level1\">\n<h1>Install report<\/h1>\n<p><code>report<\/code> is part of the new <a href=\"https:\/\/github.com\/easystats\"><em>easystats<\/em><\/a> suite of packages. However, as it is not (yet) on CRAN, you\u2019ll need to install it directly from <a href=\"https:\/\/github.com\/easystats\/report\">github<\/a>.<\/p>\n<pre class=\"r\"><code>devtools::install_github(&quot;easystats\/report&quot;)  # Install the latest psycho version\n\nlibrary(report)  # Load the package\nlibrary(dplyr)<\/code><\/pre>\n<\/div>\n<div id=\"fit-an-anova\" class=\"section level1\">\n<h1>Fit an anova<\/h1>\n<p>Let\u2019s start by doing a traditional ANOVA with <em>Sepal.Length<\/em> (the length of the sepals of some flowers) as dependent variable, and the <em>Species<\/em> as categorical predictor.<\/p>\n<pre class=\"r\"><code>aov_results &lt;- aov(Sepal.Length ~ Species, data=iris)  # Fit the ANOVA<\/code><\/pre>\n<\/div>\n<div id=\"formatted-output\" class=\"section level1\">\n<h1>Formatted output<\/h1>\n<p>The <code>report<\/code> package include a single function, namely <code>report()<\/code>, that can be applied to an ANOVA object to format its content.<\/p>\n<pre class=\"r\"><code>report(aov_results)<\/code><\/pre>\n<p>It formats the results, computes the partial omega-squared as an index of effect size (better than the eta2, see <a href=\"https:\/\/academic.oup.com\/hcr\/article-abstract\/28\/4\/612\/4331349\">Levine et al.\u00a02002<\/a>, <a href=\"http:\/\/journals.sagepub.com\/doi\/abs\/10.1177\/0013164404264848\">Pierce et al.\u00a02004<\/a>) as well as its <a href=\"http:\/\/imaging.mrc-cbu.cam.ac.uk\/statswiki\/FAQ\/effectSize\">interpretation<\/a> and presents the results in an APA-compatible way.<\/p>\n<p>Note that a table-output is also available:<\/p>\n<pre class=\"r\"><code>aov_results %&gt;% \n  report() %&gt;% \n  to_table()<\/code><\/pre>\n<\/div>\n<div id=\"evolution\" class=\"section level1\">\n<h1>Evolution<\/h1>\n<p>Of course, these reporting standards should change, depending on new expert recommendations or official guidelines. <strong>The goal of this package is to flexibly adaptive to new changes and good practices evolution<\/strong>. Therefore, if you have any advices, opinions or such, we encourage you to either let us know by opening an <a href=\"https:\/\/github.com\/easystats\/report\/issues\">issue<\/a>, or even better, try to implement them yourself by <a href=\"https:\/\/github.com\/easystats\/report\/blob\/master\/.github\/CONTRIBUTING.md\">contributing<\/a> to the code.<\/p>\n<\/div>\n"},{"title":"Formatted correlation output with effect sizes","link":"https:\/\/easystats.github.io\/blog\/posts\/report_correlation\/","pubDate":"Mon, 25 Mar 2019 00:00:00 +0000","guid":"https:\/\/easystats.github.io\/blog\/posts\/report_correlation\/","description":"\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/header-attrs\/header-attrs.js\"><\/script>\n<link href=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.css\" rel=\"stylesheet\" \/>\n<script src=\"https:\/\/easystats.github.io\/blog\/blog\/rmarkdown-libs\/anchor-sections\/anchor-sections.js\"><\/script>\n\n\n<p>One of the most time-consuming part of data analysis in science is the copy-pasting of specific values of some R output to a manuscript or a report. This task is frustrating, prone to errors, and increases the variability of statistical reporting. At the sime time, standardizing practices of what and how to report is crucial for reproducibility and clarity. <strong>The new <a href=\"https:\/\/github.com\/easystats\/report\">report<\/a> package was designed specifically to do this job<\/strong>.<\/p>\n<div id=\"install-report\" class=\"section level1\">\n<h1>Install report<\/h1>\n<p><code>report<\/code> is part of the new <a href=\"https:\/\/github.com\/easystats\"><em>easystats<\/em><\/a> suite of packages. However, as it is not (yet) on CRAN, you\u2019ll need to install it directly from <a href=\"https:\/\/github.com\/easystats\/report\">github<\/a>.<\/p>\n<pre class=\"r\"><code>devtools::install_github(&quot;easystats\/report&quot;)  # Install the latest psycho version\n\nlibrary(report)  # Load the package\nlibrary(dplyr)<\/code><\/pre>\n<\/div>\n<div id=\"do-a-correlation\" class=\"section level1\">\n<h1>Do a correlation<\/h1>\n<pre class=\"r\"><code>df &lt;- iris  # Load the traditional iris dataset into an object called df (for dataframe)\ncor_results &lt;- cor.test(df$Sepal.Length, df$Petal.Length)  # Compute a correlation and store its result<\/code><\/pre>\n<\/div>\n<div id=\"formatted-output\" class=\"section level1\">\n<h1>Formatted output<\/h1>\n<p>The <code>report<\/code> package include a single function, namely <code>report()<\/code>, that can be applied to a correlation to format its content.<\/p>\n<pre class=\"r\"><code>report(cor_results)<\/code><\/pre>\n<p>The formatted output includes the <strong>direction<\/strong>, <strong>effect size<\/strong> (interpreted by default using <strong><a href=\"https:\/\/easystats.github.io\/report\/articles\/interpret_metrics.html#correlation-r\">Cohen\u2019s (1988)<\/a><\/strong> rules of thumb) and <strong>confidence intervals<\/strong>. Now, you can just copy and paste this line into your report and focus on more important things.<\/p>\n<\/div>\n<div id=\"evolution\" class=\"section level1\">\n<h1>Evolution<\/h1>\n<p>Of course, these reporting standards should change, depending on new expert recommendations or official guidelines. <strong>The goal of this package is to flexibly adaptive to new changes and good practices evolution<\/strong>. Therefore, if you have any advices, opinions or such, we encourage you to either let us know by opening an <a href=\"https:\/\/github.com\/easystats\/report\/issues\">issue<\/a>, or even better, try to implement them yourself by <a href=\"https:\/\/github.com\/easystats\/report\/blob\/master\/.github\/CONTRIBUTING.md\">contributing<\/a> to the code.<\/p>\n<\/div>\n"}]}}