I posted this question a couple years ago for version 13 (https://www.statalist.org/forums/for...-demand-models). I never got a helpful response, so I'm trying again now that we're two versions later. I'll see if I can simplify it a bit, as well. I understand not many people on here use -forecast-, but I'm really hoping someone from Statacorp will chime in with their intended use for this sort of thing.
The -forecast- tool allows you to build a system of equations, solve it, and use it to produce dynamic forecasts, assess in the impact of adding a shock to a variable, etc. Quite useful in econometrics, and would be extremely useful in supply and demand models except for two (seemingly) crippling deficiencies.
The way one builds a model in -forecast- is specifying equations that (as is standard in STATA) start with an endogenous variable and follow with explanatory variables.
For instance, suppose you had a dataset with supply of some commodity X (sX) and demand of commodity X (dX). You know supply is affected by the price of X (pX) and another variable A. You know demand is also affected by pX and another variable B. You also assume market equilibrium so sX=dX.
In other words, your simple system of equations looks like this:
sX = a1 * pX + a2 * A
dX = b1 * pX + b2 * B
sX = dX
where a1, a2, b1, and b2 are the price responses to be estimated.
You've previously estimated equations for supply and demand using -ivregress- and stored the results in 'SUP' and 'DEM', respectively. To build this model, you'd write:
So far, so good. However, now you're faced with two problems unique to supply and demand models:
you will get the error:
Additionally, there is no way to indicate to -forecast- that price (pX) should be treated as endogenous and solved for.
This seems like such a basic use for -forecast-, and these seem like such basic problems that I'm sure the programmers thought of a way to make this work, but as far as I can tell this problem is unsolved from when I first posed it three years ago.
The -forecast- tool allows you to build a system of equations, solve it, and use it to produce dynamic forecasts, assess in the impact of adding a shock to a variable, etc. Quite useful in econometrics, and would be extremely useful in supply and demand models except for two (seemingly) crippling deficiencies.
The way one builds a model in -forecast- is specifying equations that (as is standard in STATA) start with an endogenous variable and follow with explanatory variables.
For instance, suppose you had a dataset with supply of some commodity X (sX) and demand of commodity X (dX). You know supply is affected by the price of X (pX) and another variable A. You know demand is also affected by pX and another variable B. You also assume market equilibrium so sX=dX.
In other words, your simple system of equations looks like this:
sX = a1 * pX + a2 * A
dX = b1 * pX + b2 * B
sX = dX
where a1, a2, b1, and b2 are the price responses to be estimated.
You've previously estimated equations for supply and demand using -ivregress- and stored the results in 'SUP' and 'DEM', respectively. To build this model, you'd write:
Code:
. forecast create supdem Forecast model supdem started. . forecast estimates SUP Added estimation results from ivregress. Forecast model supdem now contains 1 endogenous variable. . forecast estimates DEM Added estimation results from ivregress. Forecast model supdem now contains 2 endogenous variables.
- You need to specify that supply and demand are equal (the market-clearing condition)
- You need to tell -forecast- that price is endogenous
Code:
. forecast identity sX = dX
Code:
cannot add identity Endogenous variable sX has already been added to the model. You cannot add an endogenous variable to the model multiple times. Type forecast describe endogenous to see how the variable was added to the model.
This seems like such a basic use for -forecast-, and these seem like such basic problems that I'm sure the programmers thought of a way to make this work, but as far as I can tell this problem is unsolved from when I first posed it three years ago.
Comment