Publications by Kristoffer Magnusson

How to download complete XML records from PubMed and extract data

27.04.2012

Introduction My first PubMed script (An R Script to Automatically download PubMed Citation Counts By Year of Publication) extracted yearly counts for any number of search strings, by using PubMed’s E-utilities. Specifically, it’s using the esearch-function, which will report the number of hits for your search and/or the articles PMIDs. This ...

3399 sym R (5731 sym/5 pcs) 4 img

PubMed publications in 2011 by 202 world countries: who’s the winner?

07.05.2012

Tweet Introduction I had this idea that it’d be fun to look at all PubMed’s articles from 2011 and extract country affiliation for each individual country. So I set out to do just that, but in addition to just look at 2011 I also looked at proportional change in publication 1980–2010 for the top 20 countries. The data for 2011 is visualize...

4153 sym R (2221 sym/2 pcs) 10 img

Effect of sample size on the accuracy of Cohen’s d estimates (95 % CI)

27.06.2012

Introduction I’ve been incredibly busy the last month, amongst other things I’ve moved about 400 miles from Umeå, in the north of sweden, to Stockholm. However, I’ve been working a lot with R and especially with power analysis both via Monte Carlo simulations and via analytical approaches. I will not write about power analysis here, but I ...

2205 sym R (1523 sym/2 pcs) 4 img 1 tbl

Effect of sample size on the accuracy of Cohen’s d estimates (95 % CI)

27.06.2012

Tweet Introduction I’ve been incredibly busy the last month, amongst other things I’ve moved about 400 miles from Umeå, in the north of sweden, to Stockholm. However, I’ve been working a lot with R and especially with power analysis both via Monte Carlo simulations and via analytical approaches. I will not write about power analysis here,...

2239 sym R (1500 sym/1 pcs) 4 img

The Higgs boson: 5-sigma and the concept of p-values

04.07.2012

Tweet Today’s announcement at CERN of the latest research on the Higgs boson was truly extraordinary. Not only was the scientific achievement remarkable, but medias reporting of 5-sigma as a measure of “certainty” was also truly remarkable. For instance, the science editor at the Swedish news paper Dagens Nyheter reported that a sigma of 4...

2518 sym R (848 sym/2 pcs) 2 img

How to tell when error bars correspond to a significant p-value

24.07.2012

Tweet Introduction Belia, Fidler, Williams, and Cumming (2005) found that researchers in psychology, behavior neuroscience and medicine are really bad at interpreting when error bars signify that two means are significantly different (p = 0.05). What they did was to email a bunch of researchers and invite them to take a web-based test, and they ...

2348 sym R (2437 sym/1 pcs) 8 img

Cognitive behavioral therapy outperformed psychodynamic therapy on all outcomes in a randomized controlled trail

30.07.2012

The dodo bird might be extinct in the real world but in the world of psychotherapy research it refuses to die. However, a group of German researchers recently put forward an article were they had randomized patients to either a PDT or CBT condition and measured the relative proficiency of the two orientations, and they found that their results de...

6471 sym 4 img

Analytical and simulation-based power analyses for mixed-design ANOVAs

21.05.2013

In this post I show some R-examples on how to perform power analyses for mixed-design ANOVAs. The first example is analytical — adapted from formulas used in G*Power (Faul et al., 2007), and the second example is a Monte Carlo simulation. The source code is embedded at the end of this post. Both functions require a dataframe, containing the par...

1531 sym R (1686 sym/3 pcs) 4 img

Working with shapefiles, projections and world maps in ggplot

23.05.2013

In this post I will show some different examples of how to work with map projections and how to plot the maps using ggplot. Many maps that are shown using their default projection are in the longlat-format, which is far from optimal. For plotting world maps I prefer to use either Robinson or Winkel Tripel projection—but many more are available�...

2562 sym R (6358 sym/9 pcs) 18 img

Creating a typical textbook illustration of statistical power using either ggplot or base graphics

26.05.2013

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 th...

1795 sym R (4597 sym/5 pcs) 16 img