forked from easystats/parameters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
181 lines (126 loc) · 7.79 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
output:
github_document:
toc: false
fig_width: 10.08
fig_height: 6
tags: [r, reports]
vignette: >
\usepackage[utf8]{inputenc}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
dpi = 300,
tidy.opts = list(width.cutoff = 80),
fig.path = "man/figures/",
comment = "#>"
)
options(knitr.kable.NA = '',
digits = 1,
width = 80)
set.seed(333)
library(parameters)
```
# parameters <img src='man/figures/logo.png' align="right" height="139" />
[](https://doi.org/10.21105/joss.02445)
[](https://cran.r-project.org/package=parameters)
[](https://cranlogs.r-pkg.org/)
***Describe and understand your model's parameters!***
**parameters**' primary goal is to provide utilities for processing the parameters of various statistical models (see [here](https://easystats.github.io/insight/) for a list of supported models). Beyond computing *p-values*, *CIs*, *Bayesian indices* and other measures for a wide variety of models, this package implements features like *bootstrapping* of parameters and models, *feature reduction* (feature extraction and variable selection), or tools for data reduction like functions to perform cluster, factor or principal component analysis.
Another important goal of the **parameters** package is to facilitate and streamline the process of reporting results of statistical models, which includes the easy and intuitive calculation of standardized estimates or robust standard errors and p-values. **parameters** therefor offers a simple and unified syntax to process a large variety of (model) objects from many different packages.
## Installation
[](https://cran.r-project.org/package=parameters)
[](https://github.com/easystats/parameters/actions)
Run the following to install the stable release of **parameters** from CRAN:
```{r, warning=FALSE, message=FALSE, eval=FALSE}
install.packages("parameters")
```
Or this one to install the latest development version:
```{r, warning=FALSE, message=FALSE, eval=FALSE}
install.packages("remotes")
remotes::install_github("easystats/parameters")
```
## Documentation
[](https://easystats.github.io/parameters/)
[](https://easystats.github.io/blog/posts/)
[](https://easystats.github.io/parameters/reference/index.html)
Click on the buttons above to access the package [documentation](https://easystats.github.io/parameters/) and the [easystats blog](https://easystats.github.io/blog/posts/), and check-out these vignettes:
- [Summary of Model Parameters](https://easystats.github.io/parameters/articles/model_parameters.html)
- [Standardized Model Parameters](https://easystats.github.io/parameters/articles/model_parameters_standardized.html)
- [Robust Estimation of Standard Errors, Confidence Intervals and p-values](https://easystats.github.io/parameters/articles/model_parameters_robust.html)
- [Model Parameters and Missing Data](https://easystats.github.io/parameters/articles/model_parameters_mice.html)
- [Feature reduction (PCA, cMDS, ICA...)](https://easystats.github.io/parameters/articles/parameters_reduction.html)
- [Structural models (EFA, CFA, SEM...)](https://easystats.github.io/parameters/articles/efa_cfa.html)
- [Parameters selection](https://easystats.github.io/parameters/articles/parameters_selection.html)
- [A Practical Guide for Panel Data Analysis](https://easystats.github.io/parameters/articles/demean.html)
## Contributing and Support
In case you want to file an issue or contribute in another way to the package, please follow [this guide](https://github.com/easystats/parameters/blob/master/.github/CONTRIBUTING.md). For questions about the functionality, you may either contact us via email or also file an issue.
# Features
## Model's parameters description
<p><img src='man/figures/figure1.png' align="center" /></p>
The [`model_parameters()`](https://easystats.github.io/parameters/articles/model_parameters.html) function (that can be accessed via the `parameters()` shortcut) 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 [`broom::tidy()`](https://github.com/tidymodels/broom), with some notable differences:
- The column names of the returned data frame are *specific* to their content. For instance, the column containing the statistic is named following the statistic name, i.e., *t*, *z*, etc., instead of a generic name such as *statistic* (however, you can get standardized (generic) column names using [`standardize_names()`](https://easystats.github.io/insight/reference/standardize_names.html)).
- It is able to compute or extract indices not available by default, such as *p-values*, *CIs*, etc.
- It includes *feature engineering* capabilities, including parameters [bootstrapping](https://easystats.github.io/parameters/reference/bootstrap_parameters.html).
### Classical Regression Models
```{r, warning=FALSE, message=FALSE}
model <- lm(Sepal.Width ~ Petal.Length * Species + Petal.Width, data = iris)
# regular model parameters
model_parameters(model)
# standardized parameters
model_parameters(model, standardize = "refit")
```
### Mixed Models
```{r, warning=FALSE, message=FALSE}
library(lme4)
model <- lmer(Sepal.Width ~ Petal.Length + (1|Species), data = iris)
# model parameters with CI, df and p-values based on Wald approximation
model_parameters(model)
# model parameters with CI, df and p-values based on Kenward-Roger approximation
model_parameters(model, df_method = "kenward")
```
### Structural Models
Besides many types of regression models and packages, it also works for other types of models, such as [**structural models**](https://easystats.github.io/parameters/articles/efa_cfa.html) (EFA, CFA, SEM...).
```{r, warning=FALSE, message=FALSE}
library(psych)
model <- psych::fa(attitude, nfactors = 3)
model_parameters(model)
```
## Variable and parameters selection
<p><img src='man/figures/figure2.png' align="center" /></p>
[`select_parameters()`](https://easystats.github.io/parameters/articles/parameters_selection.html) can help you quickly select and retain the most relevant predictors using methods tailored for the model type.
```{r, warning=FALSE, message=FALSE}
library(dplyr)
lm(disp ~ ., data = mtcars) %>%
select_parameters() %>%
model_parameters()
```
## Miscellaneous
This packages also contains a lot of [other useful functions](https://easystats.github.io/parameters/reference/index.html):
### Describe a Distribution
```{r, warning=FALSE, message=FALSE}
data(iris)
describe_distribution(iris)
```
### Citation
In order to cite this package, please use the following citation:
* Lüdecke D, Ben-Shachar M, Patil I, Makowski D (2020). parameters: Extracting,
Computing and Exploring the Parameters of Statistical Models using R. _Journal of
Open Source Software_, *5*(53), 2445. doi: 10.21105/joss.02445
Corresponding BibTeX entry:
```
@Article{,
title = {parameters: Extracting, Computing and Exploring the Parameters of Statistical Models using {R}.},
volume = {5},
doi = {10.21105/joss.02445},
number = {53},
journal = {Journal of Open Source Software},
author = {Daniel Lüdecke and Mattan S. Ben-Shachar and Indrajeet Patil and Dominique Makowski},
year = {2020},
pages = {2445},
}
```