7. Week 7 - Introduction to the linear model
Written by Rob Davies and Margriet Groen
This week we focus on two strands of learning:
- The linear model
So far, we’ve looked at measures of association between two variables using correlation. This week you will learn about regression and the linear model as a way of predicting one variable from knowledge of one or more other variables.
When considering one predictor, regression tells us a lot of the same things as correlation does. Regression becomes really useful when we have more than one predictor. We will talk about that in weeks 8 and 9. We will do all this in the context of the Clearly Understood project on how easy or difficult people find it to understand written health information.
- Research project: Get set up on Gorilla and pre-register your study
We will also continue the group project by focussing on getting set up on Gorilla, and pre-registering your study.
The materials we have prepared to support your learning are arranged in four parts:
- Lectures
- Reading
- Pre-lab activities
- Lab activities
You can navigate to each in the side bar on the right
Lectures
Please note that Rob may mention a different module code or different week during the lectures. I’ve reviewed the material and the content is entirely relevant to the current module.
In week 7, we aim to further develop skills in analysing and in visualising psychological data. We will do so in the context of the Clearly Understood project.
We will aim to answer the research question: What person attributes in adult readers predict success in understanding written health information?
Research questions like this can be examined using linear models.
When we do these analyses, we will need to think about how we report the results and decide:
- is the association significant?
- does the association reflect a positive or negative relationship between outcome and predictor?
- is the association relatively strong or weak?
Our thinking, and our decision-making, will be helped by developing our data visualisation skills. At every stage, as we work, we will visualize the data to understand the shape of the relationships we may observe or predict.
The lecture for part A for this week is presented in four short parts. You can view video recordings of the lectures using Panopto, by clicking on the links shown following.
- Overview (19 minutes): What we are doing in Week 7 – thinking critically about predicting people.
- Using linear models to do prediction (11 minutes): How we answer live research questions by using linear models to predict behaviour.
- How linear models work (9 minutes): How we can visualize and think about predictions, and about the difference between what we predict and what we observe when we study people.
- Interpreting, reporting and visualizing linear model results (15 minutes): Identifying, interpreting and communicating the key statistics.
The slides presented in the videos can be downloaded either as a web page. You can download the web page .html file and click on it to open it in any browser (e.g., Chrome, Edge or Safari). The slide images are high quality so the file is quite big and may take a few seconds to download.
B. The mini research project
If you haven’t already, make sure you watch the overview video on the mini research project and the video on what makes a good research question on the project page.
After that, make sure to watch the videos introducing the Gorilla platform and on how to build a questionnaire on Gorilla.
Overview (~9 minutes) Key information on what you’ll be expected to do, a rough timeline and how it links to assessment. You can view this video on the project page here.
What makes a good research question (~16 minutes) The video discusses why articulating a good research question is important and how to check that you’ve got one? It also discusses how to write hypotheses to go with your research question. We went over this during the week 6 lab session. You can view this video on the project page here.
A short introduction on Gorilla (~7 minutes) Gorilla is an online experiment builder. It provides an easy-to-use graphical interface which allows you to create complex studies in an intuitive way. Check out their video introduction to see what’s possible. You can access this video via the project page here.
How to build a questionnaire on Gorilla (~13 minutes) Watch this video on their support pages to learn how to use Gorilla to build a questionnaire. You can access this video via the project page here.
Reading
All reading is accessible via the library. You can go to Moodle -> Library Resources -> Resource List or you can follow this link. Readings have one of the following tags:
- Essential: We expect you to be familiar with these reading. You will be assessed on this.
- Recommended: We highly recommend these readings. They often provide a different perspective, or explain things in a different way.
- Optional: Further readings for those interested.
The reading list is divided into multiple sections:
- Reading associated with statistics: this contains links to readings useful for the development of statistical concepts and skills. The main textbook Fundamental statistics for the behavioral sciences by Howell (Essential) lives here.
- Reading associated with psychological research principles and design: this contains links to readings that provide a good basis for foundational knowledge around research design.
- Reading associated with Open Science principles and practices: this contains links to key literature on the Open Science movement.
- Week by week: these contain links to key reading for that week that are not listed on any of the more general lists above.
For week 7, the reading is:
Pre-lab activities
After having watched the lectures and read the textbook chapter you’ll be in a good position to try these activities. Completing them before you attend your lab session will help you to consolidate your learning and help move through the lab activities more smoothly.
Pre-lab activity 1: Visualising the regression line
Have a look at this visualisation of the regression line by Ryan Safner.
In this shiny app, you see a randomly-generated set of data points (within specific parameters, to keep the graph scaled properly). You can choose a slope and intercept for the regression line by using the sliders. The graph also displays the residuals as dashed red lines. Moving the slope or the intercept too much causes the generated line to create much larger residuals. The shiny app also calculates the sum of squared errors (SSE) and the standard error of the regression (SER), which calculates the average size of the error (the red numbers). These numbers reflect how well the regression line fits the data, but you don’t need to worry about those for now.
In the app he uses the equation Y = aX + b in which b is the intercept and a is the slope.
Pre-lab activity questions:
- Change the slider for the intercept. How does it change the regression line?
- Change the slider for the slope. How does it change the regression line?
- What happens to the residuals (the red dashed lines) when you change the slope and the intercept of the regression line?
Pre-lab activity 2: Measuring mind wandering and screen time
With your group you need to decide how to measure the variables you’ve specified in your research question. In this module we focus on using questionnaires to measure constructs.
To prepare for discussion within your group, please read (some of) the papers listed on the project page, in the section on Measuring mind wandering and screen time here. These are examples of questionnaires you could use. There is also a book chapter that provides more background on questionnaire research.
Pre-lab activity 3: Getting setup on Gorilla
You will build the study on the Gorilla platform. Each student will need to create an account. This is free to do. To create an account, click on this link and follow the instruction.
Please make sure to use your university email address (ending in ‘@lancaster.ac.uk’) to create your Gorilla account.
Pre-lab activity 4: Getting ready
To complete this week’s lab activity you will need several files:
- We’ll work with an example script called
4141_wk7_lab.qmd. This is a Quarto document. - We’ll also need a data file names
study-two-general-participants.csv.
You can download the files here: 4141_wk7_lab.zip. Usually they will be saved in your ‘Downloads’ folder.
Next, upload the zip-folder as it is to your Files space on the R-server (bottom right quadrant; no need to extract the files first).
Finally, open the example script by clicking on the file called 4141_wk7_lab.qmd in the Files space on the R-server.
You are now ready to start work on the lab activities.
Lab activities
Lab activity 1: What makes it easy or difficult for people to understand written health information?
We will do our practical lab work to develop your skills in the context of the Clearly Understood project.
The research question we are focussing on today is:
- What person attributes predict success in understanding health information?
Links to the files to be downloaded are in the Pre-lab activities section under Getting ready.
Aims of the activity
We are going to:
- Setup the appropriate bits and pieces in RStudio – using
library() - Read in the data file – using
read_csv() - Inspect the data – using
head()andsummary() - Draw histograms to examine the distributions of variables – using
ggplot()andgeom_histogram() - Practice editing the appearance of a histogram plot step-by-step
- Create scatterplots to examine the association between some variables – using
ggplot()andgeom_point() - Edit the appearance of each plot step-by-step
- Examine the correlations between the outcome variable and predictor variables
- Examine the relation between outcome mean accuracy (
mean.acc) and each of the potential predictors:SHIPLEY,HLVAandAGE - Use a model we have fitted to plot model predictions
All instructions and guidance (including hints and code snippets) for lab activities are presented on this handbook page.
The Quarto document is largely empty, only containing a copy of the section headers and the actions to remind you of what you are meant to do. Sometimes there are questions associated with the code you’ve written or the output that follows from it. These can also be found on both the handbook page and in the Quarto document.
How to complete the lab activity and use the Quarto script:
- Open the handbook pages in a separate window or tab and navigate to Lab activities.
- Read the instructions on the handbook page for each step.
- Carry out the actions, by inserting a code chunk in the Quarto document, below each action.
- If there are any questions associated with that step, please try to answer them. You can write your answer in the Quarto document, as plain text. Answers to the questions will be shared after the last lab session has taken place (on Thursday afternoon).
- After having carried out an action, written a code chunk and answered any questions, go back to the handbook page and read the next bit of instruction, until you get to the next action.
- If you are stuck: Have a look at the ‘Hints’ and ‘Code’ snippets on the handbook page.
- If you are still stuck: Ask for help (your peers on your table, the GTA or lecturer in the lab session, via the Moodle Q&A forum, during Friday’s live online Q&A).
If you’d like to watch a demonstration of this, have a look at the video at the start of Lab activity 3 of Week 5 (here).
Step 1: Setup the appropriate bits and pieces in RStudio
Before we can do anything, we need tell R what packages we want to use.
Action: In a new code chunk, add the code to load the relevant libraries. We need the following ones:
here,tidyverseandeasystats. If you are unsure, you can look at the ‘Hint’ below for a clue by expanding it.
Use the library()function. Remember to put it inside a ‘code chunk’ in your script. The name of the package goes inside the brackets. Repeat for each package.
Step 2: Read in the data file
Now we need to read in the data. The data file we need for this lab activity is called: study-two-general-participants.csv.
Action: In a new code chunk use
read_csv()to read in the data file namedstudy-two-general-participants.csv. Remeber to tell R where to find the file and what it is called. Make sure you’ve run the code chunk. Then, check that you can see the ‘object’ in the Environment (top right quadrant) for the file you read in.
When you code this, you can choose your own file name, but be sure to give the data object you create a distinct name e.g. study.two.gen.
dataframe <- read_csv(here("filepath to folder", "filename.extension))
Your code should include:
- dataframe: the name of the object you want to save the data in (such as
study.two.gen) - <- : assignment arrow
- read_csv() : the
read_csv()function - here(): the
here()function - “filepath to folder”: the folders that you need to point R to starting from whereever here starts
- “filename.extension”: the name of the datafile, including the extension
study.two.gen<- read_csv(here("4141_wk7_lab", "study-two-general-participants.csv"))Step 3: Inspect the data
It is always a good idea to have a look at the data. You can do this by clicking on the object in the Environment quadrant. This will open the file in the Source quadrant.
You can see the columns:
participant_IDparticipant code;mean.accaverage accuracy of response to questions testing understanding of health guidance (varies between 0-1);mean.selfaverage self-rated accuracy of understanding of health guidance (varies between 1-9);studyvariable coding for what study the data were collected inAGEage in years;HLVAhealth literacy test score (varies between 1-16);SHIPLEYvocabulary knowledge test score (varies between 0-40);FACTOR3reading strategy survey score (varies between 0-80);GENDERgender code;EDUCATIONeducation level code;ETHNICITYethnicity (Office National Statistics categories) code.
You can also use code to get an overview:
- The
head()function will show you the first few rows of the data-frame - The
tail()function will show you the last few rows of the data-frame - The
summary()function will give you an overview of the data-frame. What it gives you depends on the type of variable. For numeric variables, it will give you the minimum, maximum, mean, median and quartiles.
Action: Insert a new code chunk and use
head(),tail()andsummary()to get an overview of the data. Give it a go. If you’re stuck, have a look at the Code below.
head(study.two.gen)
tail(study.two.gen)
summary(study.two.gen)Questions Step 3
- Data from how many participants does the data file contain?
- What is the maximum age that was recorded for participants in this sample?
- On average, are participants in this sample more accurate when tested on their understanding, or when self-rating their understanding of written health information?
Step 4: Draw histograms to examine the distributions of variables
Lets look at the distributions of mean.acc, mean.self and AGE.
Action: Insert a new code chunk and use
ggplot()withgeom_histogram()to look at the distributions ofmean.acc,mean.selfandage.
Use ggplot() with geom_histogram().
When we create a plot, we take things step-by-step.
ggplot(data = study.two.gen, aes(x = mean.acc)) +
geom_histogram()These are the steps, set out one at a time:
ggplot(...)you tell R you want to make a plot using theggplot()functionggplot(data = study.two.gen ...)you tell R you want to make a plot with thestudy.two.gendataggplot(..., aes(x = mean.acc))you tell R that you want to make a plot with the variablemean.acc– here, you specify the aesthetic mapping,x = mean.accggplot(...) + geom_histogram()you tell R you want to plot values ofmean.accas a histogram
Notice that the code works the same whether we have the different bits of code on the same line or in a series of lines.
Questions Step 4
What do you conclude from the histograms in terms of distribution? Do the variables follow a normal distribution or are they skewed?
- For the variable
mean.acc? - For the variable
mean.self? - For the variable
AGE?
Step 5: Practice editing the appearance of a histogram plot step-by-step
Action 0.: In a new code chunk, use
ggplot()withgeom_histogram()to look at the distribution ofSHIPLEY.
We are going to revise editing:
- The appearance of the bars using
binwidth. - The colour of the background using
theme_bw(). - The appearance of the labels using `labs().
- Setting the x-axis limits to reflect the full range of possible scores on the x-axis variable.
- Adding annotation – here, a vertical line – indicating the sample average for a variable.
Action 1. Edit the appearance of the bars by specifying a
binwidthvalue.
ggplot(data = study.two.gen, aes(x = SHIPLEY)) +
geom_histogram(binwidth = 2)Action 2. Then add an edit to the appearance of the background using
theme_bw().
ggplot(data = study.two.gen, aes(x = SHIPLEY)) +
geom_histogram(binwidth = 2) +
theme_bw()Action 3. Then add an edit to the appearance of the labels using
labs().
ggplot(data = study.two.gen, aes(x = SHIPLEY)) +
geom_histogram(binwidth = 2) +
theme_bw() +
labs(x = "Vocabulary (SHIPLEY)", y = "Frequency count")Action 4. Now add an edit by setting the x-axis limits using
x.lim().
ggplot(data = study.two.gen, aes(x = SHIPLEY)) +
geom_histogram(binwidth = 2) +
theme_bw() +
labs(x = "Vocabulary (SHIPLEY)", y = "Frequency count") +
xlim(0,40)Action 5. Then add an edit to draw a vertical line to show the mean value of the variable you are plotting..
ggplot(data = study.two.gen, aes(x = SHIPLEY)) +
geom_histogram(binwidth = 2) +
theme_bw() +
labs(x = "Vocabulary (SHIPLEY)", y = "frequency count") +
xlim(0,40) +
geom_vline(xintercept = mean(study.two.gen$SHIPLEY), colour = "red", size = 1.5)Step 6: Create scatterplots to examine the association between some variables
Now we are ready to build a scatterplot to visualise the relationship between some variables. Our research questions are:
- What person attributes predict success in understanding health information?
- Can people accurately evaluate whether they correctly understand written health information?
Create three scatterplots to visualise the relationship between (1.) the outcome mean.acc and (2.) each of three numeric potential predictor variables SHIPLEY, HLVA and AGE.
Action: Insert a new code chunk and use
ggplot()withgeom_point()) to create a scatterplot. In both research questions,mean.accis the outcome variable, so lets put that on the y-axis. Make several plots, with a different variable on the y-axis each time. If you need more guidance on how to do this, look at the Hint below.
- We are working with
geom_point()and you need x and y aesthetic mappings. - The outcome variable
mean.acchas to be mapped to the y-axis using...y = ...
This is how the target scatterplot code works.
ggplot(data = data.set, aes(x = predictor.variable, y = outcome.variable)) +
geom_point()The plot code moves through the following steps:
ggplot(...)make a plot;ggplot(data = data.set, ...)working with thedata.set, using the name you gave the dataset you are working with;ggplot(...aes(x = predictor.variable, y = outcome.variable))using two aesthetic mappings
x = predictor.variablemaps values of thepredictor.variable(whatever it is called) to x-axis (horizontal, left to right) positions;y = outcome.variablemaps values of theoutcome.variable(whatever it is called) to y-axis (vertical, bottom to top) positions;
geom_point()show the mappings as points.
Step 7: Edit the appearance of each plot step-by-step
You may want to use the same plot appearance choices for all plots. Producing plots with a consistent appearance will make it easier for your audience to read your plots.
You can find more information about all the different parts of ggplot() in the ggplot() cheatsheet
Action 1. First, edit the appearance of the points using
alpha,size,shape, andcolour.
Check out the example code for each of the scatterplots.
- Notice what changes and what stays the same.
ggplot(data = study.two.gen, aes(x = SHIPLEY, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square')
ggplot(data = study.two.gen, aes(x = HLVA, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square')
ggplot(data = study.two.gen, aes(x = AGE, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square')Action 2. Then edit the colour of the background using
theme_bw().
Check out the example code for each of the scatterplots.
- Notice what changes and what stays the same.
ggplot(data = study.two.gen, aes(x = SHIPLEY, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw()
ggplot(data = study.two.gen, aes(x = HLVA, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw()
ggplot(data = study.two.gen, aes(x = AGE, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw()Action 3. Then edit the appearance of the labels using
labs().
Check out the example code for each of the scatterplots.
- Notice what changes and what stays the same.
ggplot(data = study.two.gen, aes(x = SHIPLEY, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw() +
labs(x = "Vocabulary (SHIPLEY)", y = "Mean accuracy")
ggplot(data = study.two.gen, aes(x = HLVA, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw() +
labs(x = "Health Literacy Test Score", y = "Mean accuracy")
ggplot(data = study.two.gen, aes(x = AGE, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw() +
labs(x = "Age (Years)", y = "Mean accuracy")Action 4. Then set the x-axis and y-axis limits to the minimum-maximum ranges of the variables you are plotting.
You can set axis limits by adding the xlim() and ylim() function calls to the chunk of code you have written to produce each plot.
- The task, here, is to work out what numeric values you should enter inside
xlim()orylim(). - The code works if you enter values like this:
xlim(minimum, maximum)andylim(minimum, maximum). - Where
minimum, maximumare the numbers representing the smallest possible (minimum) and largest possible (maximum) value for each variable.
- For these plots the y-axis limits will be the same because the outcome stays the same.
- But the x-axis limits will be different for each different predictor variable.
- Check out the information in the
summary()you got of the dataset. - The minimum values for the variables will often (not always) be 0 e.g. if you are looking at data from ability tests and people who do the tests can get 0 (because none of their responses are correct). However, if you are looking at e.g. ratings data then the minimim value could be 1 (e.g. because people are asked to rate something on a scale from 1-9).
- The maximum values for the variables is not necessarily the largest value recorded for that variable in the sample data-set you are working with (e.g., because nobody in your sample got all test questions correct). Thus, you need to use information about measurement design as summarised in Step 3.
Check out the example code for each of the scatterplots.
- Notice what changes and what stays the same.
ggplot(data = study.two.gen, aes(x = SHIPLEY, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw() +
labs(x = "Vocabulary (SHIPLEY)", y = "Mean accuracy") +
xlim(0, 40) + ylim(0, 1)
ggplot(data = study.two.gen, aes(x = HLVA, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw() +
labs(x = "Health Literacy Test Score", y = "Mean accuracy") +
xlim(0, 16) + ylim(0, 1)
ggplot(data = study.two.gen, aes(x = AGE, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
theme_bw() +
labs(x = "Age (Years)", y = "Mean accuracy") +
xlim(0, 80) + ylim(0, 1)Step 8: Examine the correlations between the outcome variable and predictor variables
One of our research questions is:
- What person attributes predict success in understanding?
Action: Examine the correlations between the outcome variable and predictor variables by running three separate correlations: 1. between mean accuracy and
SHIPLEY; 2. between mean accuracy andHLVA; 3. between mean accuracy andAGE. Make sure to use ‘Bonferroni’ to adjust for conducting multiple correlations.
Use the correlation() function we used in earlier week. You need to specify the following information inside the correlation() function:
- data: data =
your.data - variables: select = c(“variable1”, “variable2”)
- method = “pearson” or “spearman”
- p_adjust = “none” or “Bonferroni”
correlation(study.two.gen,
select = c("SHIPLEY", "mean.acc"),
method = "pearson",
p_adjust = "bonferroni")
correlation(study.two.gen,
select = c("HLVA", "mean.acc"),
method = "pearson",
p_adjust = "bonferroni")
correlation(study.two.gen,
select = c("AGE", "mean.acc"),
method = "pearson",
p_adjust = "bonferroni")Questions Step 8 Now use the results from the correlations to answer the following questions:
- What is
r, the coefficient for the correlation betweenmean.accandSHIPLEY? - Is the correlation between
mean.accandHLVAsignificant? - What are the values for t and p for the significance test for the correlation between
mean.accandAGE? - For which pair of outcome-predictor variables is the correlation the largest?
- What is the sign or direction of each of the correlations?
Step 9: Examine the relation between outcome mean accuracy (mean.acc) and each of the potential predictors: SHIPLEY, HLVA and AGE using the linear model
The research question we are focussing on today is:
- What person attributes predict success in understanding health information?
Action: In a new code chunk, write code to examine the relation between outcome mean accuracy (
mean.acc) and each of the predictors:SHIPLEY,HLVAandAGEusing thelm()function. Note that you need to run three separatelm()analyses: 1. with mean accuracy as the outcome andSHIPLEYas the predictor; 2. with mean accuracy as the outcome andHLVAas the predictor; 3. with mean accuracy as the outcome andAGEas the predictor. Use the information in the ‘Hint’ to help you. Try to write the code yourself. Compare the code you’ve written to the code snippet below.
lm() function work?
You need to use lm() to do the analyses.
- Be careful to identify the outcome and predictor variables correctly.
- Remember that analysis code is arranged like this:
lm(outcome.variable ~ predictor.variable, data = data.set)With:
lm()asking R to do the linear model analysis;outcome.variable ~ ...specified on the left of the~;- the
predictor.variable ~ ...specified on the right of the~; - and
data.setidentifying to R what dataset you are working with.
Notice that R has a general formula syntax:
outcome ~ predictor *or* y ~ x
- and uses the same format across a number of different functions;
- each time, the left of the tilde symbol
~is some output or outcome; - and the right of the tilde
~is some input or predictor or set of predictors.
Check out the example code for each of the models.
model.1 <- lm(mean.acc ~ SHIPLEY, data = study.two.gen)
summary(model.1)
model.2 <- lm(mean.acc ~ HLVA, data = study.two.gen)
summary(model.2)
model.3 <- lm(mean.acc ~ AGE, data = study.two.gen)
summary(model.3)Questions Step 8
- What is r, the coefficient for the correlation between
mean.accandSHIPLEY? - Is the correlation between
mean.accandHLVAsignificant? - What are the values for t and p for the significance test for the correlation between
mean.accandAGE? - For which pair of outcome-predictor variables is the correlation the largest?
- What is the sign or direction of each of the correlations?
Step 10: Use a model we have fitted to plot model predictions
We can use the model we have just fitted to plot the model predictions. We are going to draw a scatterplot and add a line. The line will show the model predictions, given the model intercept and effect coefficient estimates.
You can see reference information here:
Action 1: In a new code chunk, first fit a model and get the summary: model the relationship between
mean.accandHLVA. Make a note of the following information from the model summary so you can use it next: the coefficient estimate for the intercept and the coefficient estimate for the slope ofHLVA.
Use the lm() function, like you did in Step 9.
model <- lm(mean.acc ~ HLVA, data = study.two.gen)
summary(model)Action 2: Then, draw a prediction plot, using the
geom_point()to draw a scatterplot and using thegeom_abline()function to draw the prediction line representing the association between this outcome and predictor. Check first if you can write the code you need to produce the prediction plot. Then have a look at the code example: compare it to the code you wrote.
ggplot(data = study.two.gen, aes(x = HLVA, y = mean.acc)) +
geom_point(alpha = 0.5, size = 2, colour = "blue", shape = 'square') +
geom_abline(intercept = 0.522016, slope = 0.026207,
colour = "red", linewidth = 1.5) +
theme_bw() +
labs(x = "HLVA", y = "mean accuracy") +
xlim(0, 15) + ylim(0, 1)Lab activity 2: Building the questionnaire study on Gorilla
You will build the study on the Gorilla platform. Follow the instructions on the project page in the section Building the questionnaire study on Gorilla here.
Answers
Lab activity 1:
Questions Step 3
- Data from how many participants does the data file contain?
- What is the maximum age that was recorded for participants in this sample?
- On average, how accurate are participants when tested on their understanding of written health information?
Questions Step 4
What do you conclude from the histograms in terms of distribution? Do the variables follow a normal distribution or are they skewed?
- For the variable
mean.acc? - For the variable
mean.self? - For the variable
AGE?
Questions Step 8
- What is r, the coefficient for the correlation between
mean.accandSHIPLEY? - Is the correlation between
mean.accandHLVAsignificant? - What are the values for t and p for the significance test for the correlation between
mean.accandAGE? - For which pair of outcome-predictor variables is the correlation the largest?
- What is the sign or direction of each of the correlations?
Questions Step 9
- What is the estimate for the coefficient of the effect of the predictor
HLVAonmean.acc? - Is the effect significant?
- What are the values for t and p for the significance test for the coefficient?
- How would you describe in words the shape or direction of the association between
HLVAandmean.acc? - How how would you describe the relations apparent between the predictor and outcome in all three models?