options(pkgType = "binary")
update.packages(ask = FALSE)
Data Analysis for Psychology in R 3 Workbook
This site contains weekly exercises for the Data Analysis for Psychology in R 3 (DAPR3) course.
At the end of each week, solutions (where these are not already available) will be made visible directly beneath each question.
About DAPR3
Data Analysis for Psychology in R 3 (DAPR3) is a course undertaken by 3rd year students in Psychology. DAPR3 builds on the content of DAPR2 and covers more advanced methods that are invaluable for analysing many types of psychological study, preparing students for their dissertations. The course offers students a solid foundation in multilevel modeling, expanding the linear model to analyze “hierarchical data”. Such data often involves observations clustered within higher-level groups, such as trials within participants, timepoints within individuals, or children within schools. In the second half of the course, we delve into data reduction techniques. These methods allow us to effectively summarize multiple correlated variables, either through weighted composites or by positing underlying latent factors. Additionally, students will gain insights into crucial concepts, including measurement error, validity, reliability, and replicability. These concepts are especially essential for researchers in psychology, where surveys or questionnaires are used to conduct studies of underlying constructs that cannot be directly measured.
Pre-Requisites
Install/Update R & RStudio
Make sure you have installed both R and RStudio on your computer. You may have done this previously for DAPR2, in which case it is probably worth doing some updates.
Please make sure to read and follow the instructions below slowly and carefully!!
Update Packages
It’s worth keeping packages up to date, so it might be worth updating all your packages.
Running this code will update all your packages. Just put it into the console (bottom left bit of RStudio):
New packages!
Now it is probably worth installing a few of the packages that we will be using in DAPR3. There are a few that we will need. For each one, check whether you have it already installed, because there’s not much point wasting time re-installing something you already have!
- tidyverse : for organising data
- lme4 : for fitting generalised linear mixed effects models
- broom.mixed : tidying methods for mixed models
- effects : for tabulating and graphing effects in linear models
- lmerTest: for quick p-values from mixed models
- parameters: various inferential methods for mixed models
- psych: for factor analysis
- lavaan: for latent variable models