## Articles in the R category

My R package 'powerlmm' has now been update to version 0.2.0. It contains several improvements, and new features.

Read more
Non-randomized comparisons are common in RCTs. In this post I show some examples of confounding and collider bias, using treatment adherence as an example. I present a small simulation study that show that common regression models used in clinical psychology, makes little sense, and that Bayesian instrumental variable regression can be easily fit using the R package brms.

Read more
In this post I compare the performance of Amazon EC2 instances vs my HP workstation and my MacBook Pro, when doing Monte Carlo simulations.

Read more
Over the summer I've been working on finishing my new R package 'powerlmm', which is now almost complete. It provides flexible power calculations for typical two- and three-level longitudinal linear mixed models, with unbalanced treatment groups and cluster sizes, as well as with missing data and random slopes at both the subject and cluster-level.

Read more
This post explains how Cohen's d relates to the proportion of overlap between two normal distributions, and why I use a different measure then Cohen in my Cohen's d visualization.

Read more
I often get asked about how to fit different longitudinal models in lme/lmer. In this post I cover several different two-level, three-level and partially nested models.

Read more
In this post I will use the theoretical and empirical sampling distribution of Cohen’s d to show the expected overestimation due to selective publishing. I will look at the overestimation for various sample sizes when the population effect is 0, 0.2, 0.5 and 0.8. The conclusion is that you should be weary of effect sizes from small samples, and that the issue is rather with type M (magnitude) errors than type I errors. At least is clinical psychology the pervasive problem is overestimation of effects and not falsely rejecting null hypothesis.

Read more
Last week a group of Dutch scientists published a study providing further evidence of mindfulness’ ability to bolster creativity. Specifically they looked at if open awareness differed from focused attention in increasing divergent thinking

Read more
A common way of illustrating the idea behind statistical power in null hypothesis significance testing, is by plotting the sampling distributions of the null hypothesis and the alternative hypothesis. Typically, these illustrations highlight the regions that correspond to making a type II error, type I error and correctly rejecting the null hypothesis (i.e. the test’s power). In this post I will show how to create such “power plots” using both ggplot and R’s base graphics.

Read more
In this post I show some different examples of how to work with map projections and how to plot the maps using ggplot. Many maps that are using the default projection are shown in the longlat-format, which is far from optimal. Here I show how to use either the Robinson or Winkel Tripel projection.

Read more