### Basic disequilibrium model with unknown sample separation (diseq_basic)

The basic disequilibrium model consists of three equations. Two of them are the demand and supply equations. In addition, the model replaces the market clearing condition with the short side rule. The model is estimated using full information maximum likelihood.

$$D_{nt} = X_{d,nt}'\beta_{d} + u_{d,nt},$$ $$S_{nt} = X_{s,nt}'\beta_{s} + u_{s,nt},$$ $$Q_{nt} = \min\{D_{nt},S_{nt}\}.$$

### Disequilibrium model with deterministic price dynamics (diseq_deterministic_adjustment)

The disequilibrium model with deterministic price adjustment consists of four equations. The two market equations, the short side rule and price evolution equation. The first two equations are stochastic. The price equation is deterministic. The sample is separated based on the sign of the price changes as in the diseq_directional model. The model is estimated using full information maximum likelihood.

$$D_{nt} = X_{d,nt}'\beta_{d} + P_{nt}\alpha_{d} + u_{d,nt},$$ $$S_{nt} = X_{s,nt}'\beta_{s} + P_{nt}\alpha_{s} + u_{s,nt},$$ $$Q_{nt} = \min\{D_{nt},S_{nt}\},$$ $$\Delta P_{nt} = \frac{1}{\gamma} \left( D_{nt} - S_{nt} \right).$$

### Directional disequilibrium model with sample separation (diseq_directional)

The directional disequilibrium model consists of three equations and a separation rule. The market is described by a linear demand, a linear supply equation and the short side rule. The separation rule splits the sample into states of excess supply and excess demand. If a price change is positive at the time point of the observation, then the observation is classified as being in an excess demand state. Otherwise, it is assumed that it represents an excess supply state. The model is estimated using full information maximum likelihood.

$$D_{nt} = X_{d,nt}'\beta_{d} + u_{d,nt},$$ $$S_{nt} = X_{s,nt}'\beta_{s} + u_{s,nt},$$ $$Q_{nt} = \min\{D_{nt},S_{nt}\},$$ $$\Delta P_{nt} \ge 0 \Longrightarrow D_{nt} \ge S_{nt}.$$

### Disequilibrium model with stochastic price dynamics (diseq_stochastic_adjustment)

The disequilibrium model with stochastic price adjustment is described by a system of four equations. Three of of them form a stochastic linear system of market equations equations coupled with a stochastic price evolution equation. The fourth equation is the short side rule. In contrast to the deterministic counterpart, the model does not impose any separation rule on the sample. It is estimated using full information maximum likelihood.

$$D_{nt} = X_{d,nt}'\beta_{d} + P_{nt}\alpha_{d} + u_{d,nt},$$ $$S_{nt} = X_{s,nt}'\beta_{s} + P_{nt}\alpha_{s} + u_{s,nt},$$ $$Q_{nt} = \min\{D_{nt},S_{nt}\},$$ $$\Delta P_{nt} = \frac{1}{\gamma} \left( D_{nt} - S_{nt} \right) + X_{p,nt}'\beta_{p} + u_{p,nt}.$$

### Equilibrium model (equilibrium_model)

The equilibrium model consists of thee equations. The demand, the supply and the market clearing equations. The model can be estimated using both full information maximum likelihood and two-stage least squares.

$$D_{nt} = X_{d,nt}'\beta_{d} + P_{nt}\alpha_{d} + u_{d,nt},$$ $$S_{nt} = X_{s,nt}'\beta_{s} + P_{nt}\alpha_{s} + u_{s,nt},$$ $$Q_{nt} = D_{nt} = S_{nt}.$$

A necessary identification condition is that there is at least one control that is exclusively part of the demand and one control that is exclusively part of the supply equation. In the first stage of the two-stage least square estimation, prices are regressed on remaining controls from both the demand and supply equations. In the second stage, the demand and supply equation is estimated using the fitted prices instead of the observed.

## Slots

logger

Logger object.

subject_columns

Column name for the subject identifier.

time_column

Column name for the time point identifier.

explanatory_columns

Vector of explanatory column names for all model's equations.

data_columns

Vector of model's data column names. This is the union of the quantity, price and explanatory columns.

columns

Vector of primary key and data column names for all model's equations.

data

Model data frame.

model_name

Model name string.

market_type

Market type string.

system

Model's system of equations.