Practical 07
In this practical we will get started on the analysis for the Red study. If you want to write up the Red study for your lab report, you can get started on the analysis today. If you want to write up the Red study, complete this practical as practice for the exam!
Assessment Ahead!
The tasks we are working on today will be assessed in the lab report assessment (complete info on Canvas). So, this practical will not have solutions posted.
As we are starting work on an assessment, you should do the tasks in this practical yourself. This means that unlike previous weeks, this week you should not create a single document with your team. You must not share or copy code or text if you intend to submit your work as part of your lab report.
However, getting help from friends and colleagues is a normal and positive part of doing research and data analysis, and we want you to help each other. So, if you get stuck or have questions, you can and should ask your team for help. With your team you can resolve errors, problem-solve, look for readings, and discuss how to manage, analyse, and interpret your data. The key is that everything you submit, including all code and all writing, must be original to you.
Get set up to run the analysis as follows.
Create or open a new project to work in as usual. If you are writing your report on the Red study, you may want to make a project called report
; if not, use the week_07
project from the tutorial.
Download one of the templates from the Lab Report Information page on Canvas - either Markdown or script - and save it your project folder. Then, open it in RStudio.
Before you do anything else, run the following code in the console
If you’ve never installed the adata
package:
remotes::install_url("http://and.netlify.app/pkg/adata.zip",
build = FALSE, upgrade = "never")
If you HAVE previously installed it, you need to update it using:
remotes::install_url("http://and.netlify.app/pkg/adata.zip")
Make sure you do this even if you’ve installed the adata
package before! It has been updated and you may not get the right data for your report if you do not reinstall it.
Follow the directions in the template script or Markdown to access the data. For the purposes of this practical, you should use the line labeled “red study” and comment out or delete the line labeled “green study”.
You should now see a new object in your environment called data
. This is the dataset that you should use for today’s practical, and for the Red report.
Open Tutorial 07 to refer to for all of the following tasks.
Let’s start by getting familiar with the dataset and what variables are in it.
Explore your dataset. We’ve taught you a few ways to do this; below are some suggestions.
View or preview your data in the console.
Get a summary
of your dataset.
The dataset contains variables that have the following information, not necessarily in this order:
Get the names of the variables in your dataset and make sure you know what these variables are called in your dataset, as they will be randomly different for each person.
The original paper used a composite score as their attractiveness rating, so we’ll do the same for our replication.
Create a composite (mean) score of attractiveness for each participant across the three attractiveness ratings.
Make some notes about the following either in your Markdown or Word document.
Write down a summary of the study design in your own words. What were are the variables you will use? How are they operationalised?
Write down a short summary of what the original Red study’s results were.
Write down your own prediction. What do you think you will find in this analysis?
It’s fine for you to have your own opinion here. You can decide what you think will happen, and that can be the same or different to what the original study found.
Create a professional-looking means plot presenting the mean attractiveness ratings, with error bars, in the experimental vs control conditions.
Build your figure up one step at a time. You can decide what kind of error bars you want to use: 2 \(\times\) SEM or confidence intervals. In your writeup, your figure description should mention which you used.
Make sure to save your plot to a new object when you’re done.
Save the number of participants in a new object.
Run the t-test.
Write out the result of your analysis.
If you are working in Markdown, you can type your results directly into the document underneath the code chunk, as we have done previously. Optionally, you can also use inline code if you want to.
If you are working in script, you can instead type your results in the Word document template. Remember that R will try to run anything you type in the script as if it were code!
Save the output of your t-test in a new object.
We have set aside the Week 8 practical for the purposes of helping you write up your results. You can get a head start on this now, or finish up the tasks for today, by completing the tasks below.
If you are writing up your report, you can write the following in your Markdown document or, if you’re using a script, in the Word document provided on Canvas.
In your own words, briefly explain the design of this experiment, using your notes from the Design section above. You should include:
Note that you should not include Participants, Materials, or Methods sections.
In your own words, describe the analysis you did and what you found. You should include:
Well done!
If you’ve got to this point, you’ve already done pretty much all of the required coding and analysis for the Red report, and completed today’s practical. We’ll talk more about writing up and preparing your report to submit in Week 8.
As usual, if you have any questions, you’re welcome to post on Piazza or come to a drop-in for help.