# Analysis of shortages

Source:`R/market_model.R`

, `R/diseq_stochastic_adjustment.R`

, `R/market_fit.R`

`shortage_analysis.Rd`

The following methods offer functionality for analyzing estimated shortages of the market models. The methods can be called either using directly a fitted model object, or by separately providing a model object and a parameter vector.

## Usage

```
shortages(fit, model, parameters)
normalized_shortages(fit, model, parameters)
relative_shortages(fit, model, parameters)
shortage_probabilities(fit, model, parameters)
shortage_indicators(fit, model, parameters)
shortage_standard_deviation(fit, model, parameters)
# S4 method for missing,market_model,ANY
shortages(model, parameters)
# S4 method for missing,market_model,ANY
normalized_shortages(model, parameters)
# S4 method for missing,market_model,ANY
relative_shortages(model, parameters)
# S4 method for missing,market_model,ANY
shortage_probabilities(model, parameters)
# S4 method for missing,market_model,ANY
shortage_indicators(model, parameters)
# S4 method for missing,market_model,ANY
shortage_standard_deviation(model, parameters)
# S4 method for missing,diseq_stochastic_adjustment,ANY
shortage_standard_deviation(model, parameters)
# S4 method for market_fit,missing,missing
shortages(fit)
# S4 method for market_fit,missing,missing
normalized_shortages(fit)
# S4 method for market_fit,missing,missing
relative_shortages(fit)
# S4 method for market_fit,missing,missing
shortage_probabilities(fit)
# S4 method for market_fit,missing,missing
shortage_indicators(fit)
# S4 method for market_fit,missing,missing
shortage_standard_deviation(fit)
```

## Arguments

- fit
A fitted model object.

- model
A market model object.

- parameters
A vector of parameters at which the shortages are evaluated.

## Details

### normalized_shortages

Returns the shortages normalized by the variance of the difference of the shocks at a given point.

### shortage_probabilities

Returns the shortage probabilities, i.e. the probabilities of an observation coming from an excess demand state, at the given point.

### shortage_indicators

Returns a vector of indicators (Boolean values) for each observation. An element of the vector is TRUE for observations at which the estimated shortages are non-negative, i.e. the market at in an excess demand state. The remaining elements are FALSE. The evaluation of the shortages is performed using the passed parameter vector.

## Functions

`shortages`

: Shortages.`normalized_shortages`

: Normalized shortages.`relative_shortages`

: Relative shortages.`shortage_probabilities`

: Shortage probabilities.`shortage_indicators`

: Shortage indicators.`shortage_standard_deviation`

: Shortage standard deviation.

## Examples

```
# \donttest{
# estimate a model using the houses dataset
fit <- diseq_deterministic_adjustment(
HS | RM | ID | TREND ~
RM + TREND + W + CSHS + L1RM + L2RM + MONTH |
RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
fair_houses(),
correlated_shocks = FALSE,
estimation_options = list(control = list(maxit = 1e+5))
)
# get estimated normalized shortages
head(normalized_shortages(fit))
#> normalized_shortages
#> 1 -0.2580115
#> 2 0.2657776
#> 3 0.1577383
#> 4 -2.0123032
#> 5 0.8526629
#> 6 -0.3330998
# get estimated relative shortages
head(relative_shortages(fit))
#> relative_shortages
#> 1 -0.07017305
#> 2 0.07211033
#> 3 0.04439237
#> 4 -0.57700540
#> 5 0.25882821
#> 6 -0.10444697
# get the estimated shortage probabilities
head(shortage_probabilities(fit))
#> shortage_probabilities
#> 1 0.39819900
#> 2 0.60479475
#> 3 0.56266848
#> 4 0.02209399
#> 5 0.80307686
#> 6 0.36952949
# get the estimated shortage indicators
head(shortage_indicators(fit))
#> shortage_indicators
#> 1 FALSE
#> 2 TRUE
#> 3 TRUE
#> 4 FALSE
#> 5 TRUE
#> 6 FALSE
# get the estimated shortages
head(shortages(fit))
#> shortages
#> 1 -9.663887
#> 2 9.954767
#> 3 5.908127
#> 4 -75.371321
#> 5 31.936702
#> 6 -12.476336
# get the estimated shortage standard deviation
shortage_standard_deviation(fit)
#> shortage_standard_deviation
#> 37.45525
# }
```