Commit 0f1e8c81 by adjemian

### Cosmetic changes and factorization of a division.

`git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1828 ac1d8469-bf42-47a9-8791-bf33cf982152`
parent c61d46e1
 function [mu,sigma,offset] = recursive_moments(m0,s0,data,offset) % function [mu,sigma,offset] = recursive_moments(m0,s0,data,offset) % Recursive estimation of order one and two moments (expectation and % covariance matrix). % ... ... @@ -27,13 +25,14 @@ function [mu,sigma,offset] = recursive_moments(m0,s0,data,offset) [T,n] = size(data); for t = 1:T tt = t+offset; m1 = m0 + (1/tt)*(data(t,:)'-m0); qq = m1*m1'; s1 = s0 + (1/tt)*(data(t,:)'*data(t,:)-qq-s0) + ((tt-1)/tt)*(m0*m0'-qq'); m0 = m1; s0 = s1; tt = t+offset; m1 = m0 + (data(t,:)'-m0)/tt; qq = m1*m1'; s1 = s0 + ( (data(t,:)'*data(t,:)-qq-s0) + (tt-1)*(m0*m0'-qq') )/tt; m0 = m1; s0 = s1; end mu = m1; sigma = s1; mu = m1; sigma = s1; offset = offset+T; \ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment