---
title: "Influential or leverage units in ADEA"
author: 
 - Fernando Fernandez-Palacin^[Universidad de Cádiz, fernando.fernandez@uca.es]
 - Manuel Munoz-Marquez^[Universidad de Cádiz, manuel.munoz@uca.es]
date: "`r Sys.Date()`"
bibliography: dea.bib
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Influential or leverage units in ADEA}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 6,
  fig.height = 4
)
library('adea')
```

# Introduction

An influential or leverage unit is one that produces significant changes in results.
In this context, it refers to a unit that has a substantial impact on the model load.

For more information about loads see the help of the package \code{\link{adea}} or see [@Fernandez2018] and [@Villanueva2021].

Let's load and examine the `tokyo_libraries` dataset using the following code:
```{r}
data(tokyo_libraries)
head(tokyo_libraries)
```

# Searching for influential units

The `adea_load_leverage` function searches for units that cause substantial changes in loads.
The following call demonstrates this:
```{r}
input <- tokyo_libraries[, 1:4]
output <- tokyo_libraries[, 5:6]
adea_load_leverage(input, output)
```

The output reveals that units 23 and 6 produce changes greater than the default value for `load.diff`, which is set at 0.05.
The output is sorted in decreasing order of "load.diff," which represents the change in the load model.

While the previous calls only consider changes when removing units one by one, the `ndel` parameter allows for testing the removal of more than one unit at a time.
The following call tests all combinations of two units:
```{r}
adea_load_leverage(input, output, load.diff = 0.1, ndel = 2)
```
This results in a long list, and to limit the number of groups in the output, you can set `nmax` to a specific value, as demonstrated in the following call:
```{r}
adea_load_leverage(input, output, load.diff = 0.1, ndel = 2, nmax = 10)
```

It's important to note that the best option for removing two units is not the same as removing the two units individually in the one-by-one analysis.
This discrepancy arises due to interactions between the effects of the units.

From this point forward, decision-makers or researchers must handle these units carefully to avoid biases in DEA results.

Each call to `adea_load_leverage` requires solving a large linear program, making it computationally demanding and potentially time-consuming.
Patience is essential when working with this function.

# References