Lisa DeBruine
  • Posts
  • Talks
Categories
All (32)
aggregation (1)
alpha (2)
anova (1)
apply (1)
categorical (2)
coding (1)
correlated data (1)
cronbach (2)
data (2)
data import (1)
dataviz (1)
effect (1)
experimentum (1)
factanal (1)
false positives (1)
faux (2)
function (1)
functions (1)
ggplot (1)
headers (1)
icc (1)
interactive (1)
lme4 (2)
lmer (4)
mann whitney (1)
map (1)
methods (1)
mixed effects (2)
nest (1)
non-parametric (1)
normality (1)
p-value (1)
pca (1)
pedagogy (2)
pipes (1)
pmap_dfr (1)
power (2)
preregistration (1)
princomp (1)
psych (1)
psych-r-package (1)
purrr (1)
qqplot (1)
R (28)
recoding (2)
rep (1)
scale (1)
simulation (12)
SPSS (1)
stats (2)
test (1)
testthat (1)
tidyverse (6)
treatment (1)
web (1)
wrangling (1)

Posts

Recoding with case_match and case_when

R
tidyverse
recoding
categorical
I wrote previously about recoding characters into numbers using various coding schemes and about recoding numeric values into characters in 2017, where I covered, the recode()…
2024-02-16
Lisa DeBruine

Loops

R
apply
map
simulation
This tutorial will introduce a few ways you can iterate your code. We’ll use the {tictoc} package to time each method to show how they differ.
2022-06-10

Data from Images

R
data
wrangling
I saw this a few days ago and sympathised, because I’ve often wanted to use data that is trapped in images or PDFs. If it’s not too much, I’ll manually transcribe it, but…
2021-10-17

Testing for normality

R
normality
qqplot
You’ve probably been directed here because you asked someone about how to test the normality of predictors in an analysis. However, statistical tests like t-tests, ANOVAs…
2021-02-01

Experimentum Data Wrangling Demo

R
data
tidyverse
experimentum
(updated 2021-01-21)
2021-01-20

Function Tips

stats
functions
I see a lot of functions from people new to coding that look like this and I want to point out a few common conceptual mistakes with writing functions.
2020-12-17

Mann-Whitney False Positives

R
mann whitney
non-parametric
power
false positives
simulation
One of my favourite colleagues, Phil McAleer, asked about unequal sample sizes for Mann-Whitney tests on our group chat today. I had no idea, so, as always, I thought “This…
2020-09-03

How many simulations in my power analysis?

simulation
R
power
Today I was trying to figure out how to advise on the number of simulations to run when calculating power by simulation.
2020-08-17

Testing interactive functions

R
interactive
test
testthat
I’m a huge fan of unit tests, but it’s tricky to test interactive functions where the user needs to enter input before the function can progress. I used to test them…
2020-07-31

Inputting data table rows as function arguments

R
purrr
pmap_dfr
function
simulation
I was working on a simulation project with an undergraduate dissertation student today (I’m so amazed at what our students can do now!) and wanted to show her how to…
2020-02-06

Composite Images

methods
simulation
I recently responded to a tweet about a preprint about whether people can see Dark Triad traits (narcissism, Machiavellianism, and psychopathy) in facial appearance.
2020-01-31

What’s wrong with aggregating data?

R
lmer
mixed effects
anova
aggregation
simulation
Shiny app for a face-rating example.
2019-03-04

Simulating Random Slopes

R
simulation
lmer
lme4
This tutorial has been moved to the tutorials section.
2019-01-09

Simulate from Existing Data

R
simulation
faux
I added a new function to the package faux to generate a new dataframe from an existing dataframe, simulating all numeric columns from normal distributions with the same…
2018-12-29

Simulating Mixed Effects

R
simulation
lmer
lme4
This tutorial has been moved to the tutorials section.
2018-12-26

Simulating Multiple Vectors

R
correlated data
simulation
faux
I’m working on a package for simulations called faux. (Update: faux is now on CRAN!)
2018-12-22

Pipes

R
tidyverse
pipes
Pipes are a way to order your code in a more readable format.
2018-12-22

Plot Comparison

R
ggplot
tidyverse
dataviz
I compared bar plots to violin plots in a recent talk to make the point that real data plotted with the full distribution make your effects look less impressive than…
2018-03-28

Multi-Row Headers

R
data import
headers
A student on our help forum recently asked for help making a wide-format dataset long. When I tried to load the data, I realised the first three rows were all header rows.…
2018-02-22

How many raters do I need?

R
alpha
cronbach
I’ve often wondered how many raters I need to sample to get reliable stimulus ratings.
2018-02-17

Solution Feedback

R
pedagogy
Download a simple demo .rmd/.html.
2017-11-15

Face Research Lab PreReg Example

preregistration
Here is my internal lab pre-registration form (including an example). It is based on the OSF Preregistration Challenge forms. We use this for student projects to train them…
2017-10-23

Hidden Solutions

R
pedagogy
web
The R for Reproducible Scientific Analysis pages at software carpentry have a really nice interface for hiding and showing solutions to exercises. I’ve created my own…
2017-10-21

psych::alpha()

R
alpha
psych-r-package
cronbach
SPSS
This is a tutorial in progress on how to calculate Cronbach’s alphas using the psych package in R.
2017-09-12

nest() and irr::icc()

R
tidyverse
nest
icc
I’m going to use intra-class correlations to demonstrate how to run an analysis on subgroups of data (because I’m constantly forgetting exactly how to do it).
2017-08-21

Cumulative p

stats
p-value
EJ Wagenmakers started an interesting debate last night with a twitter poll on p-values. Some responses suggested you can multiply p-values from several tests to create a…
2017-07-27

sample()

R
simulation
First, let’s make a data frame with two variables, a and b that are both sampled from a normal distribution with a mean of 0 and SD of 1. The variablle n will be how many…
2017-07-26

recode()

R
tidyverse
recoding
categorical
I often find myself needing to recode variables. I wrote previously about recoding characters into numbers using various coding schemes. But sometimes I want to recode…
2017-07-14

PCA

R
pca
princomp
psych
factanal
Download the Rmd notebook for this example
2017-06-26

Coding Schemes

R
coding
effect
treatment
lmer
mixed effects
simulation
How you choose to code categorical variables changes how you can interpret the intercept and effects of those variables. My favourite tutorial on coding schemes explains…
2017-06-23

scale()

R
scale
You can use scale() to center and/or scale (i.e., Z-score) a vector of numbers.
2017-06-22

rep()

R
rep
rep(x, times = 1, length.out = NA, each = 1) is pretty useful for simulating data. Here are some common recipes:
2017-06-21
No matching items