author: “MuSt Peer Mentoring Group” output: html_document: theme: cerulean encoding: UTF-8 editor_options: chunk_output_type: console —


Notes & Setup

Abstract

Session 2 (4.45 - 5.45pm, Peter Edelsbrunner)

Title: Pimp your R-workflow, with Markdown and beyond!

Description: In this session, I will provide an overview of RMarkdown-based tools for documenting analyses, writing papers, giving presentations, setting up homepages and blogs, writing books, and the MplusAutomation package linking R with Mplus. Each tool will receive 5 minutes overview of its functionalities, and a quick overview of useful educational resources. In addition, all of us will exchange our experiences with different tools that further help us pimp our workflow, such as the greatest and most legendary R-packages. The session can be done hands-on or hands-off, and will hopefully result in a Markdown-document with our assembled knowledge about the best tools available and relevant educational resources.

see also https://awesome-r.com/ and https://support.rstudio.com/hc/en-us/articles/201057987-Quick-list-of-useful-R-packages

Markdown in Overleaf (LaTeX) https://www.overleaf.com/learn/latex/Articles/How_to_write_in_Markdown_on_Overleaf MuSt workflow collection https://www.overleaf.com/project/5db9898dd71e870001260eb6

Setup

R-packages: Structural Equation Modeling

Lavaan

accessible

  • capabilities:

multigroup, categorical data (e.g. WLSMV estimator), missing data (FIML estimator), two-level

  • limitations:

no missing data handling with categorical indicator variables

OpenMX

advanced, complex

R-packages: Multilevel Modeling

lme4

the classic

R-packages: Bayesian Statistics

brms

awesome, accessible, similar syntax as the lme4-package for (frequentist) multilevel models, but much more versatile

general intro: https://cran.r-project.org/web/packages/brms/vignettes/brms_multilevel.pdf

further worthwhile tutorials: https://www.rensvandeschoot.com/tutorials/brms-started/ https://www.barelysignificant.com/pdf/2018_Nalborczyk_etal_preprint.pdf Various brms blogposts: https://paul-buerkner.github.io/blog/brms-blogposts/

  • capabilities:

multiple types of dependent and independent variables: e.g. normal, nominal, ordinal, count

(e.g., Wiener) diffusion models (here a good tutorial, slightly complex but worth it!)

everything multilevel, crossed-random effects, multiple levels

good default prior specifications

Bayes factors

  • limitations:

not yet real latent variable modeling and path modeling

Bayes factors extremely unreliable, need massive oversampling from posterior (10x as many samples as regular model estimation - usually 1000-2000, for reliable BFs at least 10000-20000) (see discussion here; other options for BayesFactors see here)

BayesFactor

accessible

  • capabilities:

some multilevel reliable Bayes factors good default prior specifications

  • limitations:

Further awesome stats resources

Combine brms, ggplot2, and the tidyverse universe of packages: https://bookdown.org/ajkurz/Statistical_Rethinking_recoded/

lists of useful packages: https://support.rstudio.com/hc/en-us/articles/201057987-Quick-list-of-useful-R-packages https://awesome-r.com/