`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
`geom_smooth()` using formula 'y ~ x'
Shapiro-Wilk normality test
data: my_hp$Ladder.score
W = 0.99125, p-value = 0.4893
shapiro.test(my_hp$Logged.GDP.per.capita)
Shapiro-Wilk normality test
data: my_hp$Logged.GDP.per.capita
W = 0.96503, p-value = 0.0007689
shapiro.test(my_hp$Freedom.to.make.life.choices)
Shapiro-Wilk normality test
data: my_hp$Freedom.to.make.life.choices
W = 0.95454, p-value = 8.432e-05
shapiro.test(my_hp$Generosity)
Shapiro-Wilk normality test
data: my_hp$Generosity
W = 0.94303, p-value = 9.617e-06
#If the p-value is < 5%, then the correlation between x and y is significant#Pearson correlation (r), which measures a linear dependence between two variables (x and y). It’s also known as a parametric correlation test because it depends to the distribution of the data. It can be used only when x and y are from normal distribution. The plot of y = f(x) is named the linear regression curve.#Kendall tau and Spearman rho, which are rank-based correlation coefficients (non-parametric)cor.test(my_hp$Ladder.score, my_hp$Logged.GDP.per.capita, method="pearson")
Pearson's product-moment correlation
data: my_hp$Ladder.score and my_hp$Logged.GDP.per.capita
t = 15.61, df = 147, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.7204524 0.8434475
sample estimates:
cor
0.7897597
#the p-value of the test is 1.29410^{-10}, which is less than the significance level alpha = 0.05. We can conclude that wt and mpg are significantly correlated with a correlation coefficient of -0.87 and p-value of 1.29410^{-10} .cor.test(my_hp$Ladder.score, my_hp$Logged.GDP.per.capita, method="spearman")
Warning in cor.test.default(my_hp$Ladder.score, my_hp$Logged.GDP.per.capita, :
Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: my_hp$Ladder.score and my_hp$Logged.GDP.per.capita
S = 105074, p-value < 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.8094072
Warning in cor.test.default(my_hp$Ladder.score,
my_hp$Freedom.to.make.life.choices, : Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: my_hp$Ladder.score and my_hp$Freedom.to.make.life.choices
S = 216613, p-value = 2.26e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.607086
Warning in cor.test.default(my_hp$Ladder.score, my_hp$Generosity, method =
"spearman"): Cannot compute exact p-value with ties
Spearman's rank correlation rho
data: my_hp$Ladder.score and my_hp$Generosity
S = 555514, p-value = 0.9263
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
-0.007643045