Skip to content

Commit

Permalink
update table 1 #636 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
rempsyc committed Oct 4, 2023
1 parent 44d11e1 commit 1726625
Show file tree
Hide file tree
Showing 6 changed files with 815 additions and 137 deletions.
44 changes: 30 additions & 14 deletions papers/JOSE/paper.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,9 @@ outliers

Using the model-based outlier detection method, we identified a single outlier.

All `check_outliers()` output objects possess a `plot()` method, meaning it is also possible to visualize the outliers using the generic `plot()` function on the resulting outlier object after loading the {see} package.
Table 1 below summarizes which methods to use in which cases, and with what threshold. The recommended thresholds are the default thresholds.

```{r model_fig, fig.cap = "Visual depiction of outliers based on Cook's distance (leverage and standardized residuals), based on the fitted model."}
plot(outliers)
```

Table 1 below summarizes which methods to use in which cases, and with what threshold.

```{r, echo=FALSE}
```{r table1_prep, echo=FALSE}
df <- data.frame(
`Statistical Test` = c(
"Supported regression model",
Expand All @@ -216,13 +210,35 @@ df <- data.frame(
"**Multivariate**: Minimum Covariance Determinant (MCD)",
"**Univariate**: robust *z* scores (MAD)"),
`Recommended Threshold` = c(
"`qf(0.5, ncol(x), nrow(x) - ncol(x))` (or 0.7 for Pareto)",
"`qchisq(p = 1 - 0.001, df = ncol(x))`",
"`qnorm(p = 1 - 0.001 / 2)`, ~ 3.29")
"_qf(0.5, ncol(x), nrow(x) - ncol(x))_ (or 0.7 for Pareto)",
"_qchisq(p = 1 - 0.001, df = ncol(x))_",
"_qnorm(p = 1 - 0.001 / 2)_, ~ 3.29"),
`Function Usage` = c(
'_check_outliers(model, method = "cook")_',
'_check_outliers(data, method = "mcd")_',
'_check_outliers(data, method = "zscore_robust")_'),
check.names = FALSE
)
knitr::kable(
df, col.names = gsub("[.]", " ", names(df)),
caption = "Summary of Statistical Outlier Detection Methods Recommendations.", longtable = TRUE)
```

### Table 1

_Summary of Statistical Outlier Detection Methods Recommendations_

```{r table1_print, echo=FALSE, message=FALSE}
x <- flextable::flextable(df, cwidth = 1.25)
x <- flextable::theme_apa(x)
# x <- flextable::align(x, align = "left", part = "all")
x <- flextable::font(x, fontname = "Latin Modern Roman", part = "all")
x <- flextable::fontsize(x, size = 10, part = "all")
ftExtra::colformat_md(x)
```

All `check_outliers()` output objects possess a `plot()` method, meaning it is also possible to visualize the outliers using the generic `plot()` function on the resulting outlier object after loading the {see} package (Figure 1).

```{r model_fig, fig.cap = "Visual depiction of outliers based on Cook's distance (leverage and standardized residuals), based on the fitted model."}
plot(outliers)
```

## Cook's Distance vs. MCD
Expand Down
Loading

0 comments on commit 1726625

Please sign in to comment.