I was talking to my friend Nathan (he of the whimsical p value Doge and the informative p value research) about teaching correlations to undergraduates. We thought it might help if the students could see the effects on size and significance of different data quickly – by clicking in data points themselves.
So, I wrote this code.
It opens a user interface figure with x and y axes. Students can then click in data points and watch a positive correlation grow greater in significance as more points are added but with little change to size because the points are all close to the least squares line:
Or see the effect of an outlier driving a correlation. Here there is no significant correlation between the first nine points but the addition of the tenth suddenly creates a significant correlation with a large magnitude.
This of course reminds students to visualise to check for (amongst other things) outliers in the data and not just report the numbers.