The richness and variety of packages for building and fitting statistical models in R is absolutely astonishing and contributes to the language’s popularity. However, this diversity makes it hard for developpers that want to create tools that work with different types of models. Indeed, the way to access models’ internal information (such as parameters names, formulae, data, etc.) is not unified, forcing the developers to spend some time figuring out how to do it for each model type.
This time is over!
Recently, we have decided to collaborate around the new easystats 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, we needed a basis, a stable cornerstone, that would allow the unified way of accessing models information.
insight was born.
The goal of insight is to provide tools to help an easy, intuitive and consistent accesss 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.
insight can be installed as follows:
install.packages("insight") # Install from CRAN library(insight) # Load the package
Let’s see how it works on a very simple regression model:
model <- lm(Sepal.Length ~ Species, data=iris)
- Find the parameters:
> $conditional >  "(Intercept)" "Speciesversicolor" "Speciesvirginica"
- Find the outcome’s name:
>  "Sepal.Length"
- Find the formula:
> $conditional > Sepal.Length ~ Species
- Find the variables in the formula:
> $response >  "Sepal.Length" > > $conditional >  "Species"
- Find the algorithm:
> $algorithm >  "OLS"
insight also includes functions to deal with Bayesian (
get_priors()) and mixed models (
insight works on a high number of models (see the list here), and continue to grow thanks to your suggestions! As easystats is a new project in active development, do not hesitate to contact us if you want to get involved 🙂
- Check out our other blog posts here!