散布図の相関係数の求め方

19 views (last 30 days)
Naoki Ishibashi
Naoki Ishibashi on 9 Oct 2016
Answered: michio on 10 Oct 2016
以下のプログラムで書いた散布図の相互相関係数を求めたいのですが、プロットした各データセットの係数ではなく、重ね合わせた全てのデータの相関係数を求めたいのですがなにかいい方法ありましたら教えて頂けると幸いです。
for i = 1:12
hold on
if i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12
for j = 1:31
xfilename = sprintf('TA2004%02d%02d.txt',i,j);
yfilename = sprintf('TS2004%02d%02d.txt',i,j);
x = load(xfilename);
y = load(yfilename);
if i==1 && j == 1
scatter(x,y);
else
scatter(x,y);
end
end
elseif i==2
for j = 1:29
xfilename = sprintf('TA2004%02d%02d.txt',i,j);
yfilename = sprintf('TS2004%02d%02d.txt',i,j);
x = load(xfilename);
y = load(yfilename);
scatter(x,y);
end
else
for j = 1:30
xfilename = sprintf('TA2004%02d%02d.txt',i,j);
yfilename = sprintf('TS2004%02d%02d.txt',i,j);
x = load(xfilename);
y = load(yfilename);
scatter(x,y);
end
end
hold off
end
xlabel('surface temperature');
ylabel('near-surface air temperature');
  2 Comments
Walter Roberson
Walter Roberson on 9 Oct 2016
Approximate translation:
The following I'd like to seek a cross-correlation coefficient of the scatter plot written in the program, rather than the coefficient of each data set that you plot, there is a method But something good to want to find the correlation coefficients of all of the data superimposed or I hope to teach who can do.
Walter Roberson
Walter Roberson on 9 Oct 2016
This appears to be the same program as in your previous question http://www.mathworks.com/matlabcentral/answers/306509- . I suggest you combine the questions.

Sign in to comment.

Answers (1)

michio
michio on 10 Oct 2016
corrcoef関数で相関係数は計算できるかと思います。
「各データセットごとではなくプロットした全ての値」から相関係数または線形回帰などの処理をされたいとのこと。 http://jp.mathworks.com/matlabcentral/answers/306509- への回答でも触れていますが、処理の対象となるデータがメモリ上に収まるのであれば、すべてを1つの変数に保持できれば様々な処理が簡単になります。データの読み込み方法についてご検討ください。

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!