kirkegaard: GG_group_means(), easy plotting of group means using ggplot2

Do you find yourself in need of making nice ggplot2 plots for group means over and over again? Are you tired of (re-)writing big chunks of code for something that should be easy? Here’s a solution. First install the package from Github using devtools: library(devtools) install_github(“deleetdk/kirkegaard”) Then we plot: library(kirkegaard) GG_group_means(iris, “Sepal.Length”, “Species”) But what…

Continue Reading

kirkegaard: df_func()

Often I want to get the mean value for a case across a number of columns, usually years. This however gets repetitive because the base mean() function cannot handle data like that. Other times, one wants to standardize the data first, e.g. when the scales are not the same across variables. Lastly, often one wants…

Continue Reading

kirkegaard: df_add_delta()

One idea for a series of blog posts is that I could about new functions in my R package. Often I just push these without letting anyone know, but I guess it could be useful to make an introduction for them (the more interesting ones anyway) here. Function description: Adds delta (difference) columns to a…

Continue Reading

Polygenic traits and the distribution of effect sizes: years of education from Rietveld et al (2013)

It is often said that polygenic traits are based on tons of causal variants each of which has a very small effect size. What is less often discussed is the distribution of these effect sizes, although this has some implications. The first statistical importance is that we may want to modify our hyperprior if using…

Continue Reading

Web scraping with R using rvest & spatial autocorrelation

Scraping with R Although other languages are probably more suitable for web scraping (e.g. Python with Scrapy), R does have some scraping capabilities. Unsurprisingly, the ever awesome Hadley has written a great package for this: rvest. A simple tutorial and demonstration of it can be found here, which I the one I used. To do…

Continue Reading

Betas and residualized variables / does non-g ability predict GPA?

@JamesPsychol Those results don't look real to me. Betas are never exactly identical across models. — Emil O W Kirkegaard (@KirkegaardEmil) September 8, 2015 @JamesPsychol @KirkegaardEmil FSIQ is uncorrelated with the residualized factor index scores, so its beta doesn't change across models. — Timofey Pnin (@pnin1957) September 8, 2015 Let’s test that. Since we don’t…

Continue Reading