Learn R Programming

diseq (version 0.3.1)

marginal_effects: Marginal effects

Description

Returns the estimated effect of a variable.

Usage

shortage_marginal(object, parameters, variable)

shortage_probability_marginal(object, parameters, variable, aggregate = "mean")

# S4 method for disequilibrium_model shortage_marginal(object, parameters, variable)

# S4 method for disequilibrium_model shortage_probability_marginal(object, parameters, variable, aggregate = "mean")

Arguments

object

A disequilibrium model object.

parameters

A vector of parameters.

variable

Variable name for which the effect is calculated.

aggregate

Mode of aggregation. Valid options are "mean" (the default) and "at_the_mean".

Value

The estimated effect of the passed variable.

Functions

  • shortage_marginal: Marginal effect on market system

    Returns the estimated marginal effect of a variable on the market system. For a system variable \(x\) with demand coefficient \(\beta_{d, x}\) and supply coefficient \(\beta_{s, x}\), the marginal effect on the market system is given by $$M_{x} = \frac{\beta_{d, x} - \beta_{s, x}}{\sqrt{\sigma_{d, x}^{2} + \sigma_{s, x}^{2} - 2 \rho_{ds} \sigma_{d, x} \sigma_{s, x}}}.$$

  • shortage_probability_marginal: Marginal effect on shortage probabilities

    Returns the estimated marginal effect of a variable on the probability of observing a shortage state. The mean marginal effect on the shortage probability is given by $$M_{x} \mathrm{E}\phi(D - S)$$ and the marginal effect at the mean by $$M_{x} \phi(\mathrm{E}(D - S)),$$ where \(M_{x}\) is the marginal effect on the system, \(D\) is the demanded quantity, \(S\) the supplied quantity, and \(\phi\) is the standard normal density.

Examples

Run this code
# NOT RUN {
# initialize the model using the houses dataset
model <- new(
  "diseq_deterministic_adjustment", # model type
  c("ID", "TREND"), "TREND", "HS", "RM", # keys, time, quantity, and price variables
  "RM + TREND + W + CSHS + L1RM + L2RM + MONTH", # demand specification
  "RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH", # supply specification
  fair_houses(), # data
  correlated_shocks = FALSE # allow shocks to be correlated
)

# estimate the model object (BFGS is used by default)
est <- estimate(model, control = list(maxit = 1e+5))

# get the mean marginal effect of variable "RM" on the shortage probabilities
shortage_probability_marginal(model, est@coef, "RM")

# get the marginal effect at the mean of variable "RM" on the shortage probabilities
shortage_probability_marginal(model, est@coef, "CSHS", aggregate = "at_the_mean")

# get the marginal effect of variable "RM" on the system
shortage_marginal(model, est@coef, "RM")
# }

Run the code above in your browser using DataLab