Note. Remember to write in full sentences. Your analytical narrative is important.
Researchers sought to investigate whether there is a relationship between depression and anxiety. The data is saved under “affect2.csv”
| Column names | Description |
|---|---|
| depression | Depression scores |
| anxiety | Anxiety scores |
affect2 <- read.csv("affect2.csv")
head(affect2)
cor(affect2$depression, affect2$anxiety)
## [1] 0.6817462
There is a strong positive relationship between depression and anxiety.
Note. The p-value < 2.2e-16 where
the alpha = 0.05.
Because the p-value is alot smaller than the alpha of 0.05, the null hypothesis would be rejected. This would mean that the positive relationship seen in this sample is not likely to have occurred by chance. Furthermore, the two variable are related and tend to co-occur.
The researchers posit that high levels of anxiety will result in higher levels of depression. To understand if this is true they conduct a simple linear regression.
The predictor here is anxiety scores and the outcome is depression scores.
Do higher levels of anxiety predict higher leels of deppression?
Reminder. Use the lm() command to run the regression. Use the help file (“?lm()”) if you need a refresher on what arguments go into the function.
Note. Remember the order of the variables is important when creating a regression model.
mod1 <- lm(depression ~ anxiety, data = affect2)
INSERT CODE CHUNK HERE
summary(mod1)
##
## Call:
## lm(formula = depression ~ anxiety, data = affect2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -51.033 -11.239 -1.298 7.781 69.781
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -43.5734 6.5777 -6.624 5.19e-10 ***
## anxiety 1.8921 0.1615 11.713 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 20.47 on 158 degrees of freedom
## Multiple R-squared: 0.4648, Adjusted R-squared: 0.4614
## F-statistic: 137.2 on 1 and 158 DF, p-value: < 2.2e-16
Reminder. The base equation looks like this: y = ax + b
y = 1.8921x - 43.57
46.48% of the of the variance in the depression scores is explained by the anxiety scores.
Be sure to label your axes appropriately.
Reminder. Use the help file for “?plot()” and “?abline()” to find out more information about what kind of arguments go into these functions.
plot(affect2$depression, affect2$anxiety, xlab = "Axiety Scores", ylab = "Depression Scores", main = "Relationship Between Anxiety and Depression")
abline(lm(affect2$anxiety ~ affect2$depression), col = "blue")
Consider the model’s overall p-value, what the regression equation actually means in terms of these variables, and how the scatter plot visually represents this relationship.
The findings revealed that higher levels of anxiety strongly predict higher levels of depression. The regression model indicated that the association is statistically significant, and the equation displays a positive slope, with depression increasing as anxiety increases. Anxiety accounts for a significant portion of the variation in depression, indicating that it is a powerful predictor. The scatter plot visually supports this observation, showing a positive trend with points clustering along the line of best fit.