Upon completing this module, students will be able to:
Someone briefly remind us of the design of the study (focus on study 5).
Results from two \(\chi^2\) tests from study 5.
“…participants are more likely to follow through when they are assigned a cue-based reminder (in the forced-reminder through-association condition, 87%) than when no cue-based reminder is available (none condition, 59%), \(\chi^2\)(1, N = 305) = 30.22, p < .001.”
“…those in the costly-reminder-through-association condition were not only more likely to earn the bonus (74%) than those in the none condition (59%), \(\chi^2\)(1, N = 297) = 7.23, p = .007,…”
Complete the steps in the “Setup” portion of the lab activity.
condition
, choice
, and correct
. Read from “codebook database.xlsx” to identify appropriate factor labels.Import “RTA_study5.csv” to R.
Convert the following variables to factors, condition
, choice
, and correct
. Read from “codebook database.xlsx” to identify appropriate factor labels.
condition
to FactorThe codebook tells us the levels/labels for condition.
## [1] Free Costly Costly None Free Free All All None All
## Levels: Free None Costly All
choice
to FactorWhat does choice
tell us?
## [1] took reminder took reminder did not take reminder
## [4] did not take reminder did not take reminder did not take reminder
## [7] did not take reminder did not take reminder did not take reminder
## [10] took reminder
## Levels: did not take reminder took reminder
correct
to FactorWhat does correct
tell us?
## [1] correct incorrect incorrect correct correct correct incorrect
## [8] correct correct correct
## Levels: incorrect correct
“…participants are more likely to follow through when they are assigned a cue-based reminder (in the forced-reminder through-association condition, 87%) than when no cue-based reminder is available (none condition, 59%), \(\chi^2\)(1, N = 305) = 30.22, p < .001.”
data.frame
that includes only the relevant levels of condition
.droplevels()
to drop the extra levels of condition
.Hint: You can use either |
or %in%
to subset with one line of code. Otherwise, you could do it in two steps.
|
Remember that |
means “or”.
Can you imagine a situation where this approach might be unwieldy?
%in%
Why should you check your work as you go?
We don’t need to see this in your code
We can check with the function all()
, which returns:
## [1] TRUE
all()
can be a useful tool for testing your code.
Alternatively, we can use summary()
, which will count the number of times each factor level occurs.
## Free None Costly All
## 0 153 0 152
Why do we need to do this?