# Stuck with Variables

#### Leigh13

##### New member
Hi guys!

I have never used statistics in my life, so now I'm completely lost.

I have only 3 variables -

the year of the company founding (up to 1993, 1994-2004, 2005-now), the technological intensity of their products (that's either a, b, c or d) and the number of foreign markets (that's either 1, 2, 3 or more)

I would like to check the correlation between the year and the tech. intensity, the year and the number of markets, and the intensity and the number of markets

I understand I'm looking for some sort of correlation, but which coefficient to check - Spearman or Pearson?

And how to get the variables into SPSS? n=850 Do I just put 3 columns one next to each other?

Thanks so much for help!

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Hi guys!

I have never used statistics in my life, so now I'm completely lost.

I have only 3 variables -

the year of the company founding (up to 1993, 1994-2004, 2005-now), the technological intensity of their products (that's either a, b, c or d) and the number of foreign markets (that's either 1, 2, 3 or more)

I would like to check the correlation between the year and the tech. intensity, the year and the number of markets, and the intensity and the number of markets

I understand I'm looking for some sort of correlation, but which coefficient to check - Spearman or Pearson?

And how to get the variables into SPSS? n=850 Do I just put 3 columns one next to each other?

Thanks so much for help!
Welcome to MHB, Leigh13! All of your variables are ordinal.
That is, they have an ordering, but for instance an average is meaningless.
In particular that means that you cannot use Pearson.
So yes, Spearman is the way to go.

In SPSS you would indeed simply put 3 columns next to each other and specify you want to use Spearman.

#### esis

##### New member
Also, try doing it in Excel! That way, you'll really get an intuitive feel for how Spearman's correlation coefficient works.

Calculating Spearman's r From Scratch
Create columns for the IDs, variables, ranks, d, and d^2 (see table 1 below).

Step 2: Sort According to the First Variable
Sort the (entire! i.e. all columns of your data set!) data according to your first variable (Intensity(a)). Make a note of whether you sorted them in ascending, or descending order. In the example below, I used ascending order and gave the value "a" for the variable Intensity(a) rank 1, value "b" rank 2 and so forth.

Step 3: Assign First Variable Ranks, Deal with Ties
Assign ranks to each observation's value for the variable we sorted in step 2 (i.e. Intensity(a)). Now, you may notice that some of the observations have the same variable value, but different ranks. These are called ties, and need to receive new and equal ranks for the calculations to work.

e.g. observations with IDs 2, 3, and 7 all share a value of "a" in the Intensity(a) variable, but hold the dissimilar ranks 4, 5, and 6. Their new equal rank will be: (6 + 5 + 4)/3 = 5.

Step 4: Sort According to the Second Variable
Sort your according to the next variable. Make sure that the ranking system follows the same pattern as your first variable. In our case, "a" was considered high and received the rank of one. Therefore, the observation with 8 markets will receive the rank of 1, the observation with 7 markets will receive rank 2 and so forth.

Step 5: Assign Second Variable Ranks, Deal with Ties
Assign ties with dissimilar ranks new equal ranks using the same method as step 3.

Step 6: Sort According to Observation IDs
Re-sort all of your data according to your ID numbers (not a requirement, but it makes the data easier to read).

Step 7: Calculate d
Subtract each observation's rank in variable (a) from their rank in variable (b) in column d. Note that if these are summed up, you will always get zero.

Step 8: Calculate d^2
Raise each value in d by two in order to make sure that their sum is'nt zero.

Step 9:
Sum the values of d^2 and use it in the formula below.

Formula:
$$\displaystyle Spearman's r = 1 - \frac{6\sum_{x = 1}^n {d^2}}{n(n^2-1)} = 1 - \frac{6*11,5}{7(7^2-1)} = 0,79$$

Table 1. Calculating Spearman's r in Excel/Open Office
 ID Intensity(a) RANK(a) #Markets(b) RANK(b) d d^2 1 a 1.5 7 2 -0.5 0.25 2 c 5 5 4.5 0.5 0.25 3 c 5 4 6.5 -1.5 2.25 4 d 7 5 4.5 2.5 6.25 5 b 3 6 3 0 0 6 a 1.5 8 1 0.5 0.25 7 c 5 4 6.5 -1.5 2.25 SUM: 0 11.5

Fun Experiments! Plug in and see what happens to the results.
1. What happens if all "d" values are zero?
2. What happens if all "d" values are negative?
3. What happens when the ranks are perfectly dissimilar? And similar?

Last edited: