2333
|
1 @c Copyright (C) 1996 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, Quadrature, 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 @ftable @code |
|
26 @item qpsol |
|
27 |
|
28 @example |
|
29 [x, obj, info, lambda] |
|
30 = qpsol (x, H, c, lb, ub, lb, A, ub) |
|
31 @end example |
|
32 Solve quadratic programs using Gill and Murray's QPSOL. Because QPSOL |
|
33 is not freely redistributable, this function is only available if you |
|
34 have obtained your own copy of QPSOL. @xref{Installation}. |
|
35 @end ftable |
|
36 |
|
37 @findex qpsol_options |
|
38 Tolerances and other options for @code{qpsol} may be specified using the |
|
39 function @code{qpsol_options}. |
|
40 |
|
41 @node Nonlinear Programming, Linear Least Squares, Quadratic Programming, Optimization |
|
42 @section Nonlinear Programming |
|
43 |
|
44 @ignore |
|
45 @ftable @code |
|
46 @item fsqp |
|
47 |
|
48 @example |
|
49 fsqp () |
|
50 @end example |
|
51 |
|
52 @findex fsqp_options |
|
53 Tolerances and other options for @code{fsqp} may be specified using the |
|
54 function @code{fsqp_options}. |
|
55 |
|
56 Sorry, this hasn't been implemented yet. |
|
57 @end ignore |
|
58 |
|
59 @ftable @code |
|
60 @item npsol |
|
61 |
|
62 @example |
|
63 [x, obj, info, lambda] |
|
64 = npsol (x, 'phi', lb, ub, lb, A, ub, lb, 'g', ub) |
|
65 @end example |
|
66 Solve nonlinear programs using Gill and Murray's NPSOL. Because NPSOL |
|
67 is not freely redistributable, this function is only available if you |
|
68 have obtained your own copy of NPSOL. @xref{Installation}. |
|
69 |
|
70 The second argument is a string containing the name of the objective |
|
71 function to call. The objective function must be of the form |
|
72 |
|
73 @example |
|
74 y = phi (x) |
|
75 @end example |
|
76 |
|
77 @noindent |
|
78 where x is a vector and y is a scalar. |
|
79 @end ftable |
|
80 |
|
81 @findex npsol_options |
|
82 Tolerances and other options for @code{npsol} may be specified using the |
|
83 function @code{npsol_options}. |
|
84 |
|
85 @node Linear Least Squares, , Nonlinear Programming, Optimization |
|
86 @section Linear Least Squares |
|
87 |
|
88 @ftable @code |
|
89 @item gls (@var{Y}, @var{X}, @var{O}) |
|
90 Generalized least squares (GLS) estimation for the multivariate model |
|
91 |
|
92 @example |
|
93 Y = X * B + E, mean(E) = 0, cov(vec(E)) = (s^2)*O |
|
94 @end example |
|
95 |
|
96 @noindent |
|
97 with |
|
98 |
|
99 @example |
|
100 Y an T x p matrix |
|
101 X an T x k matrix |
|
102 B an k x p matrix |
|
103 E an T x p matrix |
|
104 O an Tp x Tp matrix |
|
105 @end example |
|
106 |
|
107 @noindent |
|
108 Each row of Y and X is an observation and each column a variable. |
|
109 |
|
110 Returns BETA, v, and, R, where BETA is the GLS estimator for B, v is the |
|
111 GLS estimator for s^2, and R = Y - X*BETA is the matrix of GLS residuals. |
|
112 |
|
113 @item ols (@var{Y}, @var{X}) |
|
114 Ordinary Least Squares (OLS) estimation for the multivariate model |
|
115 |
|
116 @example |
|
117 Y = X*B + E, mean (E) = 0, cov (vec (E)) = kron (S, I) |
|
118 @end example |
|
119 |
|
120 @noindent |
|
121 with |
|
122 |
|
123 @example |
|
124 Y an T x p matrix |
|
125 X an T x k matrix |
|
126 B an k x p matrix |
|
127 E an T x p matrix |
|
128 @end example |
|
129 |
|
130 @noindent |
|
131 Each row of Y and X is an observation and each column a variable. |
|
132 |
|
133 Returns BETA, SIGMA, and R, where BETA is the OLS estimator for B, i.e. |
|
134 |
|
135 @example |
|
136 BETA = pinv(X)*Y, |
|
137 @end example |
|
138 |
|
139 @noindent |
|
140 where pinv(X) denotes the pseudoinverse of X, SIGMA is the OLS estimator |
|
141 for the matrix S, i.e. |
|
142 |
|
143 @example |
|
144 SIGMA = (Y - X*BETA)'*(Y - X*BETA) / (T - rank(X)) |
|
145 @end example |
|
146 |
|
147 and R = Y - X*BETA is the matrix of OLS residuals. |
|
148 @end ftable |