3294
|
1 @c Copyright (C) 1996, 1997 John W. Eaton |
|
2 @c This is part of the Octave manual. |
|
3 @c For copying conditions, see the file gpl.texi. |
|
4 |
|
5 @node Optimization, Statistics, Differential Equations, Top |
|
6 @chapter Optimization |
|
7 |
|
8 @menu |
|
9 * Quadratic Programming:: |
|
10 * Nonlinear Programming:: |
|
11 * Linear Least Squares:: |
|
12 @end menu |
|
13 |
|
14 @c @cindex linear programming |
|
15 @cindex quadratic programming |
|
16 @cindex nonlinear programming |
|
17 @cindex optimization |
|
18 @cindex LP |
|
19 @cindex QP |
|
20 @cindex NLP |
|
21 |
|
22 @node Quadratic Programming, Nonlinear Programming, Optimization, Optimization |
|
23 @section Quadratic Programming |
|
24 |
|
25 @node Nonlinear Programming, Linear Least Squares, Quadratic Programming, Optimization |
|
26 @section Nonlinear Programming |
|
27 |
|
28 @node Linear Least Squares, , Nonlinear Programming, Optimization |
|
29 @section Linear Least Squares |
|
30 |
|
31 @deftypefn {Function File} {[@var{beta}, @var{v}, @var{r}] =} gls (@var{y}, @var{x}, @var{o}) |
|
32 Generalized least squares estimation for the multivariate model |
|
33 @iftex |
|
34 @tex |
|
35 $y = x b + e$ |
|
36 with $\bar{e} = 0$ and cov(vec($e$)) = $(s^2)o$, |
|
37 @end tex |
|
38 @end iftex |
|
39 @ifinfo |
|
40 @code{@var{y} = @var{x} * @var{b} + @var{e}} with @code{mean (@var{e}) = |
|
41 0} and @code{cov (vec (@var{e})) = (@var{s}^2)*@var{o}}, |
|
42 @end ifinfo |
|
43 where |
|
44 @iftex |
|
45 @tex |
|
46 $y$ is a $t \times p$ matrix, $x$ is a $t \times k$ matrix, $b$ is a $k |
|
47 \times p$ matrix, $e$ is a $t \times p$ matrix, and $o$ is a $tp \times |
|
48 tp$ matrix. |
|
49 @end tex |
|
50 @end iftex |
|
51 @ifinfo |
|
52 @var{Y} is a @var{T} by @var{p} matrix, @var{X} is a @var{T} by @var{k} |
|
53 matrix, @var{B} is a @var{k} by @var{p} matrix, @var{E} is a @var{T} by |
|
54 @var{p} matrix, and @var{O} is a @var{T}@var{p} by @var{T}@var{p} |
|
55 matrix. |
|
56 @end ifinfo |
|
57 |
|
58 @noindent |
|
59 Each row of Y and X is an observation and each column a variable. |
|
60 |
|
61 The return values @var{beta}, @var{v}, and @var{r} are defined as |
|
62 follows. |
|
63 |
|
64 @table @var |
|
65 @item beta |
|
66 The GLS estimator for @var{b}. |
|
67 |
|
68 @item v |
|
69 The GLS estimator for @code{@var{s}^2}. |
|
70 |
|
71 @item r |
|
72 The matrix of GLS residuals, @code{@var{r} = @var{y} - @var{x} * |
|
73 @var{beta}}. |
|
74 @end table |
|
75 @end deftypefn |
|
76 |
|
77 @deftypefn {Function File} {[@var{beta}, @var{sigma}, @var{r}] =} ols (@var{y}, @var{x}) |
|
78 Ordinary least squares estimation for the multivariate model |
|
79 @iftex |
|
80 @tex |
|
81 $y = x b + e$ |
|
82 with |
|
83 $\bar{e} = 0$, and cov(vec($e$)) = kron ($s, I$) |
|
84 @end tex |
|
85 @end iftex |
|
86 @ifinfo |
|
87 @code{@var{y} = @var{x}*@var{b} + @var{e}} with |
|
88 @code{mean (@var{e}) = 0} and @code{cov (vec (@var{e})) = kron (@var{s}, |
|
89 @var{I})}. |
|
90 @end ifinfo |
|
91 where |
|
92 @iftex |
|
93 @tex |
|
94 $y$ is a $t \times p$ matrix, $x$ is a $t \times k$ matrix, |
|
95 $b$ is a $k \times p$ matrix, and $e$ is a $t \times p$ matrix. |
|
96 @end tex |
|
97 @end iftex |
|
98 @ifinfo |
|
99 @var{y} is a @var{t} by @var{p} matrix, @var{X} is a @var{t} by @var{k} |
|
100 matrix, @var{B} is a @var{k} by @var{p} matrix, and @var{e} is a @var{t} |
|
101 by @var{p} matrix. |
|
102 @end ifinfo |
|
103 |
|
104 Each row of @var{y} and @var{x} is an observation and each column a |
|
105 variable. |
|
106 |
|
107 The return values @var{beta}, @var{sigma}, and @var{r} are defined as |
|
108 follows. |
|
109 |
|
110 @table @var |
|
111 @item beta |
|
112 The OLS estimator for @var{b}, @code{@var{beta} = pinv (@var{x}) * |
|
113 @var{y}}, where @code{pinv (@var{x})} denotes the pseudoinverse of |
|
114 @var{x}. |
|
115 |
|
116 @item sigma |
|
117 The OLS estimator for the matrix @var{s}, |
|
118 |
|
119 @example |
|
120 @group |
|
121 @var{sigma} = (@var{y}-@var{x}*@var{beta})' * (@var{y}-@var{x}*@var{beta}) / (@var{t}-rank(@var{x})) |
|
122 @end group |
|
123 @end example |
|
124 |
|
125 @item r |
|
126 The matrix of OLS residuals, @code{@var{r} = @var{y} - @var{x} * @var{beta}}. |
|
127 @end table |
|
128 @end deftypefn |