robustlq

class quantecon.robustlq.RBLQ(Q, R, A, B, C, beta, theta)[source]

Bases: object

Provides methods for analysing infinite horizon robust LQ control problems of the form

\[\min_{u_t} \sum_t \beta^t {x_t' R x_t + u_t' Q u_t }\]

subject to

\[x_{t+1} = A x_t + B u_t + C w_{t+1}\]

and with model misspecification parameter theta.

Parameters:
Qarray_like(float, ndim=2)

The cost(payoff) matrix for the controls. See above for more. Q should be k x k and symmetric and positive definite

Rarray_like(float, ndim=2)

The cost(payoff) matrix for the state. See above for more. R should be n x n and symmetric and non-negative definite

Aarray_like(float, ndim=2)

The matrix that corresponds with the state in the state space system. A should be n x n

Barray_like(float, ndim=2)

The matrix that corresponds with the control in the state space system. B should be n x k

Carray_like(float, ndim=2)

The matrix that corresponds with the random process in the state space system. C should be n x j

betascalar(float)

The discount factor in the robust control problem

thetascalar(float)

The robustness factor in the robust control problem

Attributes:
Q, R, A, B, C, beta, thetasee Parameters
k, n, jscalar(int)

The dimensions of the matrices

Methods

F_to_K(F[, method])

Compute agent 2's best cost-minimizing response K, given F.

K_to_F(K[, method])

Compute agent 1's best value-maximizing response F, given K.

b_operator(P)

The B operator, mapping P into

compute_deterministic_entropy(F, K, x0)

Given K and F, compute the value of deterministic entropy, which is

d_operator(P)

The D operator, mapping P into

evaluate_F(F)

Given a fixed policy F, with the interpretation \(u = -F x\), this function computes the matrix \(P_F\) and constant \(d_F\) associated with discounted cost \(J_F(x) = x' P_F x + d_F\)

robust_rule([method])

This method solves the robust control problem by tricking it into a stacked LQ problem, as described in chapter 2 of Hansen- Sargent's text "Robustness." The optimal control with observed state is

robust_rule_simple([P_init, max_iter, tol])

A simple algorithm for computing the robust policy F and the corresponding value function P, based around straightforward iteration with the robust Bellman operator.

F_to_K(F, method='doubling')[source]

Compute agent 2’s best cost-minimizing response K, given F.

Parameters:
Farray_like(float, ndim=2)

A k x n array

methodstr, optional(default=’doubling’)

Solution method used in solving the associated Riccati equation, str in {‘doubling’, ‘qz’}.

Returns:
Karray_like(float, ndim=2)

Agent’s best cost minimizing response for a given F

Parray_like(float, ndim=2)

The value function for a given F

K_to_F(K, method='doubling')[source]

Compute agent 1’s best value-maximizing response F, given K.

Parameters:
Karray_like(float, ndim=2)

A j x n array

methodstr, optional(default=’doubling’)

Solution method used in solving the associated Riccati equation, str in {‘doubling’, ‘qz’}.

Returns:
Farray_like(float, ndim=2)

The policy function for a given K

Parray_like(float, ndim=2)

The value function for a given K

b_operator(P)[source]

The B operator, mapping P into

\[B(P) := R - \beta^2 A'PB(Q + \beta B'PB)^{-1}B'PA + \beta A'PA\]

and also returning

\[F := (Q + \beta B'PB)^{-1} \beta B'PA\]
Parameters:
Parray_like(float, ndim=2)

A matrix that should be n x n

Returns:
Farray_like(float, ndim=2)

The F matrix as defined above

new_parray_like(float, ndim=2)

The matrix P after applying the B operator

compute_deterministic_entropy(F, K, x0)[source]

Given K and F, compute the value of deterministic entropy, which is

\[\sum_t \beta^t x_t' K'K x_t`\]

with

\[x_{t+1} = (A - BF + CK) x_t\]
Parameters:
Farray_like(float, ndim=2)

The policy function, a k x n array

Karray_like(float, ndim=2)

The worst case matrix, a j x n array

x0array_like(float, ndim=1)

The initial condition for state

Returns:
escalar(int)

The deterministic entropy

d_operator(P)[source]

The D operator, mapping P into

\[D(P) := P + PC(\theta I - C'PC)^{-1} C'P.\]
Parameters:
Parray_like(float, ndim=2)

A matrix that should be n x n

Returns:
dParray_like(float, ndim=2)

The matrix P after applying the D operator

evaluate_F(F)[source]

Given a fixed policy F, with the interpretation \(u = -F x\), this function computes the matrix \(P_F\) and constant \(d_F\) associated with discounted cost \(J_F(x) = x' P_F x + d_F\)

Parameters:
Farray_like(float, ndim=2)

The policy function, a k x n array

Returns:
P_Farray_like(float, ndim=2)

Matrix for discounted cost

d_Fscalar(float)

Constant for discounted cost

K_Farray_like(float, ndim=2)

Worst case policy

O_Farray_like(float, ndim=2)

Matrix for discounted entropy

o_Fscalar(float)

Constant for discounted entropy

robust_rule(method='doubling')[source]

This method solves the robust control problem by tricking it into a stacked LQ problem, as described in chapter 2 of Hansen- Sargent’s text “Robustness.” The optimal control with observed state is

\[u_t = - F x_t\]

And the value function is \(-x'Px\)

Parameters:
methodstr, optional(default=’doubling’)

Solution method used in solving the associated Riccati equation, str in {‘doubling’, ‘qz’}.

Returns:
Farray_like(float, ndim=2)

The optimal control matrix from above

Parray_like(float, ndim=2)

The positive semi-definite matrix defining the value function

Karray_like(float, ndim=2)

the worst-case shock matrix K, where \(w_{t+1} = K x_t\) is the worst case shock

robust_rule_simple(P_init=None, max_iter=80, tol=1e-08)[source]

A simple algorithm for computing the robust policy F and the corresponding value function P, based around straightforward iteration with the robust Bellman operator. This function is easier to understand but one or two orders of magnitude slower than self.robust_rule(). For more information see the docstring of that method.

Parameters:
P_initarray_like(float, ndim=2), optional(default=None)

The initial guess for the value function matrix. It will be a matrix of zeros if no guess is given

max_iterscalar(int), optional(default=80)

The maximum number of iterations that are allowed

tolscalar(float), optional(default=1e-8)

The tolerance for convergence

Returns:
Farray_like(float, ndim=2)

The optimal control matrix from above

Parray_like(float, ndim=2)

The positive semi-definite matrix defining the value function

Karray_like(float, ndim=2)

the worst-case shock matrix K, where \(w_{t+1} = K x_t\) is the worst case shock