diff --git a/matlab/utilities/dataset/makedataset.m b/matlab/utilities/dataset/makedataset.m index c5c244b5401a21858daded8549d1a077d3b3705b..a26a074c5f90be9126166919a07cbeaffe21cc77 100644 --- a/matlab/utilities/dataset/makedataset.m +++ b/matlab/utilities/dataset/makedataset.m @@ -267,7 +267,7 @@ else end % Compute the empirical mean of the observed variables. -DatasetInfo.descriptive.mean = nanmean(DynareDataset.data); +DatasetInfo.descriptive.mean = nanmean(DynareDataset.data,1); % Compute the empirical covariance matrix of the observed variables. DatasetInfo.descriptive.covariance = nancovariance(DynareDataset.data); diff --git a/matlab/utilities/dataset/nancovariance.m b/matlab/utilities/dataset/nancovariance.m index 8e2e2b227522b4bc05802bbbb1e7571547504436..09f2a38af6d0ad16fe8f84576de60373f43b92c7 100644 --- a/matlab/utilities/dataset/nancovariance.m +++ b/matlab/utilities/dataset/nancovariance.m @@ -51,7 +51,7 @@ function CovarianceMatrix = nancovariance(data) CovarianceMatrix = zeros(size(data,2)); if isanynan(data) - data = bsxfun(@minus,data,nanmean(data)); + data = bsxfun(@minus,data,nanmean(data,1)); for i=1:size(data,2) for j=i:size(data,2) CovarianceMatrix(i,j) = nanmean(data(:,i).*data(:,j)); @@ -61,7 +61,7 @@ if isanynan(data) end end else - data = bsxfun(@minus,data,mean(data)); + data = bsxfun(@minus,data,mean(data,1)); CovarianceMatrix = (transpose(data)*data)/size(data,1); end