comparison scripts/signal/arch_fit.m @ 3449:858695b3ed62

[project @ 2000-01-18 04:08:59 by jwe]
author jwe
date Tue, 18 Jan 2000 04:09:14 +0000
parents f8dde1807dee
children e031284eea27
comparison
equal deleted inserted replaced
3448:0fb75d95b14f 3449:858695b3ed62
12 ## 12 ##
13 ## You should have received a copy of the GNU General Public License 13 ## You should have received a copy of the GNU General Public License
14 ## along with this file. If not, write to the Free Software Foundation, 14 ## along with this file. If not, write to the Free Software Foundation,
15 ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 16
17 ## usage: [a, b] = arch_fit (y, X, p [, ITER [, gamma [, a0, b0]]]) 17 ## -*- texinfo -*-
18 ## @deftypefn {Function File} {[@var{a}, @var{b}] =} arch_fit (@var{y}, @var{x}, @var{p}, @var{iter}, @var{gamma}, @var{a0}, @var{b0})
19 ## Fit an ARCH regression model to the time series @var{y} using the
20 ## scoring algorithm in Engle's original ARCH paper. The model is
18 ## 21 ##
19 ## Fits an ARCH regression model to the time series y using the scoring 22 ## @example
20 ## algorithm in Engle's original ARCH paper. The model is 23 ## y(t) = b(1) * x(t,1) + ... + b(k) * x(t,k) + e(t),
21 ## y(t) = b(1) * x(t,1) + ... + b(k) * x(t,k) + e(t), 24 ## h(t) = a(1) + a(2) * e(t-1)^2 + ... + a(p+1) * e(t-p)^2
22 ## h(t) = a(1) + a(2) * e(t-1)^2 + ... + a(p+1) * e(t-p)^2, 25 ## @end example
23 ## where e(t) is N(0, h(t)), given y up to time t-1 and X up to t.
24 ## 26 ##
25 ## If invoked as arch_fit (y, k, p) with a positive integer k, fit an 27 ## @noindent
26 ## ARCH(k,p) process, i.e., do the above with the t-th row of X given by 28 ## in which @var{e}(@var{t}) is @var{N}(0, @var{h}(@var{t})), given a
27 ## [1, y(t-1), ..., y(t-k)]. 29 ## time-series vector @var{y} up to time @var{t}-1 and a matrix of
30 ## (ordinary) regressors @var{x} up to @var{t}. The order of the
31 ## regression of the residual variance is specified by @var{p}.
28 ## 32 ##
29 ## Optionally, one can specify the number of iterations ITER, the 33 ## If invoked as @code{arch_fit (@var{y}, @var{k}, @var{p})} with a
30 ## updating factor gamma, and initial values a0 and b0 for the scoring 34 ## positive integer @var{k}, fit an ARCH(@var{k}, @var{p}) process,
31 ## algorithm. 35 ## i.e., do the above with the @var{t}-th row of @var{x} given by
32 ## 36 ##
33 ## The input parameters are: 37 ## @example
34 ## y ... time series (vector) 38 ## [1, y(t-1), ..., y(t-k)]
35 ## X ... matrix of (ordinary) regressors or order of 39 ## @end example
36 ## autoregression 40 ##
37 ## p ... order of the regression of the residual variance 41 ## Optionally, one can specify the number of iterations @var{iter}, the
42 ## updating factor @var{gamma}, and initial values @var{a0} and @var{b0}
43 ## for the scoring algorithm.
44 ## @end deftypefn
38 45
39 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> 46 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at>
40 ## Description: Fit an ARCH regression model 47 ## Description: Fit an ARCH regression model
41 48
42 function [a, b] = arch_fit (y, X, p, ITER, gamma, a0, b0) 49 function [a, b] = arch_fit (y, X, p, ITER, gamma, a0, b0)
43 50
44 if ((nargin < 3) || (nargin == 6) || (nargin > 7)) 51 if ((nargin < 3) || (nargin == 6) || (nargin > 7))
45 usage ("arch_fit (y, X, p [, ITER [, gamma [, a0, b0]]])"); 52 usage ("arch_fit (y, X, p, ITER, gamma, a0, b0)");
46 endif 53 endif
47 54
48 if !(is_vector (y)) 55 if !(is_vector (y))
49 error ("arch_test: y must be a vector"); 56 error ("arch_test: y must be a vector");
50 endif 57 endif