Solution by Steps
step 1
Set your working directory to the location where the data is saved. Use the following code:
setwd("/Users/wq666888/Desktop/博三1nd课程资料/EDP646_a Multivariate Method/第二周")
step 2
Import the dataset "StudentsMentalHealthSurvey.csv" and store it in an object called data. Use the following code:
data <- read.csv("StudentsMentalHealthSurvey.csv")
step 3
Check the descriptive statistics for the data and look for missing values. Use the following code:
summary(data) \quad \text{and} \quad sum(is.na(data))
step 4
The result of sum(is.na(data)) is 0, indicating there are no missing values, and the length of the data is 87, confirming 87 responses for all variables
step 5
Run a multivariate regression analysis to predict student depression and anxiety from perceived academic workload, academic pressure, and social relationships. Use the following code:
model <- lm(cbind(depression, anxiety) ~ academic_workload + academic_pressure + social_relationships, data = data)
step 6
Use the summary function to view the results of the regression analysis:
step 7
Identify statistically significant predictors for anxiety based on p-values. The p-values for academic_workload (0.011763) and social_relationships (0.000503) are significant, while academic_pressure (0.053902) is near significant
step 8
Interpret the regression coefficient for social_relationships. A coefficient of -0.3742 indicates that for each one-unit increase in social relationships, anxiety decreases by 0.3742, holding other variables constant
step 9
The coefficient for social_relationships in the depression model is -0.3379, indicating a similar inverse relationship with depression
step 10
The variance in anxiety scores explained by the model can be assessed using the R-squared value from the summary output
step 11
Review the regression results for depression to identify significant predictors. The significant predictors are academic_workload and social_relationships
step 12
Interpret the regression coefficient for academic_workload, which indicates the expected change in anxiety for each unit increase in academic workload
step 13
The Residual Standard Error in the depression model indicates the average distance that the observed values fall from the regression line. A smaller value indicates a better fit
step 14
Perform a multivariate test using the Manova function to evaluate the joint effect of predictors on depression and anxiety. Use the following code:
manova_model <- manova(cbind(depression, anxiety) ~ academic_workload + academic_pressure + social_relationships, data = data)
step 15
Analyze the results from the Wilks and Pillai multivariate tests to determine which predictors have a statistically significant joint effect on depression and anxiety
step 16
Interpret the results from both multivariate and univariate tests to finalize the model based on statistical significance and practical relevance
Answer
The analysis indicates that academic workload and social relationships are significant predictors of both anxiety and depression, while academic pressure is near significant. The model explains a portion of the variance in anxiety and depression scores.
Key Concept
Multivariate regression analysis allows for the simultaneous examination of multiple predictors on multiple outcomes.
Explanation
The results show how academic workload and social relationships significantly impact students' mental health, providing insights for interventions.