In the in-class activity you looked at the relationship between stats anxiety and engagement. In this homework exercise we will go deeper into the data. First download the data and the Rmd assignment files through the zip folder on Moodle.
First, note that the STARS survey has 6 different subscales: – Ask For Help: Anxiety related to getting help – Interpretation: Anxiety related to interpreting statistical output – Self-Concept: Anxiety related to perceived abilities – Teacher: Teacher-related anxiety – Test: Test-related anxiety – Worth: Feelings of Self-Worth
The questions associated with each subscale are:
subscale
questions
Ask For Help
Q03, Q16, Q19, Q23
Interpretation
Q02, Q05, Q06, Q07, Q09, Q11, Q12, Q14, Q17, Q18, Q20
Self-Concept
Q25, Q31, Q34, Q38, Q39, Q48, Q51
Teacher
Q30, Q32, Q43, Q44, Q46
Test
Q01, Q04, Q08, Q10, Q13, Q15, Q21, Q22
Worth
Q24, Q26, Q27, Q28, Q29, Q33, Q35, Q36, Q37, Q40, Q41, Q42, Q45, Q47, Q49, Q50
A table has been provided for you in subscales.csv that matches each question number to its corresponding subscale. This is a “lookup table” that allows us to match each item to a subscale through a join.
In the in-class activity, you looked at whether the mean anxiety rating for each student predicted engagement. In this worksheet, we will look at the relationship between mean anxiety and engagement for each subscale.
Load the data
The code chunk below loads in the tidyverse and the data into stars_raw, engage, and subscales. It also reshapes the data for you, as was done in the in-class activity. After running this chunk have a look at the three resulting tibbles in your console.
# leave this chunk as it is: do not alter any of the code
library(“tidyverse”)
## Warning: package ‘purrr’ was built under R version 3.5.2
stars_raw <- read_csv("L3_stars.csv") %>%
gather(“question”, “score”, Q01:Q51) %>%
arrange(ID, question)
engage <- read_csv("psess.csv") subscales <- read_csv("subscales.csv") Task 1: Combine match the items to subscales The first thing you need to to is to map each item (question) onto the appropriate subscale. Hint: two-table dplyr verb. Name the resulting table stars_sub. stars_sub <- NULL Task 2: Calculate mean_anxiety for each combination of student and subscale stars_sub has the data you need in long format. Now use dplyr verbs to calculate mean_anxiety for each combination of student and subscale, and store the resulting tibble in the variable stars_submeans. Don’t forget to ungroup() at the end (yes, that is a hint). Remember also to remove NAs. stars_submeans <- NULL Task 3: Combine with engagement measurement Now combine stars_submeans with the data in engage. Save the resulting table as joined. joined <- NULL Task 4: Scatterplots Use ggplot2 functions to dreate scatterplots with mean_anxiety on the X axis and n_weeks on the Y axis, but do it so there is a separate scatterplot for each subscale. Hint: try facet_wrap() # do something with ggplot() Run regressions for each subscale Now you are going to run 6 separate regressions predicting n_weeks from mean_anxiety, one for each of the six subscales. Use the code chunk below to (1) pull out the data you need for each subscale, and (2) run a regression on it. It is up to you to decide how to do this: there are many valid approaches. How you do it won’t be assessed; however, you will derive values from each of the 6 regressions that we will check later. ## NB: this block is not assessed; run your regressions here Task 5: Ask for help What is the slope relating mean_anxiety to n_weeks for the “Ask for Help” subscale? (Type the number rounded to 3dps or use code to extract it; the answer slp_help should be a single number). slp_help <- NULL Task 6: Interpretation What is the slope relating mean_anxiety to n_weeks for the “Interpretation” subscale? (Type the number rounded to 3dps or use code to extract it; the answer slp_intr should be a single number). slp_intr <- NULL Task 7: Self-Concept What is the slope relating mean_anxiety to n_weeks for the “Self-Concept” subscale? (Type the number rounded to 3dps or use code to extract it; the answer slp_conc should be a single number). slp_conc <- NULL Task 8: Teacher What is the slope relating mean_anxiety to n_weeks for the “Teacher” subscale? (Type the number rounded to 3dps or use code to extract it; the answer slp_teach should be a single number). slp_teach <- NULL Task 9: Test What is the slope relating mean_anxiety to n_weeks for the “Test” subscale? (Type the number rounded to 3dps or use code to extract it; the answer slp_test should be a single number). slp_test <- NULL Task 10: Worth What is the slope relating mean_anxiety to n_weeks for the “Worth” subscale? (Type the number rounded to 3dps or use code to extract it; the answer slp_worth should be a single number). slp_worth <- NULL Task 11: Rank the slopes for the subscales Alter the vector subrank below so that the subscales are ordered by slope, from lowest (most negative) to highest (least negative). You can copy and paste or re-type the names, but if you re-type them, make sure you use the EXACT subscale names as they appear in the data (including capitalisation), and do not forget the quotation marks. subrank <- c("Ask For Help", "Interpretation", "Self-Concept", "Teacher", "Test", "Worth") Finished Well done, you are finshed. It would be an excellent idea to now save your code, close Rstudio, reopen Rstudio, reopen your code, and then knit your code one last time. If there are no errors then your code should produce an HTML output with all your answers in place. If any errors appear you should try and rectify them before submitting the .Rmd file. The deadline for the portfolio assignments is 12th March and more instructions on the submission will be given nearer the time.