# Optimal simple rule

Dear Prof. Pfeifer,

I am having a bit of difficulty fully understanding how the optim_weights block works with the optimal simple rule.

In the user manual for the optimal policy package (attached), a variable in the optim-weights section only appears once (page 5). However, in a different example (below) from the Dynare optimal policy manual, inflation appears twice in this block and I don’t understand the purpose of its second appearance (with 0.5 next to it)?

var y inflation r;
varexo y_ inf_;

parameters delta sigma alpha kappa gammarr gammax0 gammac0 gamma_y_ gamma_inf_;

delta = 0.44;
kappa = 0.18;
alpha = 0.48;
sigma = -0.06;

gammarr = 0;
gammax0 = 0.2;
gammac0 = 1.5;
gamma_y_ = 8;
gamma_inf_ = 3;

model(linear);
y = delta * y(-1) + (1-delta)y(+1)+sigma (r - inflation(+1)) + y_;
inflation = alpha * inflation(-1) + (1-alpha) * inflation(+1) + kappa
y + inf_;
r = gammax0
y(-1)+gammac0*inflation(-1)+gamma_y_*y_+gamma_inf_*inf_;
end;

shocks;
var y_; stderr 0.63;
var inf_; stderr 0.4;
end;

optim_weights;
inflation 1;
y 1;
y, inflation 0.5;
end;

osr_params gammax0 gammac0 gamma_y_ gamma_inf_;
osr y;

My other questions are:
2) Must the shock I include in the shock block be associated with the equations for the variables I have in optim_weight (as in both examples) or can the shock be for another variable in my model, say a technology shock?
3) Does the weight of the first variable in the rule (‘y’ in both examples) have to be 1?
4) Also, do the weights simply just represent the relative importance you are placing on the variables in the rules. I ask because they don’t seem to sum to 1 or some value.

Many thanks
User manual for optimal policy package.pdf (170 KB)

As documented in the manual, the

block determines the weight placed on the respective variances and covariances. Thus,

```optim_weights; inflation 1; y 1; y, inflation 0.5; end; ```
means that the loss functin is given by

```L=1*var(y)+1*var(inflation)+0.5*cov(y,inflation) ```
where var denotes the unconditional variance and cov the covariance. The covariances are the reason a variable can appear multiple times in the block.

1. As typically any shock in the model will affect the variance of the controlled variables, it does not matter where you put the shock.
2. We are looking for a minimum in the loss function. Minima are invariant to multiplicative constants. Thus, what matters is the relative weight of the terms in the loss function, not their absolute value. An appropriate normalization is often to set the first term to 1 and specify all other weights relative to this.
3. Yes, see 3)
1 Like