calculating rmse between observations and estimates of different size

20 ビュー (過去 30 日間)
Sergio
Sergio 2013 年 9 月 3 日
I would like to calculate rmse between observations and estimates of different size. This are two timeseries, one 84084x1 and the second is 315360x1.

採用された回答

Thomas
Thomas 2013 年 9 月 3 日
Your data sets (data and estimate) have different sizes. Do you have NaN's in your estimates or are you taking multiple estimates/observations?
You might want to equalize the size of the dataset (by removing the unwanted observations) and then finding the rmse
rmse=sqrt(sum((data(:)-estimate(:)).^2)/numel(data));
  3 件のコメント
Thomas
Thomas 2013 年 9 月 3 日
You could try interp1 (nearest neighbor interpolation) or something similar http://www.mathworks.com/help/matlab/ref/interp1.html
Thomas
Thomas 2013 年 9 月 3 日
編集済み: Thomas 2013 年 9 月 3 日
I just realized that you have a time series and if you have the finance toolbox you can use the fillts command http://www.mathworks.com/help/finance/fillts.html

サインインしてコメントする。

その他の回答 (1 件)

Youssef  Khmou
Youssef Khmou 2013 年 9 月 3 日
編集済み: Youssef Khmou 2013 年 9 月 3 日
You can padd the small vector with zero or Interpolate as mentioned by @Thomas :
% Given your vectors r1 r2
r1=randn(315360,1);
r2=randn(84084,1);
N1=length(r1);
N2=length(r2);
Ratio=floor(N1/N2);
r22=interp(r2,Ratio);
Diff=N1-length(r22);
r22=[r22;zeros(Diff,1)];
plot(r1), hold on, plot(r22,'r'),
RMSE=sqrt(mean(((r22-r1).^2)))
You can also use the functions downsample or upsample
  2 件のコメント
Sergio
Sergio 2013 年 9 月 3 日
Hi Youssef,
I tried your code but it gives me error:
Error using horzcat Dimensions of matrices being concatenated are not consistent.
Error in usgs (line 107) r22=[r22 zeros(1,Diff)];
Thanks though. It has potential
Youssef  Khmou
Youssef Khmou 2013 年 9 月 3 日
編集済み: Youssef Khmou 2013 年 9 月 3 日
Sergio, transpose vectors r1=r1'; r2=r2' or try again the edited code .

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by