# How to estimate the correlation between two shocks?

Hi Professor,
I want to estimate the standard deviations of two shock and also the correlation between them. Suppose I have two exogenous process:
a_t = rho_aa_{t-1}+e_a,
b_t = rho_b
b_{t-1}+e_b.
And the variance-covariance matrix of e_a and e_b is:

sigma_a^2, phisigma_asigmab;
phisigma_asigmab, sigma_b^2 ].

How should I estimate phi, sigma_a, and sigma_b simutanously? Is the following lines right?

[code]var a b;
varexo sigma_a sigma_b;
parameters phi rho_a rho_b;
rho_a=0.9;rho_b=0.9;phi=0.5;

model;
a = rho_aa(-1)+e_a;
b = rho_b
b(-1)+e_b;
end;

shocks;
var sigma_a; stderr 0.1;
var sigma_b; stderr 0.1;
var sigma_a, sigmab=phisigma_asigma_b;
end;

estimated_params;
stderr sigma_a, , 0.000000000001,100,INV_GAMMA2_PDF,0.1,2;
stderr sigma_b, , 0.000000000001,100,INV_GAMMA2_PDF,0.1,2;
phi, ,.00000001,.99999999999,BETA_PDF,0.33,0.23;
end;

estimated_params_init;
stderr sigma_a, 0.1;
stderr sigma_b, 0.1;
phi, 0.5;
end;

estimation(…);[/code]

Dynare can run the above code. But it seems that the value of phi doesn’t effect the result.
Can you help me? Thanks!

No, that won’t work, because the shocks-block set a numerical value, not a relationship. You need to use

```estimated_params; stderr sigma_a, , 0.000000000001,100,INV_GAMMA2_PDF,0.1,2; stderr sigma_b, , 0.000000000001,100,INV_GAMMA2_PDF,0.1,2; corr sigma_a, sigma_b, ,.00000001,.99999999999,BETA_PDF,0.33,0.23; end;```
See e.g. github.com/DynareTeam/dynare/blob/master/tests/TeX/fs2000_corr_ME.mod