Importing the datafiles:
library(haven)
PSY772ProblemSet1 <- read_sav("C:/Users/John Majoubi/Downloads/Problem Set #1 (Linear Correlations)-20230303 (1)/Directions and Datafiles (PS1)/PSY772ProblemSet1.sav")
listwise.PS1 = na.exclude(PSY772ProblemSet1[c(3:6)])
library(haven)
plot(listwise.PS1$Focus, listwise.PS1$Happy, xlab = "Focalism", ylab = "Affective Forecasting")
#Linearity does NOT seem to hold between Focalism and Affective Forecasting
#the equation for screening outliers
BivariateAssumption.ListwisePS1 = lm (listwise.PS1$Happy ~ listwise.PS1$Focus)
#getting summary output for Cook's D values
summary(cooks.distance(BivariateAssumption.ListwisePS1))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0000000 0.0004877 0.0018014 0.0099331 0.0043961 0.2419474
There are zero outliers using Cook’s D standard of < 1.00.
plot(listwise.PS1$SREISavg, listwise.PS1$Happy, xlab = "Emotional Intelligence", ylab = "Affective Forecasting")
####NHST
cor.test(listwise.PS1$SREISavg, listwise.PS1$Happy)
##
## Pearson's product-moment correlation
##
## data: listwise.PS1$SREISavg and listwise.PS1$Happy
## t = 0.80954, df = 134, p-value = 0.4196
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.09974105 0.23533241
## sample estimates:
## cor
## 0.06976314
There was NOT a significant correlation between emotional intelligence and affective forecasting, r = 0.070, p < 0.420, which showed no relationship between emotional intelligence and how people predicted their happiness.
library(ppcor) #for the partial COR
## Loading required package: MASS
##Loading the datafile
PSY772ProblemSet1 <- read_sav("C:/Users/John Majoubi/Downloads/Problem Set #1 (Linear Correlations)-20230303 (1)/Directions and Datafiles (PS1)/PSY772ProblemSet1.sav")
####EDA steps
#getting the column position:
names(listwise.PS1)
## [1] "Enjoy" "Happy" "Focus" "SREISavg"
plot(listwise.PS1)
##scatterplot array (for practice)
plot(listwise.PS1[c(2,3:4)])
#focus and happy zero-order cor
cor.test(listwise.PS1$Happy, listwise.PS1$Focus)
##
## Pearson's product-moment correlation
##
## data: listwise.PS1$Happy and listwise.PS1$Focus
## t = 6.6683, df = 134, p-value = 6.194e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3611713 0.6157516
## sample estimates:
## cor
## 0.4991569
cor.test(listwise.PS1$Focus, listwise.PS1$SREISavg)
##
## Pearson's product-moment correlation
##
## data: listwise.PS1$Focus and listwise.PS1$SREISavg
## t = 2.3722, df = 134, p-value = 0.0191
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.03355937 0.35702563
## sample estimates:
## cor
## 0.2007581
#emotional intelligence and happy zer-order cor
cor.test(listwise.PS1$SREISavg, listwise.PS1$Happy)
##
## Pearson's product-moment correlation
##
## data: listwise.PS1$SREISavg and listwise.PS1$Happy
## t = 0.80954, df = 134, p-value = 0.4196
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.09974105 0.23533241
## sample estimates:
## cor
## 0.06976314
#current mood and happy zero-order cor
cor.test(listwise.PS1$Enjoy, listwise.PS1$Happy)
##
## Pearson's product-moment correlation
##
## data: listwise.PS1$Enjoy and listwise.PS1$Happy
## t = 3.8027, df = 134, p-value = 0.0002166
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1517295 0.4564447
## sample estimates:
## cor
## 0.3120912
It is significant
#the equation for outlier screening
Pcorrassumptions.listwise = lm(listwise.PS1$Happy ~ listwise.PS1$Focus + listwise.PS1$SREISavg + listwise.PS1$Enjoy)
#now the Cook's D
summary(cooks.distance(Pcorrassumptions.listwise))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 5.000e-08 2.690e-04 1.418e-03 1.029e-02 6.038e-03 2.148e-01
There are zero outliers using Cook’s D < 1.00.
spcor.test(listwise.PS1$Happy, listwise.PS1$Focus, listwise.PS1[,c("Enjoy" , "SREISavg")])
## estimate p.value statistic n gp Method
## 1 0.4609402 2.087735e-08 5.967562 136 2 pearson
We found a zero order correlation between focalism and affective forecasting, r = .499, p < .001, df = 134. Using a semi-partial correlation, there is a significant positive correlation, sr = .461, p < .001, df = 132, between focalism and affective forecasting when controlling for emotional intelligence and current mood on focalism only, r\(_{a(b.c+d)}\) = .461. Accordingly as focalism scores are increased so are individuals’ ability to predict their affective state removing both emotional intelligence and current mood from focalism only.
spcor.test(listwise.PS1$Happy, listwise.PS1$SREISavg, listwise.PS1[,c("Enjoy" , "Focus")])
## estimate p.value statistic n gp Method
## 1 -0.05250231 0.5468546 -0.6040387 136 2 pearson
cor(listwise.PS1$SREISavg, listwise.PS1$Happy)
## [1] 0.06976314
We found NO zero order correlation between focalism and affective forecasting, r = .070, p > .469, df = 134. Using a semi-partial correlation, there is NO significant correlation, sr = -.053, p > .547, df = 132, between emotional intelligence and affective forecasting removing both focalism and current mood from emotional intelligence only, r\(_{a(b.c+d)}\) = -.063.
pcor.test(listwise.PS1$Happy, listwise.PS1$Focus, listwise.PS1[,c("Enjoy" , "SREISavg")])
## estimate p.value statistic n gp Method
## 1 0.4854961 2.753404e-09 6.380322 136 2 pearson
We found a zero order correlation between focalism and affective forecasting, r = .499, p < .001, df = 134 Using a partial correlation, there is a significant positive correlation, pr = .486, p < .001, df = 132, between focalism and affective forecasting when controlling for both emotional intelligence and current mood, r\(_{ab.c+d}\) = .486. Accordingly as focalism scores are increased so are individuals’ ability to predict their affective state, when removing both emotional intelligence and current mood from this relationship.
##Getting the zero-order relationship
cor(listwise.PS1$Happy, listwise.PS1$Focus)
## [1] 0.4991569
pcor.test(listwise.PS1$Happy, listwise.PS1$SREISavg, listwise.PS1[,c("Enjoy" , "Focus")])
## estimate p.value statistic n gp Method
## 1 -0.06312804 0.4686748 -0.7267355 136 2 pearson
cor(listwise.PS1$SREISavg, listwise.PS1$Happy)
## [1] 0.06976314
We found NO zero order correlation between focalism and affective forecasting, r = .070, p > .469, df = 134. Using a partial correlation, there is NO significant correlation, pr = -.063, p > .467, df = 132, between focalism and affective forecasting when controlling for both focalsim and current mood, r\(_{ab.c+d}\) = -.063.
We found a zero order correlation between focalism and affective forecasting, r = .499, p < .001, df = 134.Using a partial correlation, there was a significant positive correlation, pr = .486, p < .001, df = 132, between focalism and affective forecasting when controlling for both emotional intelligence and current mood, r\(_{ab.c+d}\) = .486. Accordingly as focalism scores are increased so are individuals’ ability to predict their affective state, when removing both emotional intelligence and current mood from this relationship.
Using a semi-partial correlation, there was a significant positive correlation, sr = .461, p < .001, df = 132, between focalism and affective forecasting when controlling for emotional intelligence and current mood on focalism only, r\(_{a(b.c+d)}\) = .461. Accordingly as focalism scores are increased so are individuals’ ability to predict their affective state removing both emotional intelligence and current mood from focalism only.
We found NO zero order correlation between focalism and affective forecasting, r = .070, p > .469, df = 134.Using a partial correlation, there was NO significant correlation, pr = -.063, p > .467, df = 132, between focalism and affective forecasting when controlling for both focalsim and current mood, r\(_{ab.c+d}\) = -.063.
Using a semi-partial correlation, there was NO significant correlation, sr = -.053, p > .547, df = 132, between emotional intelligence and affective forecasting removing both focalism and current mood from emotional intelligence only, r\(_{a(b.c+d)}\) = -.063.