Skip to content

Econometrics

GARCH, GJR-GARCH and EGARCH volatility

GARCH, GJR-GARCH and EGARCH over arch, with normal or Student's t errors and a zero or constant mean: each parameter with its standard error, the log-likelihood, AIC and BIC, persistence, the unconditional and last conditional volatility, and annualized variance forecasts.

Model id
econometrics.garch, version 1
Domain
Econometrics
Evidence
standard
Cost class
heavy: Estimation or simulation; a hosted run may take up to 30 seconds.
Needs
pip install "pyeconomics[econometrics]"

Formula

rt=μ+εt,εt=σtztr_t = \mu + \varepsilon_t, \quad \varepsilon_t = \sigma_t z_tσt2=ω+∑i=1pαiεt−i2+∑j=1oγjεt−j21[εt−j<0]+∑k=1qβkσt−k2\begin{aligned} \sigma^2_t &= \omega + \sum_{i=1}^{p} \alpha_i \varepsilon^2_{t-i} \\ &\quad + \sum_{j=1}^{o} \gamma_j \varepsilon^2_{t-j} 1[\varepsilon_{t-j} < 0] + \sum_{k=1}^{q} \beta_k \sigma^2_{t-k} \end{aligned}ln⁡σt2=ω+∑iαi(∣zt−i∣−2/π)+∑jγjzt−j+∑kβkln⁡σt−k2\begin{aligned} \ln\sigma^2_t &= \omega + \sum_{i} \alpha_i (|z_{t-i}| - \sqrt{2/\pi}) \\ &\quad + \sum_{j} \gamma_j z_{t-j} + \sum_{k} \beta_k \ln\sigma^2_{t-k} \end{aligned}ET[σT+h2]−σˉ2=πh−1(ET[σT+12]−σˉ2)E_T[\sigma^2_{T+h}] - \bar\sigma^2 = \pi^{h-1}(E_T[\sigma^2_{T+1}] - \bar\sigma^2)σˉ2=ω1−π,π=α+γ2+β (order one)\bar\sigma^2 = \frac{\omega}{1 - \pi}, \quad \pi = \alpha + \tfrac{\gamma}{2} + \beta \text{ (order one)}σannual,h=P ET[σT+h2]\sigma_{\text{annual},h} = \sqrt{P\,E_T[\sigma^2_{T+h}]}σterm,h=Ph∑i≤hET[σT+i2]\sigma_{\text{term},h} = \sqrt{\tfrac{P}{h}\sum_{i \le h}E_T[\sigma^2_{T+i}]}

Where

rtr_t
The return in period t returns
μ\mu
The mean return
εt\varepsilon_t
The shock in period t: the return less its mean
σt\sigma_t
The conditional volatility in period t
ztz_t
The standardized shock, with mean 0 and variance 1
ω\omega
The constant of the variance equation
αi\alpha_i
The weight on the squared shock i periods back (ARCH)
γj\gamma_j
The extra weight on a negative shock j periods back (asymmetry)
βk\beta_k
The weight on the variance k periods back (GARCH)
pp
Number of ARCH lags p
oo
Number of asymmetric lags asymmetric_lags
qq
Number of GARCH lags q
π\pi
Persistence: how much of a shock to variance carries to the next period persistence
σˉ2\bar\sigma^2
The unconditional variance the forecasts revert to
hh
Periods ahead horizon
ET[σT+h2]E_T[\sigma^2_{T+h}]
The variance forecast h periods ahead, made at the last observation variance_forecasts
PP
Periods in a year periods_per_year
σannual,h\sigma_{\text{annual},h}
The volatility forecast h periods ahead, for a year volatility_forecasts_annualized
σterm,h\sigma_{\text{term},h}
The average volatility over the next h periods, for a year term_volatility_annualized

Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.

Variables

Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.

Inputs

GARCH (Bollerslev 1986) (garch): 10 inputs
Inputs of the calculation garch
NameDescription
Returnsreturnsreturn (array) · length min 100, max 10000; each [-10, 10]Returns per period, as decimals (0.01 is 1%), oldest first
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize volatilities: 252 for trading days, 52 for weeks, 12 for months
MeanmeantextThe mean of the returns: a constant mu, or zero
DistributiondistributiontextThe standardized errors: normal, or Student's t with nu estimated
Ppcount · [1, 2]Lags of the shock terms (alpha), p
Qqcount · [0, 2]Lags of the variance terms (beta), q
Horizonhorizoncount · [1, 500]Periods to forecast the variance over
CovariancecovariancetextStandard errors: 'robust' (Bollerslev-Wooldridge quasi-maximum likelihood) or 'classic' (the inverse information matrix)
Fixed parametersfixed_parametersratio (array) · each [-1000, 1000]Parameters to evaluate instead of estimating, in the order of parameter_names and in decimal units; null estimates them
CalculationcalculationtextGARCH (Bollerslev 1986)
GJR-GARCH (Glosten, Jagannathan and Runkle 1993) (gjr): 11 inputs
Inputs of the calculation gjr
NameDescription
Returnsreturnsreturn (array) · length min 100, max 10000; each [-10, 10]Returns per period, as decimals (0.01 is 1%), oldest first
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize volatilities: 252 for trading days, 52 for weeks, 12 for months
MeanmeantextThe mean of the returns: a constant mu, or zero
DistributiondistributiontextThe standardized errors: normal, or Student's t with nu estimated
Ppcount · [1, 2]Lags of the shock terms (alpha), p
Qqcount · [0, 2]Lags of the variance terms (beta), q
Horizonhorizoncount · [1, 500]Periods to forecast the variance over
CovariancecovariancetextStandard errors: 'robust' (Bollerslev-Wooldridge quasi-maximum likelihood) or 'classic' (the inverse information matrix)
Fixed parametersfixed_parametersratio (array) · each [-1000, 1000]Parameters to evaluate instead of estimating, in the order of parameter_names and in decimal units; null estimates them
CalculationcalculationtextGJR-GARCH (Glosten, Jagannathan and Runkle 1993)
Asymmetric lagsasymmetric_lagscount · [1, 2]Lags of the negative-shock terms (gamma), o
EGARCH (Nelson 1991) (egarch): 13 inputs
Inputs of the calculation egarch
NameDescription
Returnsreturnsreturn (array) · length min 100, max 10000; each [-10, 10]Returns per period, as decimals (0.01 is 1%), oldest first
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize volatilities: 252 for trading days, 52 for weeks, 12 for months
MeanmeantextThe mean of the returns: a constant mu, or zero
DistributiondistributiontextThe standardized errors: normal, or Student's t with nu estimated
Ppcount · [1, 2]Lags of the shock terms (alpha), p
Qqcount · [0, 2]Lags of the variance terms (beta), q
Horizonhorizoncount · [1, 500]Periods to forecast the variance over
CovariancecovariancetextStandard errors: 'robust' (Bollerslev-Wooldridge quasi-maximum likelihood) or 'classic' (the inverse information matrix)
Fixed parametersfixed_parametersratio (array) · each [-1000, 1000]Parameters to evaluate instead of estimating, in the order of parameter_names and in decimal units; null estimates them
CalculationcalculationtextEGARCH (Nelson 1991)
Asymmetric lagsasymmetric_lagscount · [0, 2]Lags of the signed standardized-shock terms (gamma), o
Simulationssimulationscount · [100, 10000]Simulated paths for forecasts beyond one period
Seedseedcount · [0, 9.0072e+15]Seed of the simulated forecasts: the same seed, the same draws

Outputs

GARCH (Bollerslev 1986) (garch): 19 outputs
Outputs of the calculation garch
NameDescription
Parameter namesparameter_namestext (array) · length max 9; each at most 16 charactersParameter names, in arch's order: mu, omega, alpha, gamma, beta, nu
Parametersparametersratio (array) · length max 9; each [-1e+06, 1e+06]Estimates in decimal units: mu a return per period, omega a variance per period (the log-variance intercept for EGARCH), the rest pure numbers
Standard errorsstandard_errorsratio (array) · each [0, 1e+300]Standard errors of the parameters; null for fixed parameters
T statisticst_statisticsratio (array) · each [-1e+300, 1e+300]Parameter over standard error; null without standard errors
P valuesp_valuesprobability (array) · each [0, 1]Two-sided p-values from the normal distribution
Log likelihoodlog_likelihoodratio · [-1e+15, 1e+15]Log-likelihood of the decimal returns
AICaicratio · [-1e+15, 1e+15]Akaike criterion
BICbicratio · [-1e+15, 1e+15]Bayesian criterion
Observationsobservationscount · [100, 10000]Returns fitted
Persistencepersistenceratio · [-1e+06, 1e+06]alpha + beta (GARCH), alpha + gamma / 2 + beta (GJR) or beta (EGARCH), each summed over its lags
Unconditional volatilityunconditional_volatilityvolatility · [0, 191311]Long-run volatility per period, sqrt(omega / (1 - persistence)); null when persistence is at least one, and for EGARCH
Unconditional volatility annualizedunconditional_volatility_annualizedvolatility · [0, 191311]The unconditional volatility times sqrt(periods_per_year)
Last volatilitylast_volatilityvolatility · [0, 191311]The conditional volatility of the last period
Last volatility annualizedlast_volatility_annualizedvolatility · [0, 191311]The last conditional volatility times sqrt(periods_per_year)
Horizonshorizonscount (array) · length max 500; each [1, 500]Forecast horizons, 1 to horizon periods ahead
Variance forecastsvariance_forecastsratio (array) · length max 500; each [0, 1e+08]Forecast variance of the decimal return each period ahead
Volatility forecasts annualizedvolatility_forecasts_annualizedvolatility (array) · length max 500; each [0, 191311]sqrt(periods_per_year x the variance forecast) each period ahead
Term volatility annualizedterm_volatility_annualizedvolatility (array) · length max 500; each [0, 191311]Annualized volatility of the cumulative return to each horizon: sqrt(periods_per_year / h x the sum of the first h variance forecasts)
CalculationcalculationtextGARCH
GJR-GARCH (Glosten, Jagannathan and Runkle 1993) (gjr): 19 outputs
Outputs of the calculation gjr
NameDescription
Parameter namesparameter_namestext (array) · length max 9; each at most 16 charactersParameter names, in arch's order: mu, omega, alpha, gamma, beta, nu
Parametersparametersratio (array) · length max 9; each [-1e+06, 1e+06]Estimates in decimal units: mu a return per period, omega a variance per period (the log-variance intercept for EGARCH), the rest pure numbers
Standard errorsstandard_errorsratio (array) · each [0, 1e+300]Standard errors of the parameters; null for fixed parameters
T statisticst_statisticsratio (array) · each [-1e+300, 1e+300]Parameter over standard error; null without standard errors
P valuesp_valuesprobability (array) · each [0, 1]Two-sided p-values from the normal distribution
Log likelihoodlog_likelihoodratio · [-1e+15, 1e+15]Log-likelihood of the decimal returns
AICaicratio · [-1e+15, 1e+15]Akaike criterion
BICbicratio · [-1e+15, 1e+15]Bayesian criterion
Observationsobservationscount · [100, 10000]Returns fitted
Persistencepersistenceratio · [-1e+06, 1e+06]alpha + beta (GARCH), alpha + gamma / 2 + beta (GJR) or beta (EGARCH), each summed over its lags
Unconditional volatilityunconditional_volatilityvolatility · [0, 191311]Long-run volatility per period, sqrt(omega / (1 - persistence)); null when persistence is at least one, and for EGARCH
Unconditional volatility annualizedunconditional_volatility_annualizedvolatility · [0, 191311]The unconditional volatility times sqrt(periods_per_year)
Last volatilitylast_volatilityvolatility · [0, 191311]The conditional volatility of the last period
Last volatility annualizedlast_volatility_annualizedvolatility · [0, 191311]The last conditional volatility times sqrt(periods_per_year)
Horizonshorizonscount (array) · length max 500; each [1, 500]Forecast horizons, 1 to horizon periods ahead
Variance forecastsvariance_forecastsratio (array) · length max 500; each [0, 1e+08]Forecast variance of the decimal return each period ahead
Volatility forecasts annualizedvolatility_forecasts_annualizedvolatility (array) · length max 500; each [0, 191311]sqrt(periods_per_year x the variance forecast) each period ahead
Term volatility annualizedterm_volatility_annualizedvolatility (array) · length max 500; each [0, 191311]Annualized volatility of the cumulative return to each horizon: sqrt(periods_per_year / h x the sum of the first h variance forecasts)
CalculationcalculationtextGJR-GARCH
EGARCH (Nelson 1991) (egarch): 19 outputs
Outputs of the calculation egarch
NameDescription
Parameter namesparameter_namestext (array) · length max 9; each at most 16 charactersParameter names, in arch's order: mu, omega, alpha, gamma, beta, nu
Parametersparametersratio (array) · length max 9; each [-1e+06, 1e+06]Estimates in decimal units: mu a return per period, omega a variance per period (the log-variance intercept for EGARCH), the rest pure numbers
Standard errorsstandard_errorsratio (array) · each [0, 1e+300]Standard errors of the parameters; null for fixed parameters
T statisticst_statisticsratio (array) · each [-1e+300, 1e+300]Parameter over standard error; null without standard errors
P valuesp_valuesprobability (array) · each [0, 1]Two-sided p-values from the normal distribution
Log likelihoodlog_likelihoodratio · [-1e+15, 1e+15]Log-likelihood of the decimal returns
AICaicratio · [-1e+15, 1e+15]Akaike criterion
BICbicratio · [-1e+15, 1e+15]Bayesian criterion
Observationsobservationscount · [100, 10000]Returns fitted
Persistencepersistenceratio · [-1e+06, 1e+06]alpha + beta (GARCH), alpha + gamma / 2 + beta (GJR) or beta (EGARCH), each summed over its lags
Unconditional volatilityunconditional_volatilityvolatility · [0, 191311]Long-run volatility per period, sqrt(omega / (1 - persistence)); null when persistence is at least one, and for EGARCH
Unconditional volatility annualizedunconditional_volatility_annualizedvolatility · [0, 191311]The unconditional volatility times sqrt(periods_per_year)
Last volatilitylast_volatilityvolatility · [0, 191311]The conditional volatility of the last period
Last volatility annualizedlast_volatility_annualizedvolatility · [0, 191311]The last conditional volatility times sqrt(periods_per_year)
Horizonshorizonscount (array) · length max 500; each [1, 500]Forecast horizons, 1 to horizon periods ahead
Variance forecastsvariance_forecastsratio (array) · length max 500; each [0, 1e+08]Forecast variance of the decimal return each period ahead
Volatility forecasts annualizedvolatility_forecasts_annualizedvolatility (array) · length max 500; each [0, 191311]sqrt(periods_per_year x the variance forecast) each period ahead
Term volatility annualizedterm_volatility_annualizedvolatility (array) · length max 500; each [0, 191311]Annualized volatility of the cumulative return to each horizon: sqrt(periods_per_year / h x the sum of the first h variance forecasts)
CalculationcalculationtextEGARCH

Calculator

Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.

Live data runs on your own computer only

This model reads Market excess return, three-factor file, daily. Its source, Ken French Data Library, lets pyeconomics read the data on your own computer but not serve them from this website.

Here, enter your own values, or bring them as a file with "Use my own data". To run this page with every profile's live data, install the local app and start it: pip install "pyeconomics[app]" then pyeconomics serve.

Loading the calculator…

Worked example

A year of simulated daily returns at about 11% annual volatility.

Example garch_daily. Inputs:

{
  "calculation": "garch",
  "covariance": "robust",
  "distribution": "normal",
  "fixed_parameters": null,
  "horizon": 10,
  "mean": "constant",
  "p": 1,
  "periods_per_year": 252,
  "q": 1,
  "returns": [
    0.007787, 0.002413, -0.003711,
    -0.008417, -0.012964, 0.00014,
    -0.005841, -0.006195, -0.001561,
    -0.000351, -0.014785, 0.00695,
    -0.015121, 0.01549, 0.005369,
    -0.004159, 0.011419, 0.000182,
    0.005775, 0.000875, 0.00856,
    0.008338, -0.00715, -0.004783,
    0.002608, -0.001536, -0.016048,
    0.01646, -0.019704, -0.021423,
    -0.014719, 0.006637, 0.020382,
    -0.002885, -0.004574, 0.00195,
    -0.003926, 0.000845, -0.011159,
    0.004321, 0.003724, -0.0222,
    -0.001183, 0.001668, 0.005486,
    -0.007716, -0.012331, -0.009058,
    0.005177, -0.007782, -0.006876,
    0.010079, -0.006988, -0.007835,
    -0.000787, 0.001637, 0.008194,
    -0.006952, -0.012259, -0.00101,
    0.005081, -0.011393, -0.003917,
    0.002379, 0.001726, 0.000598,
    -0.001767, -0.005293, -0.006066,
    0.007527, -0.007383, 0.008207,
    -0.008976, 0.020403, -0.015424,
    0.015295, -0.009039, -0.00115,
    -0.000622, -0.005911, 0.019646,
    0.000958, -0.012721, 0.006381,
    0.00683, -0.010731, 0.005051,
    0.000628, 0.007142, 0.006097,
    -0.000071, -0.003265, 0.007016,
    0.002393, -0.010946, -0.004192,
    -0.003607, -0.001893, 0.015864,
    -0.003031, 0.003692, 0.01238,
    0.004017, 0.003332, 0.009666,
    0.001508, 0.001363, 0.004846,
    0.002838, -0.00453, -0.007605,
    -0.000751, 0.008905, -0.001499,
    0.007322, 0.00267, -0.001935,
    -0.015939, 0.001637, -0.00196,
    -0.0109, 0.003719, -0.000178,
    0.002522, -0.003927, 0.001281,
    -0.002891, 0.006324, 0.000745,
    -0.008104, 0.001291, 0.000393,
    -0.001141, -0.007318, 0.005969,
    -0.004165, 0.008892, -0.003945,
    0.00019, -0.000253, 0.000825,
    0.013951, -0.003215, 0.012973,
    0.004401, -0.004785, 0.008468,
    0.005806, 0.006516, -0.009081,
    0.003531, -0.002741, -0.000936,
    -0.000832, 0.000248, 0.00933,
    0.002361, -0.011144, 0.00825,
    0.000593, 0.000855, -0.011424,
    0.00273, -0.003294, 0.006126,
    0.002921, 0.00514, -0.002294,
    -0.010894, 0.006309, 0.002736,
    -0.002084, -0.003393, -0.005262,
    -0.010426, -0.007555, -0.000458,
    0.010101, 0.003027, 0.010385,
    -0.006947, 0.008656, -0.002934,
    0.00999, 0.008752, 0.000257,
    0.000937, 0.008144, -0.005431,
    -0.014555, 0.006259, 0.016448,
    -0.016302, 0.001975, -0.010654,
    -0.002645, -0.008742, 0.007622,
    -0.004688, -0.001606, -0.008642,
    0.005872, -0.004, -0.002873,
    -0.000553, -0.010186, -0.000153,
    -0.011312, -0.001626, -0.001573,
    -0.002753, -0.001328, -0.004313,
    0.003202, -0.000021, -0.002768,
    -0.001309, -0.003739, -0.000693,
    -0.001648, -0.009205, 0.009214,
    -0.002668, -0.00391, 0.001719,
    -0.011577, -0.002496, 0.001861,
    -0.001555, 0.000362, -0.002436,
    -0.001968, -0.000212, 0.000762,
    -0.005342, 0.001386, 0.001438,
    -0.002916, -0.002667, 0.000536,
    0.005198, 0.005001, -0.003906,
    -0.002545, -0.0026, 0.001734,
    -0.000721, 0.001382, 0.005308,
    0.000929
  ]
}

Outputs:

{
  "aic": -1760.3444168270585,
  "bic": -1746.2585731556094,
  "calculation": "garch",
  "horizons": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  "last_volatility": 0.0038585499422357527,
  "last_volatility_annualized": 0.061252581410870664,
  "log_likelihood": 884.1722084135292,
  "observations": 250,
  "p_values": [
    0.3009110629796825,
    0.903667354364561,
    0.20880431889305173,
    3.7644918345118443e-28
  ],
  "parameter_names": ["mu", "omega", "alpha[1]", "beta[1]"],
  "parameters": [
    -0.00044634725126433745,
    2.0642087166504975e-7,
    0.07475715903405702,
    0.9186832550772499
  ],
  "persistence": 0.9934404141113069,
  "standard_errors": [
    0.00043146948268495995,
    0.0000017055361996541482,
    0.059479302696917834,
    0.08350640342314522
  ],
  "t_statistics": [
    -1.0344816242548505,
    0.12102989763976171,
    1.2568600444929372,
    11.001351003252779
  ],
  "term_volatility_annualized": [
    0.05945116760608378,
    0.059572293256353805,
    0.059692645044840335,
    0.05981223023576056,
    0.059931055992168844,
    0.060049129377948304,
    0.06016645735975121,
    0.06028304680888962,
    0.06039890450317801,
    0.06051403712872925
  ],
  "unconditional_volatility": 0.005609686515210343,
  "unconditional_volatility_annualized": 0.08905101271367473,
  "variance_forecasts": [
    0.00001402556083224867,
    0.000014139979832997495,
    0.000014253648292483609,
    0.00001436657113394689,
    0.000014478753248332795,
    0.000014590199494504211,
    0.000014700914699451895,
    0.000014810903658503541,
    0.000014920171135531476,
    0.00001502872186315901
  ],
  "volatility_forecasts_annualized": [
    0.05945116760608378,
    0.05969317312654244,
    0.05993262358437072,
    0.06016955979359178,
    0.060404021543104765,
    0.06063604763352457,
    0.060865675912306086,
    0.06109294330725024,
    0.06131788585848286,
    0.06154053874899106
  ]
}

Assumptions

  • Estimation is by maximum likelihood in arch (SLSQP, arch's stationarity constraints), on the returns times 100 and, when their percent variance lies outside [0.1, 10,000), by a further power of ten; every estimate is reported back in decimal units (omega in the units of the variance, or for EGARCH as the log-variance intercept of the decimal returns).
  • The recursion starts from arch's backcast: the 0.94-weighted average of the first min(75, n) squared residuals, for every pre-sample shock and variance (half of it for GJR's negative-shock terms; EGARCH starts from its logarithm, with no pre-sample shock). As in arch, the fit's residuals are the demeaned returns and the forecasts' are the returns less the estimated mean; the two paths differ only while the start has not decayed.
  • Student's t errors are standardized to unit variance, with nu estimated in [2.05, 500]. Persistence for GJR counts gamma / 2, the chance of a negative shock under a symmetric distribution.
  • Standard errors are Bollerslev and Wooldridge's robust (QML) sandwich by default, or the classic inverse information; the delta method carries them to decimal units, and p-values are normal.
  • Forecasts are arch's analytic ones, except EGARCH beyond one period, whose variances are averages over seeded simulated paths. Volatilities are annualized by sqrt(periods_per_year): no compounding.
  • Profiles: default binds 1,000 trading days of the Ken French daily market excess return (factors.ff3_market.us.daily) to returns; supply periods_per_year=252. concepts= rebinds returns to any other daily return series in the catalog.

Limitations

  • Returns that barely vary (standard deviation below 1e-8), or an estimate or forecast that is not finite or beyond its bound, raise DomainError.
  • The optimizer may stop short of the maximum (a warning names arch's message); estimates near a constraint (persistence near one, alpha near zero) may lack standard errors, which are then null with a warning.
  • The unconditional volatility is null for EGARCH (no closed form) and when persistence is at least one. Fixed parameters must describe a non-negative, non-explosive variance (persistence at most one; an EGARCH beta sum strictly inside (-1, 1)); they have no standard errors.
  • EGARCH forecasts beyond one period carry simulation error, which shrinks with the number of simulations; the seed makes them repeat.
  • Needs the econometrics extra: pip install 'pyeconomics[econometrics]'. On Python 3.15 and later the extra cannot install arch yet (no CPython 3.15 wheel; issue #154), and the model raises MissingOptionalDependencyError saying so.

Evidence

Status: standard. Textbook consensus, such as bond duration or the CAPM formula.

Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).

Syllabus

The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.

Data

This model can read its data for you: each bound field names a data series, and the sources listed can fill it, in the order they are tried. This website reads only the sources whose terms let it serve their data (marked "hosted"); every source is available when you run pyeconomics on your own computer.

Profile: Default
FieldConceptRead asSources (licence class; hosted)
returnsMarket excess return, three-factor file, dailyfactors.ff3_market.us.dailythe last 1000 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)

Citations

  1. Engle, R. F. (1982). Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation. Econometrica, 50(4), 987-1007. doi:10.2307/1912773 (Section 2, the ARCH(p) process)
  2. Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31(3), 307-327. doi:10.1016/0304-4076(86)90063-1 (Section 2, eqs. (1)-(2): the GARCH(p, q) process)
  3. Bollerslev, T. (1987). A conditionally heteroskedastic time series model for speculative prices and rates of return. The Review of Economics and Statistics, 69(3), 542-547. doi:10.2307/1925546 (GARCH with standardized Student's t errors)
  4. Glosten, L. R., Jagannathan, R. and Runkle, D. E. (1993). On the relation between the expected value and the volatility of the nominal excess return on stocks. The Journal of Finance, 48(5), 1779-1801. doi:10.1111/j.1540-6261.1993.tb05128.x (The asymmetric (GJR) variance equation)
  5. Nelson, D. B. (1991). Conditional heteroskedasticity in asset returns: A new approach. Econometrica, 59(2), 347-370. doi:10.2307/2938260 (Section 2, the EGARCH log-variance equation)
  6. Bollerslev, T. and Wooldridge, J. M. (1992). Quasi-maximum likelihood estimation and inference in dynamic models with time-varying covariances. Econometric Reviews, 11(2), 143-172. doi:10.1080/07474939208800229 (The robust (sandwich) covariance of the QML estimates)
  7. Sheppard, K. et al. arch: ARCH models and other tools for financial econometrics in Python, version 8.0. https://arch.readthedocs.io/en/latest/univariate/univariate.html (arch.univariate: ConstantMean, ZeroMean, GARCH, EGARCH, fit and fix)
  8. French, K. R. Data Library: Fama/French 3 Factors [Daily]. Tuck School of Business, Dartmouth College. https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html (Fama/French 3 Factors [Daily], column Mkt-RF)

Changelog

  • Version 1: First version.

Use it elsewhere

Documentation
The model's reference page
REST API
GET or POST /v1/models/econometrics.garch/run
MCP tool
run_model with the model's id, econometrics.garch. Connect an assistant
Command line
pyeconomics models run econometrics.garch --help

The worked example, from Python and from the command line:

Python
import pyeconomics

inputs = {
    "calculation": "garch",
    "covariance": "robust",
    "distribution": "normal",
    "fixed_parameters": None,
    "horizon": 10,
    "mean": "constant",
    "p": 1,
    "periods_per_year": 252,
    "q": 1,
    "returns": [
        0.007787, 0.002413,
        -0.003711, -0.008417,
        -0.012964, 0.00014,
        -0.005841, -0.006195,
        -0.001561, -0.000351,
        -0.014785, 0.00695,
        -0.015121, 0.01549,
        0.005369, -0.004159,
        0.011419, 0.000182,
        0.005775, 0.000875, 0.00856,
        0.008338, -0.00715,
        -0.004783, 0.002608,
        -0.001536, -0.016048,
        0.01646, -0.019704,
        -0.021423, -0.014719,
        0.006637, 0.020382,
        -0.002885, -0.004574,
        0.00195, -0.003926,
        0.000845, -0.011159,
        0.004321, 0.003724, -0.0222,
        -0.001183, 0.001668,
        0.005486, -0.007716,
        -0.012331, -0.009058,
        0.005177, -0.007782,
        -0.006876, 0.010079,
        -0.006988, -0.007835,
        -0.000787, 0.001637,
        0.008194, -0.006952,
        -0.012259, -0.00101,
        0.005081, -0.011393,
        -0.003917, 0.002379,
        0.001726, 0.000598,
        -0.001767, -0.005293,
        -0.006066, 0.007527,
        -0.007383, 0.008207,
        -0.008976, 0.020403,
        -0.015424, 0.015295,
        -0.009039, -0.00115,
        -0.000622, -0.005911,
        0.019646, 0.000958,
        -0.012721, 0.006381,
        0.00683, -0.010731,
        0.005051, 0.000628,
        0.007142, 0.006097,
        -0.000071, -0.003265,
        0.007016, 0.002393,
        -0.010946, -0.004192,
        -0.003607, -0.001893,
        0.015864, -0.003031,
        0.003692, 0.01238, 0.004017,
        0.003332, 0.009666,
        0.001508, 0.001363,
        0.004846, 0.002838,
        -0.00453, -0.007605,
        -0.000751, 0.008905,
        -0.001499, 0.007322,
        0.00267, -0.001935,
        -0.015939, 0.001637,
        -0.00196, -0.0109, 0.003719,
        -0.000178, 0.002522,
        -0.003927, 0.001281,
        -0.002891, 0.006324,
        0.000745, -0.008104,
        0.001291, 0.000393,
        -0.001141, -0.007318,
        0.005969, -0.004165,
        0.008892, -0.003945,
        0.00019, -0.000253,
        0.000825, 0.013951,
        -0.003215, 0.012973,
        0.004401, -0.004785,
        0.008468, 0.005806,
        0.006516, -0.009081,
        0.003531, -0.002741,
        -0.000936, -0.000832,
        0.000248, 0.00933, 0.002361,
        -0.011144, 0.00825,
        0.000593, 0.000855,
        -0.011424, 0.00273,
        -0.003294, 0.006126,
        0.002921, 0.00514,
        -0.002294, -0.010894,
        0.006309, 0.002736,
        -0.002084, -0.003393,
        -0.005262, -0.010426,
        -0.007555, -0.000458,
        0.010101, 0.003027,
        0.010385, -0.006947,
        0.008656, -0.002934,
        0.00999, 0.008752, 0.000257,
        0.000937, 0.008144,
        -0.005431, -0.014555,
        0.006259, 0.016448,
        -0.016302, 0.001975,
        -0.010654, -0.002645,
        -0.008742, 0.007622,
        -0.004688, -0.001606,
        -0.008642, 0.005872, -0.004,
        -0.002873, -0.000553,
        -0.010186, -0.000153,
        -0.011312, -0.001626,
        -0.001573, -0.002753,
        -0.001328, -0.004313,
        0.003202, -0.000021,
        -0.002768, -0.001309,
        -0.003739, -0.000693,
        -0.001648, -0.009205,
        0.009214, -0.002668,
        -0.00391, 0.001719,
        -0.011577, -0.002496,
        0.001861, -0.001555,
        0.000362, -0.002436,
        -0.001968, -0.000212,
        0.000762, -0.005342,
        0.001386, 0.001438,
        -0.002916, -0.002667,
        0.000536, 0.005198,
        0.005001, -0.003906,
        -0.002545, -0.0026,
        0.001734, -0.000721,
        0.001382, 0.005308,
        0.000929,
    ],
}
result = pyeconomics.run("econometrics.garch", inputs)
print(result.to_json())
Command line
pyeconomics models run econometrics.garch --inputs - <<'JSON'
{
  "calculation": "garch",
  "covariance": "robust",
  "distribution": "normal",
  "fixed_parameters": null,
  "horizon": 10,
  "mean": "constant",
  "p": 1,
  "periods_per_year": 252,
  "q": 1,
  "returns": [
    0.007787, 0.002413, -0.003711,
    -0.008417, -0.012964, 0.00014,
    -0.005841, -0.006195, -0.001561,
    -0.000351, -0.014785, 0.00695,
    -0.015121, 0.01549, 0.005369,
    -0.004159, 0.011419, 0.000182,
    0.005775, 0.000875, 0.00856,
    0.008338, -0.00715, -0.004783,
    0.002608, -0.001536, -0.016048,
    0.01646, -0.019704, -0.021423,
    -0.014719, 0.006637, 0.020382,
    -0.002885, -0.004574, 0.00195,
    -0.003926, 0.000845, -0.011159,
    0.004321, 0.003724, -0.0222,
    -0.001183, 0.001668, 0.005486,
    -0.007716, -0.012331, -0.009058,
    0.005177, -0.007782, -0.006876,
    0.010079, -0.006988, -0.007835,
    -0.000787, 0.001637, 0.008194,
    -0.006952, -0.012259, -0.00101,
    0.005081, -0.011393, -0.003917,
    0.002379, 0.001726, 0.000598,
    -0.001767, -0.005293, -0.006066,
    0.007527, -0.007383, 0.008207,
    -0.008976, 0.020403, -0.015424,
    0.015295, -0.009039, -0.00115,
    -0.000622, -0.005911, 0.019646,
    0.000958, -0.012721, 0.006381,
    0.00683, -0.010731, 0.005051,
    0.000628, 0.007142, 0.006097,
    -0.000071, -0.003265, 0.007016,
    0.002393, -0.010946, -0.004192,
    -0.003607, -0.001893, 0.015864,
    -0.003031, 0.003692, 0.01238,
    0.004017, 0.003332, 0.009666,
    0.001508, 0.001363, 0.004846,
    0.002838, -0.00453, -0.007605,
    -0.000751, 0.008905, -0.001499,
    0.007322, 0.00267, -0.001935,
    -0.015939, 0.001637, -0.00196,
    -0.0109, 0.003719, -0.000178,
    0.002522, -0.003927, 0.001281,
    -0.002891, 0.006324, 0.000745,
    -0.008104, 0.001291, 0.000393,
    -0.001141, -0.007318, 0.005969,
    -0.004165, 0.008892, -0.003945,
    0.00019, -0.000253, 0.000825,
    0.013951, -0.003215, 0.012973,
    0.004401, -0.004785, 0.008468,
    0.005806, 0.006516, -0.009081,
    0.003531, -0.002741, -0.000936,
    -0.000832, 0.000248, 0.00933,
    0.002361, -0.011144, 0.00825,
    0.000593, 0.000855, -0.011424,
    0.00273, -0.003294, 0.006126,
    0.002921, 0.00514, -0.002294,
    -0.010894, 0.006309, 0.002736,
    -0.002084, -0.003393, -0.005262,
    -0.010426, -0.007555, -0.000458,
    0.010101, 0.003027, 0.010385,
    -0.006947, 0.008656, -0.002934,
    0.00999, 0.008752, 0.000257,
    0.000937, 0.008144, -0.005431,
    -0.014555, 0.006259, 0.016448,
    -0.016302, 0.001975, -0.010654,
    -0.002645, -0.008742, 0.007622,
    -0.004688, -0.001606, -0.008642,
    0.005872, -0.004, -0.002873,
    -0.000553, -0.010186, -0.000153,
    -0.011312, -0.001626, -0.001573,
    -0.002753, -0.001328, -0.004313,
    0.003202, -0.000021, -0.002768,
    -0.001309, -0.003739, -0.000693,
    -0.001648, -0.009205, 0.009214,
    -0.002668, -0.00391, 0.001719,
    -0.011577, -0.002496, 0.001861,
    -0.001555, 0.000362, -0.002436,
    -0.001968, -0.000212, 0.000762,
    -0.005342, 0.001386, 0.001438,
    -0.002916, -0.002667, 0.000536,
    0.005198, 0.005001, -0.003906,
    -0.002545, -0.0026, 0.001734,
    -0.000721, 0.001382, 0.005308,
    0.000929
  ]
}
JSON