%
%spurcorr.m
randn('seed',10)
x1 = normrnd(3, 1, [1, 10])';
y1 = 0.1 * x1 + 0.9 * normrnd(3, 1, [1, 10])';
corr(x1, y1) %0.0643

x2 = normrnd(6, 1, [1, 20])';
y2 = 0.1 * x2 + 0.9 * normrnd(6, 1, [1, 20])';
corr(x2, y2) %0.0079



close all
plot( x1, y1, 'o', 'MarkerSize',11,...
    'MarkerFaceColor', 'r', 'MarkerEdgeColor','k')
hold on
plot( x2, y2, 'o', 'MarkerSize',11,...
    'MarkerFaceColor', 'b', 'MarkerEdgeColor','k')
xlabel('x'); ylabel('y')
legend('Group 1','Group 2', 'location', 'se')
axis square
axis tight

x3 = [x1; x2];
y3 = [y1; y2];

corr(x3, y3)  %0.7031

 %print -depsc 'C:\STAT\Corr\Correps\spurcorr.eps'