
function [ssH, stdH, acrH, corH] = dyn_stats(M_,oo_,oo_sim)
 
  % STEADY STATE PROPERTIES
  
  SS = dyn_extract(M_,oo_);
  
  % Domestic
  ssH = struct(...
    'n',  SS.nH,...
    'c',  SS.cpctH,...
    'i',  SS.ipctH,...
    'im', SS.mpctH,...
    'xk', SS.iH/SS.KH...
    ); 
  
  % SIMULATED STATISTICS
  
  Nsim = size(oo_sim,1);  
  
  % Initialize matrices
  stdH  = zeros(Nsim,9);
  acrH  = zeros(Nsim,9);
  corH  = zeros(Nsim,17);

  for i=1:Nsim;

    [SS IRF SIM] = dyn_extract(M_,oo_,oo_sim(i,:,:)); %#ok<ASGLU>

    % Domestic standard deviations
    % (Relative to GDP)
    stdH(i,:) = [
     std(SIM.rgdpH).^2
     std(SIM.nH)  
     std(SIM.cH)   
     std(SIM.iH) 
     std(SIM.rexF)
     std(SIM.rexH)
     std(SIM.rnxH) 
     std(SIM.totH)
     std(SIM.rerH)
     ]./std(SIM.rgdpH)';
      
    % Domestic autocorrelations
    temp = [
      autocorr(SIM.rgdpH,1)'
      autocorr(SIM.nH,1)'
      autocorr(SIM.cH,1)'
      autocorr(SIM.iH,1)'
      autocorr(SIM.rexF,1)'
      autocorr(SIM.rexH,1)'
      autocorr(SIM.rnxH,1)'
      autocorr(SIM.totH,1)'
      autocorr(SIM.rerH,1)'
      ];
    acrH(i,:) = temp(:,2)';

    % Domestic correlations between variables
    corH(i,:) = [
     corr(SIM.rgdpH,SIM.nH) 
     corr(SIM.rgdpH,SIM.cH)
     corr(SIM.rgdpH,SIM.iH)
     corr(SIM.rgdpH,SIM.rexF)
     corr(SIM.rgdpH,SIM.rexH)
     corr(SIM.rgdpH,SIM.rnxH)
     corr(SIM.rgdpH,SIM.totH)
     corr(SIM.rgdpH,SIM.rerH)
     corr(SIM.cH,SIM.nH)
     corr(SIM.cH,SIM.iH)
     corr(SIM.rexH,SIM.rexF)
     corr(SIM.rgdpH,SIM.rgdpF)
     corr(SIM.nH,SIM.nF)
     corr(SIM.cH,SIM.cF)
     corr(SIM.iH,SIM.iF)
     corr(SIM.RCF,SIM.rerF)
     corr(SIM.rnxH,SIM.rnxF)
     ]';

  end
  
  % Labels
  labsd = {'gdp','n','c','i','im','ex','nx','tt','rer'};
  labac = {'gdp','n','c','i','im','ex','nx','tt','rer'};
  labcr = {'yn','yc','yi','yim','yex','ynx','ytt','yrer','cn','ci','exim','yy','nn','cc','ii','rcrer','rnx'};
  
  % Average over all simulations and create structured output
  makestr = @(X,L) cell2struct(num2cell(mean(X)'),L);
  stdH  = makestr(stdH,labsd);
  acrH  = makestr(acrH,labac);
  corH  = makestr(corH,labcr);
  
end 