## Methods for Steady State of DRIPs

`DRIPs.Drip`

— Type**Summary**

A [Mutable] Structure for LQG Dynamic Rational Inattention Problems (DRIPs)

**Fields**

**Primitives of the DRIP**

```
ω : Cost of information
β : Discount factor
A : Transition matrix: x=Ax+Qu
Q : Std. Dev. matrix: x=Ax+Qu
H : Mapping of shocks to actions: v=-0.5(a'-x'H)(a-H'x)
```

**Solution of the DRIP in the Steady State**

```
K : Kalman gain matrix
Y : Weight vector for evolution of actions
Σ_z : Covariance matrix of the rational inattention error
Σ_p : Steady-state posterior covariance matrix under the solution
Σ_1 : Steady-state prior covariance matrix under the solution
Ω : Dynamic benefit matrix
err : Convergence error for the solution
```

`DRIPs.solve_drip`

— Method```
solve_drip(ω,β,A,Q,H;
fcap = false,
Ω0 = H*H',
Σ0 = A*A'+Q*Q',
w = 1,
tol = 1e-4,
maxit = 10000) -> Drip
```

Solves for the steady state of a Dynamic Rational Inattention Problem (DRIP) defined by the arguments. See Afrouzi and Yang (2019) for details.

**Arguments**

The function takes the primitives of the Drip as arguments:

```
* ω : Cost of information
* β : Discount factor
* A : Transition matrix: x=Ax+Qu
* Q : Std. Dev. matrix: x=Ax+Qu
* H : Mapping of shocks to actions: v=-0.5(a'-x'H)(a-H'x)
```

**Optional Arguments**

Default values are set unless specified otherwise by user.

```
* fcap = false [if `true` then solves the problem with fixed capacity = ω bits]
* Ω0 = H*H' [initial guess for steady state information matrix]
* Σ0 = A*A'+Q*Q'[initial guess for steady state prior]
* w = 1 [updating weight on the new guess in iteration]
* tol = 1e-4 [tolerance level for convergence]
* maxit = 10000 [maximum number of iterations]
```

**Outputs**

The function returns a `Drip`

structure with the primitives and the solution objects:

```
* Y : Weight vector for evolution of actions
* Σ_z : Covariance matrix of the rational inattention error
* K : Kalman gain matrix
* Σ_1 : Steady-state prior covariance matrix under the solution
* Σ_p : Steady-state posterior covariance matrix under the solution
* Ω : Dynamic benefit matrix
```

**Examples**

`julia> P = solve_drip(ω,β,A,Q,H)`

`DRIPs.solve_drip`

— Method`solve_drip(P::Drip;...) -> Drip`

Same as above but infers `ω,β,A,Q`

and `H`

from `P`

and returns a `Drip`

structure with the primitives and the solution.

**Examples**

```
julia> P = Drip(ω,β,A,Q,H)
julia> P = solve_drip(P)
```

## Methods for Transition dynamics of DRIPs

`DRIPs.Signal`

— Type**Summary**

A Signal Structure for Information Treatments in DRIPs. The structure encodes the signal `S = L'*x+z, z₀~N(0,Σ_z)`

.

**Fields**

- L : loading of the signal on
`x`

- Σ_z : variance covariance matrix of the noise

`DRIPs.Trip`

— Type**Summary**

A Structure for the Transition dynamics of Rational Inattention Problems (TRIPs)

**Fields**

```
P : a DRIP structure with its primitives and steady state solution
T : length of TRIP
Σ_1s : sequence of prior covariance matrices
Σ_ps : sequence of posterior covariance matrices
Ωs : sequence of information benefit matrices
Ds : eigenvalues of Σ_t^(0.5)Ω_tΣ_t^(0.5) over time (marginal values of information)
err : convergence err
```

`DRIPs.solve_trip`

— Method```
solve_trip(Ss::Drip, # steady state of D.R.I.P.
Σ0::Array{Float64,2}; # initial prior matrix
T = 100, # optional: guess for time until convergence to steady state
tol = 1e-4, # optional: tolerance for convergence
maxit = 1000 # optional: max iterations
) -> Trip
```

Solves for the transition dynamics of the optimal information structure starting from the initial prior distribution with covariance matrix `Σ0`

. See Afrouzi and Yang (2019) for details.

**Outputs**

Returns a `Trip`

structure with the steady state and transition path of the optimal information structure.

**Examples**

```
julia> Ss = solve_drip(ω,β,A,Q,H)
julia> Σ0 = 0.1*Ss.Σ_1;
julia> Pt = solve_trip(Ss,Σ0);
```

`DRIPs.solve_trip`

— Method```
solve_trip(Ss::Drip, # steady state of D.R.I.P.
S::Signal; # information treatment in the steady state
T = 100, # optional: guess for time until convergence to steady state
tol = 1e-4, # optional: tolerance for convergence
maxit = 1000 # optional: max iterations
) -> Trip
```

Solves for the transition dynamics of the optimal information structure starting from a one time treatment with a signal `S`

in the steady state. See Afrouzi and Yang (2019) for details.

**Outputs**

Returns a `Trip`

structure with the steady state and transition path of the optimal information structure.

**Examples**

```
julia> Ss = solve_drip(ω,β,A,Q,H)
julia> S = Signal(L,Σ_z);
julia> Pt = solve_trip(Ss,S);
```

## Methods for Impulse Response Functions

`DRIPs.Dripirfs`

— Type**Summary**

A Structure for the impulse response functions of DRIPs

**Fields**

```
T : length of IRFs
x : IRFs of the fundamental shocks
x_hat : IRFs of beliefs
a : IRFs of actions
```

In particular, if `n`

is the dimension of `x`

, `m`

is the dimension of `a`

and `k`

is the number of structural shocks, then

`x`

has dimension`n*k*T`

where`x(i,j,:)`

is the impulse response function of the`i`

'th dimension of`x`

to the`j`

'th structural shock.`x_hat`

has dimension`n*k*T`

where`x_hat(i,j,:)`

is the impulse response function of the agent's average belief about the`i`

'th dimension of`x`

to the`j`

'th structural shock.`a`

has dimension`m*k*T`

where`a(i,j,:)`

is the impulse response function of the`i`

'th action to the`j`

'th structural shock.

`DRIPs.dripirfs`

— Method```
dripirfs(Ss::Drip, # Steady state of the DRIP (when treatment happens)
S::Signal; # Signal for treatment at time 0
T = 40, # optional: length of irfs
reoptimize = true, # optional: if true gives the irfs with reoptimized signals, if false with steady state signals
trip = false # optional: if false solves for the optimal trip, if = P::trip then takes P as the transition dynamics after treatment
) -> Dripirfs
```

Returns a `Dripirfs`

structure with the impulse response functions of the fundamental (`x`

), beliefs (`x_hat`

) and actions (`a`

) to all the structural shocks **under the information structure implied by a one time information treatment with** `S`

**in the steady state of the DRIP** `P`

. In particular, if `n`

is the dimension of `x`

, `m`

is the dimension of `a`

and `k`

is the number of structural shocks, then

`x`

has dimension`n*k*T`

where`x(i,j,:)`

is the impulse response function of the`i`

'th dimension of`x`

to the`j`

'th structural shock.`x_hat`

has dimension`n*k*T`

where`x_hat(i,j,:)`

is the impulse response function of the agent's average belief about the`i`

'th dimension of`x`

to the`j`

'th structural shock.`a`

has dimension`m*k*T`

where`a(i,j,:)`

is the impulse response function of the`i`

'th action to the`j`

'th structural shock.

`DRIPs.dripirfs`

— Method```
dripirfs(P::Drip; # Steady state of the DRIP
T = 40 # Optional: length of impulse response functions
) -> Dripirfs
```

Returns a `Dripirfs`

structure with the impulse response functions of the fundamental (`x`

), beliefs (`x_hat`

) and actions (`a`

) to all the structural shocks **under the steady state information strucutre**. In particular, if `n`

is the dimension of `x`

, `m`

is the dimension of `a`

and `k`

is the number of structural shocks, then

`x`

has dimension`n*k*T`

where`x(i,j,:)`

is the impulse response function of the`i`

'th dimension of`x`

to the`j`

'th structural shock.`x_hat`

has dimension`n*k*T`

where`x_hat(i,j,:)`

is the impulse response function of the agent's average belief about the`i`

'th dimension of`x`

to the`j`

'th structural shock.`a`

has dimension`m*k*T`

where`a(i,j,:)`

is the impulse response function of the`i`

'th action to the`j`

'th structural shock.

`DRIPs.dripirfs`

— Method```
dripirfs(P::Trip; # Transition dynamics of the DRIP
T = 40 # Optional: length of impulse response functions
) -> Dripirfs
```

Returns a `Dripirfs`

structure with the impulse response functions of the fundamental (`x`

), beliefs (`x_hat`

) and actions (`a`

) to all the structural shocks **under the information structure implied by** `P`

. In particular, if `n`

is the dimension of `x`

, `m`

is the dimension of `a`

and `k`

is the number of structural shocks, then

`x`

has dimension`n*k*T`

where`x(i,j,:)`

is the impulse response function of the`i`

'th dimension of`x`

to the`j`

'th structural shock.`x_hat`

has dimension`n*k*T`

where`x_hat(i,j,:)`

is the impulse response function of the agent's average belief about the`i`

'th dimension of`x`

to the`j`

'th structural shock.`a`

has dimension`m*k*T`

where`a(i,j,:)`

is the impulse response function of the`i`

'th action to the`j`

'th structural shock.

## Methods for Simulating DRIPs

`DRIPs.dripsims`

— Method```
dripsims(P::Drip; # Steady state of the DRIP
T = 500, # Optional: length of simulation
N = 1, # Optional: number of simulated agents
burn = 100, # Optional: length of initial burn (in addition to T)
seed = true # Optional: seed number for fundamental shocks
) -> Dripirfs
```

Returns a `Dripirfs`

structure with a simulated path of the fundamental (`x`

), beliefs (`x_hat`

) and actions (`a`

) **under the steady state information structure**. In particular, if `n`

is the dimension of `x`

and `m`

is the dimension of `a`

, then

`x`

has dimension`n*T`

where`x(:,t)`

is the simulated value of`x`

at time`t`

.`x_hat`

has dimension`n*N*T`

where`x_hat(:,i,t)`

is the simulated value of`x_hat`

of agent`i`

at time`t`

.`a`

has dimension`m*N*T`

where`a(:,i,t)`

is the the simulated value of`x_hat`

of agent`i`

at time`t`

.

## Aux. Functions

`DRIPs.capacity`

— Method```
capacity(P::Drip; # Drip structure
unit = "bit" # optional: unit of capacity (bit or nat).
)
```

Returns the amount of information processes per unit of time in the steady state of the DRIP `P`

.

`DRIPs.getreal`

— Method`getreal(M)`

Returns the real part of `M`

(Same as `real.(M)`

).

`DRIPs.infinitesum`

— Method`infinitesum(func; tol = 1e-6,maxit = 1000,start=0)`

Returns the infinite sum `Σₓfunc(x)`

starting from `x = start`

up to tolderance `tol`

or max iteration `maxit`

.