Prof Randi Garcia
February 14, 2018
Think of the research question you were assigned to on Monday. You can read on the project page if you'd like.
Categorical
Numerical
We assume every observation in a similar condition is affected exactly the same. (Gets the same true score).
animals_sim <- animals %>%
mutate(benchmark = mean(calm)) %>%
group_by(animal) %>%
mutate(animal_mean = mean(calm),
aminal_effect = animal_mean - benchmark)
We add the effects as we go down the assembly line.
The interaction effect captures the possibility that conditions have non-additive effects, but it is also added to everythign else.
calm_sim = benchmark
+ aminal_effect
+ cue_effect
+ interaction_effect
+ student_effect
The peice of code for adding error is not dependent on which condition the observations is in.
+ rnorm(64, 0, 0.65)
Takes 64 independent draws from a normal distribution.
+ rnorm(64, 0, 0.65)
It's rnorm()
, and not rbinom()
or rpois()
…
+ rnorm(64, 0, 0.65)
The second argument is the mean.
+ rnorm(64, 0, 0.65)