# Running Pearson Correlation using MagicStat

There’s a lot more that goes into a person’s income than just their IQ: what field they work in, how much experience they have, even where they live.

So, it won’t be a perfect relationship between IQ and income, and it probably won’t even be a particularly strong relationship.

So, we’ll hypothesize a moderate, positive relationship between IQ and income.

In general, we want to have hypotheses that are backed by theory.

That way we can avoid “fishing expeditions” which throw variables together randomly.

Performing a test without a hypothesis grounded in theory increases the likelihood that any relationship you might find is just due to chance.

In the last column, we also have the foot size of each individual.

Obviously, we would not hypothesize any difference between foot size and either IQ or income.

So now that we have our hypothesis, let’s see how to perform a correlation on MagicStat (version 1.

0.

8).

1-) Select a data fileSelect your own dataset by clicking the “Choose a data file” button.

If you would like to use a sample data file, click “Sample datasets” on the toolbar, save it to your hard drive, then click “Choose a data file” and navigate to where you saved it.

2-) Explore the datasetAfter you select your dataset, click the “Explore” button.

After you select your dataset, click the “Explore” button.

On the right side of the window is information-at-a-glance about your dataset, including variable information, bar graphs, and histograms.

4- Choose the “Pearson Correlation” modelClick “Select a model to analyze your data”, and select “Pearson Correlation” on the dropdown.

5- Choose variablesClick the “Select variables” button, and pick which variables you want to include in the model.

Here, we’re selecting “IQ”, “Income” and “Foot_Size”.

6- Analyze the datasetFinally, click the “Analyze” button.

Interpreting resultsNow it is time to interpret the results we obtained in the previous steps.

In a Pearson correlation, the degrees of freedom is purely a function of sample size, N minus 2.

So, it is 52.

Next is our correlation table.

We have a moderate correlation between IQ and Income at .

41, as we hypothesized, and no correlation between Foot_Size and IQ or Income.

Below that is the p value for each relationship, and we see that moderate correlation between IQ and Income has a p value of 0.

02, which means that if there were no relationship between IQ and Income, we’d expect to get this dataset about two times out of a thousand — not very likely!.

And the p values for Foot_Size-IQ and Foot_Size-Income are close to 1, which means it’s not very likely that there is a relationship between them.

After the correlation table, MagicStat gives us some graphs.

First is a correlation heatmap, to show where the strongest relationships are.

We can see the moderate relationship between IQ and Income in purple, and the lack of relationship with Foot_Size in blue.

Then, we can select a scatterplot to visualize the relationship and check for outliers.

If we look at the IQ-Income scatterplot, there do not seem to be any obvious outliers.

With this scatterplot and a theoretical link between IQ and Income, we can feel confident in the relationship we found in our dataset.

Note: This article has two authors, Fatih Şen (PhD) and Brent Morgan (PhD).