estimate
Fit conditional variance model to data
Syntax
Description
estimates the unknown parameters of the conditional variance model object
EstMdl
= estimate(Mdl
,y
)Mdl
with the observed univariate time series
y
, using maximum likelihood. EstMdl
is a
fully specified conditional variance model object that stores the results. It is the
same model type as Mdl
(see garch
, egarch
, and gjr
).
estimates the conditional variance model with additional options specified by one or
more EstMdl
= estimate(Mdl
,y
,Name,Value
)Name,Value
pair arguments. For example, you can specify to
display iterative optimization information or presample innovations.
[
additionally returns:EstMdl
,EstParamCov
,logL
,info
]
= estimate(___)
EstParamCov
, the variance-covariance matrix associated with estimated parameters.logL
, the optimized loglikelihood objective function.info
, a data structure of summary information using any of the input arguments in the previous syntaxes.
Examples
Estimate GARCH Model Parameters Without Initial Values
Fit a GARCH(1,1) model to simulated data.
Simulate 500 data points from the GARCH(1,1) model
where and
Use the default Gaussian innovation distribution for .
Mdl0 = garch('Constant',0.0001,'GARCH',0.5,... 'ARCH',0.2); rng default; % For reproducibility [v,y] = simulate(Mdl0,500);
The output v
contains simulated conditional variances. y
is a column vector of simulated responses (innovations).
Specify a GARCH(1,1) model with unknown coefficients, and fit it to the series y
.
Mdl = garch(1,1); EstMdl = estimate(Mdl,y)
GARCH(1,1) Conditional Variance Model (Gaussian Distribution): Value StandardError TStatistic PValue __________ _____________ __________ __________ Constant 9.8911e-05 3.0726e-05 3.2191 0.001286 GARCH{1} 0.45394 0.11193 4.0557 4.9986e-05 ARCH{1} 0.26374 0.056931 4.6326 3.6111e-06
EstMdl = garch with properties: Description: "GARCH(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: 9.89107e-05 GARCH: {0.453936} at lag [1] ARCH: {0.263739} at lag [1] Offset: 0
The result is a new garch
model called EstMdl
. The parameter estimates in EstMdl
resemble the parameter values that generated the simulated data.
Estimate EGARCH Model Parameters Without Initial Values
Fit an EGARCH(1,1) model to simulated data.
Simulate 500 data points from an EGARCH(1,1) model
where and
(the distribution of is Gaussian).
Mdl0 = egarch('Constant',0.001,'GARCH',0.7,... 'ARCH',0.5,'Leverage',-0.3); rng default % For reproducibility [v,y] = simulate(Mdl0,500);
The output v
contains simulated conditional variances. y
is a column vector of simulated responses (innovations).
Specify an EGARCH(1,1) model with unknown coefficients, and fit it to the series y
.
Mdl = egarch(1,1); EstMdl = estimate(Mdl,y)
EGARCH(1,1) Conditional Variance Model (Gaussian Distribution): Value StandardError TStatistic PValue ___________ _____________ __________ __________ Constant -0.00063866 0.031698 -0.020148 0.98392 GARCH{1} 0.70506 0.067359 10.467 1.2221e-25 ARCH{1} 0.56774 0.074746 7.5956 3.063e-14 Leverage{1} -0.32116 0.053345 -6.0204 1.7399e-09
EstMdl = egarch with properties: Description: "EGARCH(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: -0.000638661 GARCH: {0.705065} at lag [1] ARCH: {0.567741} at lag [1] Leverage: {-0.321158} at lag [1] Offset: 0
The result is a new egarch
model called EstMdl
. The parameter estimates in EstMdl
resemble the parameter values that generated the simulated data.
Estimate GJR Model Parameters Without Initial Values
Fit a GJR(1,1) model to simulated data.
Simulate 500 data points from a GJR(1,1) model.
where and
Use the default Gaussian innovation distribution for .
Mdl0 = gjr('Constant',0.001,'GARCH',0.5,... 'ARCH',0.2,'Leverage',0.2); rng default; % For reproducibility [v,y] = simulate(Mdl0,500);
The output v
contains simulated conditional variances. y
is a column vector of simulated responses (innovations).
Specify a GJR(1,1) model with unknown coefficients, and fit it to the series y
.
Mdl = gjr(1,1); EstMdl = estimate(Mdl,y)
GJR(1,1) Conditional Variance Model (Gaussian Distribution): Value StandardError TStatistic PValue __________ _____________ __________ __________ Constant 0.00097382 0.00025135 3.8743 0.00010694 GARCH{1} 0.46056 0.071793 6.4151 1.4077e-10 ARCH{1} 0.24126 0.063409 3.8047 0.00014196 Leverage{1} 0.25051 0.11265 2.2237 0.026171
EstMdl = gjr with properties: Description: "GJR(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: 0.000973819 GARCH: {0.460555} at lag [1] ARCH: {0.241256} at lag [1] Leverage: {0.250507} at lag [1] Offset: 0
The result is a new gjr
model called EstMdl
. The parameter estimates in EstMdl
resemble the parameter values that generated the simulated data.
Estimate GARCH Model Parameters Using Presample Data
Fit a GARCH(1,1) model to the daily close NASDAQ Composite Index returns.
Load the NASDAQ data included with the toolbox. Convert the index to returns.
load Data_EquityIdx nasdaq = DataTable.NASDAQ; y = price2ret(nasdaq); T = length(y); figure plot(y) xlim([0,T]) title('NASDAQ Returns')
The returns exhibit volatility clustering.
Specify a GARCH(1,1) model, and fit it to the series. One presample innovation is required to initialize this model. Use the first observation of y
as the necessary presample innovation.
Mdl = garch(1,1);
[EstMdl,EstParamCov] = estimate(Mdl,y(2:end),'E0',y(1))
GARCH(1,1) Conditional Variance Model (Gaussian Distribution): Value StandardError TStatistic PValue __________ _____________ __________ __________ Constant 1.9987e-06 5.4228e-07 3.6857 0.00022807 GARCH{1} 0.88356 0.0084341 104.76 0 ARCH{1} 0.10903 0.0076472 14.257 4.041e-46
EstMdl = garch with properties: Description: "GARCH(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: 1.99867e-06 GARCH: {0.883563} at lag [1] ARCH: {0.109027} at lag [1] Offset: 0
EstParamCov = 3×3
10-4 ×
0.0000 -0.0000 0.0000
-0.0000 0.7113 -0.5343
0.0000 -0.5343 0.5848
The output EstMdl
is a new garch
model with estimated parameters.
Use the output variance-covariance matrix to calculate the estimate standard errors.
se = sqrt(diag(EstParamCov))
se = 3×1
0.0000
0.0084
0.0076
These are the standard errors shown in the estimation output display. They correspond (in order) to the constant, GARCH coefficient, and ARCH coefficient.
Estimate EGARCH Model Parameters Using Presample Data
Fit an EGARCH(1,1) model to the daily close NASDAQ Composite Index returns.
Load the NASDAQ data included with the toolbox. Convert the index to returns.
load Data_EquityIdx nasdaq = DataTable.NASDAQ; y = price2ret(nasdaq); T = length(y); figure plot(y) xlim([0,T]) title('NASDAQ Returns')
The returns exhibit volatility clustering.
Specify an EGARCH(1,1) model, and fit it to the series. One presample innovation is required to initialize this model. Use the first observation of y
as the necessary presample innovation.
Mdl = egarch(1,1);
[EstMdl,EstParamCov] = estimate(Mdl,y(2:end),'E0',y(1))
EGARCH(1,1) Conditional Variance Model (Gaussian Distribution): Value StandardError TStatistic PValue _________ _____________ __________ __________ Constant -0.13478 0.022092 -6.101 1.0539e-09 GARCH{1} 0.98391 0.0024221 406.22 0 ARCH{1} 0.19964 0.013966 14.296 2.3323e-46 Leverage{1} -0.060243 0.005647 -10.668 1.4356e-26
EstMdl = egarch with properties: Description: "EGARCH(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: -0.134785 GARCH: {0.983909} at lag [1] ARCH: {0.199645} at lag [1] Leverage: {-0.0602432} at lag [1] Offset: 0
EstParamCov = 4×4
10-3 ×
0.4881 0.0533 -0.1018 0.0106
0.0533 0.0059 -0.0118 0.0017
-0.1018 -0.0118 0.1950 0.0016
0.0106 0.0017 0.0016 0.0319
The output EstMdl
is a new egarch
model with estimated parameters.
Use the output variance-covariance matrix to calculate the estimate standard errors.
se = sqrt(diag(EstParamCov))
se = 4×1
0.0221
0.0024
0.0140
0.0056
These are the standard errors shown in the estimation output display. They correspond (in order) to the constant, GARCH coefficient, ARCH coefficient, and leverage coefficient.
Estimate GJR Model Parameters Using Presample Data
Fit a GJR(1,1) model to the daily close NASDAQ Composite Index returns.
Load the NASDAQ data included with the toolbox. Convert the index to returns.
load Data_EquityIdx nasdaq = DataTable.NASDAQ; y = price2ret(nasdaq); T = length(y); figure plot(y) xlim([0,T]) title('NASDAQ Returns')
The returns exhibit volatility clustering.
Specify a GJR(1,1) model, and fit it to the series. One presample innovation is required to initialize this model. Use the first observation of y
as the necessary presample innovation.
Mdl = gjr(1,1);
[EstMdl,EstParamCov] = estimate(Mdl,y(2:end),'E0',y(1))
GJR(1,1) Conditional Variance Model (Gaussian Distribution): Value StandardError TStatistic PValue __________ _____________ __________ __________ Constant 2.4569e-06 5.6863e-07 4.3208 1.5549e-05 GARCH{1} 0.88133 0.0094909 92.86 0 ARCH{1} 0.06414 0.0092031 6.9693 3.1843e-12 Leverage{1} 0.088796 0.0099186 8.9525 3.4746e-19
EstMdl = gjr with properties: Description: "GJR(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: 2.45693e-06 GARCH: {0.881333} at lag [1] ARCH: {0.0641399} at lag [1] Leverage: {0.088796} at lag [1] Offset: 0
EstParamCov = 4×4
10-4 ×
0.0000 -0.0000 0.0000 0.0000
-0.0000 0.9008 -0.6940 0.0002
0.0000 -0.6940 0.8470 -0.3614
0.0000 0.0002 -0.3614 0.9838
The output EstMdl
is a new gjr
model with estimated parameters.
Use the output variance-covariance matrix to calculate the estimate standard errors.
se = sqrt(diag(EstParamCov))
se = 4×1
0.0000
0.0095
0.0092
0.0099
These are the standard errors shown in the estimation output display. They correspond (in order) to the constant, GARCH coefficient, ARCH coefficient, and leverage coefficient.
Input Arguments
Mdl
— Conditional variance model
garch
model object | egarch
model object | gjr
model object
y
— Single path of response data
numeric column vector
Single path of response data, specified as a numeric column vector. The
software infers the conditional variances from y
, i.e.,
the data to which the model is fit.
y
is usually an innovation series with mean 0 and
conditional variance characterized by the model specified in
Mdl
. In this case, y
is a
continuation of the innovation series E0
.
y
can also represent an innovation series with mean 0
plus an offset. A nonzero Offset
signals the inclusion of
an offset in Mdl
.
The last observation of y
is the latest
observation.
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'Display','iter','E0',[0.1; 0.05]
specifies to display
iterative optimization information, and [0.05; 0.1]
as presample
innovations.
ARCH0
— Initial coefficient estimates corresponding to past innovation terms
numeric vector
Initial coefficient estimates corresponding to past innovation terms,
specified as the comma-separated pair consisting of
'ARCH0'
and a numeric vector.
For GARCH(P,Q) and GJR(P,Q) models:
ARCH0
must be a numeric vector containing nonnegative elements.ARCH0
contains the initial coefficient estimates associated with the past squared innovation terms that compose the ARCH polynomial.By default,
estimate
derives initial estimates using standard time series techniques.
For EGARCH(P,Q) models:
ARCH0
contains the initial coefficient estimates associated with the magnitude of the past standardized innovations that compose the ARCH polynomial.By default,
estimate
sets the initial coefficient estimate associated with the first nonzero lag in the model to a small positive value. All other values are zero.
The number of coefficients in ARCH0
must equal the
number of lags associated with nonzero coefficients in the ARCH
polynomial, as specified in the ARCHLags
property of
Mdl
.
Data Types: double
Constant0
— Initial conditional variance model constant estimate
numeric scalar
Initial conditional variance model constant estimate, specified as the
comma-separated pair consisting of 'Constant0'
and a
numeric scalar.
For GARCH(P,Q) and
GJR(P,Q) models,
Constant0
must be a positive scalar.
By default, estimate
derives initial
estimates using standard time series techniques.
Data Types: double
Display
— Command Window display option
'params'
(default) | 'diagnostics'
| 'full'
| 'iter'
| 'off'
| string vector | cell vector of character vectors
Command Window display option, specified as the comma-separated pair consisting of 'Display'
and one or more of the values in this table.
Value | Information Displayed |
---|---|
'diagnostics' | Optimization diagnostics |
'full' | Maximum likelihood parameter estimates, standard errors, t statistics, iterative optimization information, and optimization diagnostics |
'iter' | Iterative optimization information |
'off' | None |
'params' | Maximum likelihood parameter estimates, standard errors, and t statistics |
Example: 'Display','off'
is well suited for running a simulation that estimates many models.
Example: 'Display',{'params','diagnostics'}
displays all estimation results and the optimization diagnostics.
Data Types: char
| cell
| string
DoF0
— Initial estimate of t-distribution degrees-of-freedom parameter
10
(default) | positive scalar
Initial estimate of the t-distribution degrees-of-freedom parameter ν, specified as the comma-separated pair consisting of 'DoF0'
and a positive scalar. DoF0
must exceed 2.
Data Types: double
E0
— Presample innovations
numeric column vector
Presample innovations, specified as the comma-separated pair
consisting of 'E0'
and a numeric column vector. The
presample innovations provide initial values for the innovations process
of the conditional variance model Mdl
. The
presample innovations derive from a distribution with mean 0.
E0
must contain at least Mdl.Q
rows. If E0
contains extra rows, then
estimate
uses the latest Mdl.Q
presample innovations. The last row contains the latest presample
innovation.
The defaults are:
For GARCH(P,Q) and GJR(P,Q) models,
estimate
sets any necessary presample innovations to the square root of the average squared value of the offset-adjusted response seriesy
.For EGARCH(P,Q) models,
estimate
sets any necessary presample innovations to zero.
Data Types: double
GARCH0
— Initial coefficient estimates for past conditional variance terms
numeric vector
Initial coefficient estimates for past conditional variance terms,
specified as the comma-separated pair consisting of
'GARCH0'
and a numeric vector.
For GARCH(P,Q) and GJR(P,Q) models:
GARCH0
must be a numeric vector containing nonnegative elements.GARCH0
contains the initial coefficient estimates associated with the past conditional variance terms that compose the GARCH polynomial.
For EGARCH(P,Q) models,
GARCH0
contains the initial coefficient estimates associated with past log conditional variance terms that compose the GARCH polynomial.
The number of coefficients in GARCH0
must equal the
number of lags associated with nonzero coefficients in the GARCH
polynomial, as specified in the GARCHLags
property of
Mdl
.
By default, estimate
derives initial
estimates using standard time series techniques.
Data Types: double
Offset0
— Initial innovation mean model offset estimate
scalar
Initial innovation mean model offset estimate, specified as the
comma-separated pair consisting of 'Offset0'
and a
scalar.
By default, estimate
sets the initial estimate to
the sample mean of y
.
Data Types: double
Options
— Optimization options
optimoptions
optimization controller
Optimization options, specified as the comma-separated pair consisting of 'Options'
and an optimoptions
optimization controller. For details on modifying the default values of the optimizer, see optimoptions
or fmincon
in Optimization Toolbox™.
For example, to change the constraint tolerance to 1e-6
, set Options = optimoptions(@fmincon,'ConstraintTolerance',1e-6,'Algorithm','sqp')
. Then, pass Options
into estimate
using 'Options',Options
.
By default, estimate
uses the same default options as fmincon
, except Algorithm
is 'sqp'
and ConstraintTolerance
is 1e-7
.
V0
— Presample conditional variances
numeric column vector with positive entries
Presample conditional variances, specified as the comma-separated pair
consisting of 'V0'
and numeric column vector with
positive entries. V0
provide initial values for
conditional variance process of the conditional variance model
Mdl
.
For GARCH(P,Q) and
GJR(P,Q) models,
V0
must have at least Mdl.P
rows.
For EGARCH(P,Q)
models,V0
must have at least
max(Mdl.P,Mdl.Q)
rows.
If the number of rows in V0
exceeds the necessary
number, only the latest observations are used. The last row contains the
latest observation.
By default, estimate
sets the necessary presample
conditional variances to the average squared value of the
offset-adjusted response series y
.
Data Types: double
Leverage0
— Initial coefficient estimates past leverage terms
0
(default) | numeric vector
Initial coefficient estimates past leverage terms, specified as the
comma-separated pair consisting of 'Leverage0'
and a
numeric vector.
For EGARCH(P,Q) models,
Leverage0
contains the initial coefficient
estimates associated with past standardized innovation terms that
compose the leverage polynomial.
For GJR(P,Q) models,
Leverage0
contains the initial coefficient
estimates associated with past, squared, negative innovations that
compose the leverage polynomial.
The number of coefficients in Leverage0
must equal
the number of lags associated with nonzero coefficients in the leverage
polynomial (Leverage
), as specified in
LeverageLags
.
Data Types: double
Notes
NaN
s in the presample or estimation data indicate missing data, andestimate
removes them. The software merges the presample data (E0
andV0
) separately from the effective sample data (y
), and then uses list-wise deletion to remove rows containing at least oneNaN
. RemovingNaN
s in the data reduces the sample size, and can also create irregular time series.estimate
assumes that you synchronize the presample data such that the latest observations occur simultaneously.If you specify a value for
Display
, then it takes precedence over the specifications of the optimization optionsDiagnostics
andDisplay
. Otherwise,estimate
honors all selections related to the display of optimization information in the optimization options.If you do not specify
E0
andV0
, thenestimate
derives the necessary presample observations from the unconditional, or long-run, variance of the offset-adjusted response process.For all conditional variance models,
V0
is the sample average of the squared disturbances of the offset-adjusted response datay
.For GARCH(P,Q) and GJR(P,Q) models,
E0
is the square root of the average squared value of the offset-adjusted response seriesy
.For EGARCH(P,Q) models,
E0
is0
.
These specifications minimize initial transient effects.
Output Arguments
EstMdl
— Conditional variance model containing parameter estimates
garch
model object | egarch
model object | gjr
model object
Conditional variance model containing parameter estimates, returned as a
garch
, egarch
, or gjr
model object.
estimate
uses maximum likelihood to calculate all
parameter estimates not constrained by Mdl
(i.e.,
constrained parameters have known values).
EstMdl
is a fully specified conditional variance model.
To infer conditional variances for diagnostic checking, pass
EstMdl
to infer
. To simulate or forecast
conditional variances, pass EstMdl
to simulate
or forecast
, respectively.
EstParamCov
— Variance-covariance matrix of maximum likelihood estimates
numeric matrix
Variance-covariance matrix of maximum likelihood estimates of model parameters known to the optimizer, returned as a numeric matrix.
The rows and columns associated with any parameters estimated by maximum likelihood contain the covariances of estimation error. The standard errors of the parameter estimates are the square root of the entries along the main diagonal.
The rows and columns associated with any parameters that are held fixed as
equality constraints contain 0
s.
estimate
uses the outer product of
gradients (OPG) method to perform covariance matrix
estimation.
estimate
orders the parameters in
EstParamCov
as follows:
Constant
Nonzero GARCH coefficients at positive lags
Nonzero ARCH coefficients at positive lags
For EGARCH and GJR models, nonzero leverage coefficients at positive lags
Degrees of freedom (t innovation distribution only)
Offset (models with nonzero offset only)
Data Types: double
logL
— Optimized loglikelihood objective function value
scalar
Optimized loglikelihood objective function value, returned as a scalar.
Data Types: double
info
— Optimization summary
structure array
Optimization summary, returned as a structure array with the fields described in this table.
Field | Description |
---|---|
exitflag | Optimization exit flag (see fmincon in Optimization Toolbox) |
options | Optimization options controller (see optimoptions and fmincon in Optimization Toolbox) |
X | Vector of final parameter estimates |
X0 | Vector of initial parameter estimates |
For example, you can display the vector of final estimates by entering info.X
in the Command Window.
Data Types: struct
Tips
References
[1] Bollerslev, Tim. “Generalized Autoregressive Conditional Heteroskedasticity.” Journal of Econometrics 31 (April 1986): 307–27. https://doi.org/10.1016/0304-4076(86)90063-1.
[2] Bollerslev, Tim. “A Conditionally Heteroskedastic Time Series Model for Speculative Prices and Rates of Return.” The Review of Economics and Statistics 69 (August 1987): 542–47. https://doi.org/10.2307/1925546.
[3] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.
[4] Enders, W. Applied Econometric Time Series. Hoboken, NJ: John Wiley & Sons, 1995.
[5] Engle, Robert. F. “Autoregressive Conditional Heteroscedasticity with Estimates of the Variance of United Kingdom Inflation.” Econometrica 50 (July 1982): 987–1007. https://doi.org/10.2307/1912773.
[6] Glosten, L. R., R. Jagannathan, and D. E. Runkle. “On the Relation between the Expected Value and the Volatility of the Nominal Excess Return on Stocks.” The Journal of Finance. Vol. 48, No. 5, 1993, pp. 1779–1801.
[7] Greene, W. H. Econometric Analysis. 3rd ed. Upper Saddle River, NJ: Prentice Hall, 1997.
[8] Hamilton, James D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
Version History
Introduced in R2012a
See Also
Objects
Functions
Topics
- Compare Conditional Variance Models Using Information Criteria
- Likelihood Ratio Test for Conditional Variance Models
- Estimate Conditional Mean and Variance Model
- Maximum Likelihood Estimation for Conditional Variance Models
- Conditional Variance Model Estimation with Equality Constraints
- Presample Data for Conditional Variance Model Estimation
- Initial Values for Conditional Variance Model Estimation
- Optimization Settings for Conditional Variance Model Estimation
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)