Practical 06
In this practical we will get started on the analysis for the Green study. If you want to write up the Green 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 Green study, you may want to make a project called report
; if not, use the week_06
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 “green study” and comment out or delete the line labeled “red 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 Green report.
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.
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 Green 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.
In the original study, Griskevicious et al. (2010) asked their participants to choose between green or non-green versions of three different products. For your report, you should analyse the results for only one of the three products you have in your data. Keep in mind that the product you choose will also be the one that you should do background reading about, and talk about in your discussion.
Choose one of the three products: car, dishwasher, or cleaner.
Filter your data so that it only contains responses for your chosen product.
Don’t forget to assign this change back to your data!
Use the data only for this single product for the rest of the analyses.
The tasks below describe all of the analysis steps you are required to complete for the lab report. The tutorial for this week describes how to do all of these tasks, with examples. If you get stuck, look there first.
Create a professional-looking bar chart presenting the counts of green vs luxury product choice in the experimental vs control conditions.
Build your figure up one step at a time. Think carefully about which variables to put where - you can even look at the original paper for ideas!
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 \(\chi^2\) analysis for your chosen product.
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.
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 \(\chi^2\) test in a new object.
Get a table of observed frequencies so you can report them later.
Get a table of expected frequencies. Are there any problems?
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 Green 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.