Publications by Kristoffer Magnusson

Using R and lme/lmer to fit different two- and three-level longitudinal models

21.04.2015

I often get asked how to fit different multilevel models (or individual growth models, hierarchical linear models or linear mixed-models, etc.) in R. In this guide I have compiled some of the more common and/or useful models (at least common in clinical psychology), and how to fit them using nlme::lme() and lme4::lmer(). I will cover the common t...

19546 sym R (5635 sym/52 pcs) 36 img 29 tbl

[Update] P-curve visualization updated with log x-axis

13.08.2015

My p-curve tool now lets you show the x-axis on a log₁₀ scale, which makes it a lot easier to look at really small p-values. Thanks to Ged Ridgway for suggestion this! Related To leave a comment for the author, please follow the link and comment on their blog: R Psychologist. R-bloggers.com offers daily e-mail updates about R news and tu...

566 sym 2 img

[Updated] Statistical Power and Significance Testing Visualization

24.08.2015

My Statistical Power and Significance Testing Visualization now lets you vary effect size, sample size, power and significance level. There’s also a new feature to rescale the plot and by clicking-and-dragging you can pan the visualization. Related To leave a comment for the author, please follow the link and comment on their blog: R Psycho...

638 sym

Where Cohen went wrong – the proportion of overlap between two normal distributions

23.01.2017

I’ve received many emails regarding the percent of overlap reported in my Cohen’s d visualization. Observant readers, have noted that I report a different number than Cohen (and other authors). For instance, if we open p. 22 in Cohen’s Statistical power analysis for the behavior sciences, we see that Cohen writes that d = 0.5 means a 33 % n...

2995 sym R (3349 sym/5 pcs) 10 img

Where Cohen went wrong – the proportion of overlap between two normal distributions

23.01.2017

I’ve received many emails regarding the percent of overlap reported in my Cohen’s d visualization. Observant readers, have noted that I report a different number than Cohen (and other authors). For instance, if we open p. 22 in Cohen’s Statistical power analysis for the behavior sciences, we see that Cohen writes that d = 0.5 means a 33 % n...

2991 sym R (3583 sym/10 pcs) 10 img 5 tbl

Introducing ‘powerlmm’ an R package for power calculations for longitudinal multilevel models

24.08.2017

Over the years I’ve produced quite a lot of code for power calculations and simulations of different longitudinal linear mixed models. Over the summer I bundled together these calculations for the designs I most typically encounter into an R package. The purpose of powerlmm is to help design longitudinal treatment studies, with or without highe...

1671 sym R (1450 sym/1 pcs)

Are parallel simulations in the cloud worth it? Benchmarking my MBP vs my Workstation vs Amazon EC2

26.01.2018

If you tend to do lots of large Monte Carlo simulations, you’ve probably already discovered the benefits of multi-core CPUs and parallel computation. A simulation that takes 4 weeks without parallelization, can easily be done in 1 week on a quad core laptop with parallelization. However, for even larger simulations reducing the computation time...

3792 sym R (2331 sym/2 pcs) 6 img 1 tbl

Confounded dose-response effects of treatment adherence: fitting Bayesian instrumental variable models using brms

01.02.2018

Something that never ceases to amaze (depress) me, is how extremely common it is to see casual claims in RCTs, that are not part of the randomization. For instance, the relationship between treatment adherence and outcome, or between alliance and outcome, are often analyzed but seldom experimentally manipulated. This is basically observational re...

13523 sym R (13043 sym/8 pcs) 24 img

Power analysis for longitudinal multilevel models: powerlmm 0.2.0 is now out on CRAN

21.03.2018

My R packge powerlmm 0.2.0 is now out on CRAN. It can be installed from CRAN https://cran.r-project.org/package=powerlmm or GitHub https://github.com/rpsychologist/powerlmm. Changes in version 0.2.0 New features Analytical power calculations now support using Satterthwaite’s degrees of freedom approximation. Simulate.plcp will now automatica...

4420 sym

Slides from my talk on how to do power analysis for longitudinal 2- and 3-level models.

11.04.2018

Here’s the slides from a talk I gave recently at Stockholm University: “Power Analysis for Longitudinal 2- and 3-Level Models: Challenges and Some Solutions Using the R Package powerlmm”. The slides gives several code examples for a lot of powerlmm‘s functionality, and explain some of the terms I use. Related To leave a comment for the...

704 sym