Homework 4

library(psych)
library(apaTables)
library(ppcor)
Loading required package: MASS
rel_data <- read.csv("/Users/iancopeland/Documents/R/stats_1/datasets/rel_data.csv")

1 Email response

From: statsguru@university.edu
To: jamiejones@university.edu
Date: Wednesday, September 29 at 4:30PM
Subject: Psychology Conference

Dear Jamie,

I would be happy to help!

In terms of your data set, there actually were a few input errors, but those were an easy fix. Luckily enough, each of the love variables were not skewed too bad, had a linear relationship with lying, and considering this data came from Likert-scale measures, we don’t have to worry about outliers! Each type of love, Friendship, Passionate, and Long-term commitment, were negatively correlated to lying frequency. What I mean by this is, when respondents answered that they felt high levels of one of these three types of love, they also reported low frequencies of lying with their partner, so these variables traveled in opposite directions. In terms of the strength of these relationships, passionate-love had a medium effect on lying while both friendship love and long term commitment had a very large effect on lying. If you’re interested, all of Pearson’s correlation values can be found in Table 1, which I’ve attached at the end of this email and highlighted the important values. I’ve also written up an APA formatted results section at the end of this email for your more scientific minded attendees.

The strongest relationship I found was between Long-term commitment and Lying, where couples who felt stronger senses of loyalty and dependency tended to report lying as infrequent in their relationship. Also attached to this email is Figure 1, which is a simple visualization you can use to explain the strength and direction of these variables during your presentation! It’s important to note that Lying is on the Y axis because it is our criterion variable, which basically means it is the behavior of interest we want to predict, while Long-term commitment is on the X axis because it is the variable we are using to predict some level of lying frequency.

To touch on your boss’s concern about Age potentially impacting the relationship between lying and our three love variables, rest assured! Age did not significantly impact any relationship at all, the correlation coefficient only changed by .01 for each variable, which is inconsequential. If your boss is interested, the output for my partial correlations can be found attached to this email as well.

Best,

Statsguru

2 APA results section

Correlational analyses were used to determine how friendship-love, passionate-love, and long-term commitment relate to overall frequency of lying among romantic couples. Friendship-love was negatively correlated with lying, r = -.77, p < .01, 95% CI [-.80, -.73], accounting for 59% of the variance in self reported lying frequnecy. Passionate love was negatively related to overall frequency of lying among romantic couples, r = -.43, p < .01, 95% CI [-.49, -.36], explaining 18% of the variance in self reported lying frequency. Long term commitment had the strongest relationship with lying in which they were negatively correlated, r = -.88, p < .01, 95% CI [-.90, -.86], accounting for 77% of the variance in self reported lying frequency.

3 Code & output

df <- rel_data[!(rel_data$CommitLove > 7 | 
                          rel_data$PassionLove > 7 | 
                          rel_data$FriendLove > 7 | 
                          rel_data$Lying == 1112
                        ),
                      ]
  • Fixed data input errors.
describe(df$CommitLove)
   vars   n mean   sd median trimmed  mad min max range skew kurtosis   se
X1    1 534 3.62 1.84      4    3.57 2.97   1   7     6 0.15    -1.15 0.08
describe(df$PassionLove)
   vars   n mean   sd median trimmed  mad min max range skew kurtosis   se
X1    1 534 4.08 1.74      4    4.04 1.48   1   7     6  0.2    -0.97 0.08
describe(df$FriendLove)
   vars   n mean  sd median trimmed  mad min max range  skew kurtosis   se
X1    1 534 4.31 1.7      4    4.33 1.48   1   7     6 -0.03    -0.84 0.07
describe(df$Lying)
   vars   n mean   sd median trimmed  mad min max range  skew kurtosis   se
X1    1 534 4.13 1.98      4    4.17 2.97   1   7     6 -0.07    -1.25 0.09
  • Generated data descriptions to check for normality.
apa.cor.table(df, 
              filename = "cor_table.doc", 
              table.number = NA,
              show.conf.interval = TRUE
              )
  • Correlation table in APA format.

x <- df$CommitLove
y <- df$Lying

plot(x, y, 
     main = "Figure 1",
     xlab = "CommitLove",
     ylab = "Lying",
     pch = 19,
     frame = FALSE,
     )
abline(lm
       (x ~ y, 
        data = df), 
        col = "blue"
       )

  • Scatter plot of strongest relationship
z <- df$Age

pcor.test(x, y, z) 
    estimate       p.value statistic   n gp  Method
1 -0.8780789 4.172072e-172 -42.28482 534  1 pearson
  • Partial correlation of CommitLove & Lying when controlling for Age.
x1 <- df$PassionLove

pcor.test(x1, y, z)
    estimate      p.value statistic   n gp  Method
1 -0.4273686 4.466936e-25 -10.89292 534  1 pearson
  • Partial correlation of PassionLove & Lying when controlling for Age.
x2 <- df$FriendLove

pcor.test(x2, y, z)
    estimate       p.value statistic   n gp  Method
1 -0.7668618 2.440881e-104 -27.53318 534  1 pearson
  • Partial correlation of FriendLove & Lying when controlling for Age.