First, note that your second column is a categorical variable, i.e. Yes/No, Up/Down in your case.
So, a first step will be to convert your non-binary data in the "Outcome" column to binary $0-1$ variables.
An Excel Implementation:
The next step will be to use the CORREL
function in excel, to compute the correlation between your two types of variables - Distance and Outcome. To do so, apply =CORREL(A2:A3417,B2:B3417)
in any empty cell (after you have converted your UP/Down into 1/0 respectively!) and you will obtain the correlation as desired.
R Implementation
(You can use readxl to read the .xlsx file directly instead)
If you try out the straightforward way in excel or by invoking cor(x,y)
in R, you will find that there is almost no relation between the 2 variables, which kinda makes sense as one of them is a binary/categorical variable. ($cor(x,y) = -0.005750405$).
test <- read.csv("sample.csv", header = TRUE, sep = ',')
Outcome <- test$Outcome
Distance <- test$Distance
cor(Outcome,Distance)
-----------------------Outputs------------------------------
[1] -0.005750405
From the result above, I don't think that's the kind of result you want as not much can be interpreted from it. I highly suggest you take a look at Correlation between a nominal (IV) and a continuous (DV) variable, where a detailed breakdown of a problem similar to yours has been given.
In any case, if you are interested in descriptive statistics, you can try the following:
If you call a general linear model, you obtain the following:
lm1 <- glm(test$Outcome ~ test$Distance, data = test)
summary(lm1)
-----------------------Outputs------------------------------
Call:
glm(formula = test$Outcome ~ test$ï..Distance, data = test)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.8588 0.1413 0.1415 0.1417 0.1712
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.588e-01 6.380e-03 134.606 <2e-16 ***
test$ï..Distance -4.717e-08 1.404e-07 -0.336 0.737
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 0.1218882)
Null deviance: 416.14 on 3415 degrees of freedom
Residual deviance: 416.13 on 3414 degrees of freedom
AIC: 2508.7
Number of Fisher Scoring iterations: 2
Or if you call a linear model (lm):
lm1 <- lm(test$Outcome ~ test$Distance, data = test)
-----------------------Outputs------------------------------
Call:
lm(formula = test$Outcome ~ test$ï..Distance, data = test)
Residuals:
Min 1Q Median 3Q Max
-0.8588 0.1413 0.1415 0.1417 0.1712
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.588e-01 6.380e-03 134.606 <2e-16 ***
test$ï..Distance -4.717e-08 1.404e-07 -0.336 0.737
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.3491 on 3414 degrees of freedom
Multiple R-squared: 3.307e-05, Adjusted R-squared: -0.0002598
F-statistic: 0.1129 on 1 and 3414 DF, p-value: 0.7369
Also remember that correlation coefficients are used in statistics to measure how strong a relationship is between two variables, not to show causation. More information about interpreting correlation can be found at http://www.statisticshowto.com/probability-and-statistics/correlation-coefficient-formula/ and https://www.dummies.com/education/math/statistics/how-to-interpret-a-correlation-coefficient-r/.