Math, Grit and Multilevel Models (part 1)

Students are often told that perseverance pays off in the end. But does it? And if it does, can it be instilled in students? According to the authors of a large experiment in Turkey, the answer to these questions is yes. In this blogpost we scrutinze their results, which have been made public here in an exemplary way.

We use data from the second wave of the study, because it allows us to make causal inferences. We load r packages together with the data, mutate categorical variables, and have a quick look at the variables.

library(haven)
library(tidyverse)
library(naniar)
library(here)
library(brms)
library(mice)
library(ggthemes)
library(patchwork)
library(tinytex)
library(forcats) 

# second sample of 1499 students
data2 <- read_dta(here("content/post/2021-01-25-math-grit-and-multilevel-models-part-1/Sample2_Data.dta"))

# variables with common words can be factorized more efficiently
data2 <- data2 %>% mutate_at(vars(matches("choice")), as.factor) %>% 
                    mutate_at(vars(matches("success")), as.factor) %>% 
                    mutate_at(vars(matches("payoff")), as.factor) %>%     
                    mutate_at(vars(matches("difficult")), as.factor)

# the rest is done by hand
cols <- c("sample", "schoolid", "classid", "grit", "task_ability", "playedr1", "alldiff", "playedv2", "inconsistent", "male", "risk", "wealth")

data2 <- data2 %>% mutate_at(cols, funs(factor(.)))

# We rename the grit variable to clarify its importance
data2 <- data2 %>%  mutate(grit = fct_recode(grit,
                    "control" = "0",
                    "intervention" = "1"))

glimpse(data2)
## Rows: 1,499
## Columns: 52
## $ sample              <fct> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,...
## $ schoolid            <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ classid             <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ studentid           <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...
## $ grit                <fct> intervention, intervention, intervention, inter...
## $ csize               <dbl> 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,...
## $ mathscore1          <dbl> -1.5463763, -1.5463763, 1.0885546, -1.5463763, ...
## $ verbalscore1        <dbl> -0.2813259, 0.3570126, 1.6336896, -0.9196644, 0...
## $ mathscore2          <dbl> -0.56757200, -0.09212456, 1.33421779, -1.043019...
## $ verbalscore2        <dbl> 0.3702991, -0.0632688, 0.8038670, -1.3639724, -...
## $ mathscore3          <dbl> -0.6490632, NA, NA, -0.1616417, -0.6490632, -0....
## $ verbalscore3        <dbl> -0.01901184, NA, NA, -1.36366713, -0.01901184, ...
## $ mathgrade2          <dbl> -0.8918913, -1.4404734, 1.3024373, -2.5376377, ...
## $ verbalgrade2        <dbl> -0.6461628675, -0.6461628675, 1.2911666632, -1....
## $ task_ability        <fct> 2, 3, 6, NA, 5, 3, NA, 9, 3, 3, NA, 2, 5, 4, 4,...
## $ choicer1            <fct> 1, 1, 1, NA, 1, 1, NA, 1, 0, 1, NA, 0, 1, 1, 1,...
## $ choicer2            <fct> 1, 1, 1, NA, 1, 1, NA, 1, 1, 1, NA, 1, 1, 0, 1,...
## $ choicer3            <fct> 1, 0, 0, NA, 0, 0, NA, 1, 0, 1, NA, 1, 1, 1, 1,...
## $ choicer4            <fct> 0, 0, 1, NA, 0, 0, NA, 1, 0, 1, NA, 1, 1, 1, 1,...
## $ choicer5            <fct> 0, 0, 1, NA, 0, 0, NA, 1, 0, 0, NA, 1, 1, 0, 1,...
## $ playedr1            <fct> 1, 1, 1, NA, 1, 1, NA, 1, 1, 1, NA, 1, 1, 1, 1,...
## $ alldiff             <fct> 0, 0, 0, NA, 0, 0, NA, 1, 0, 0, NA, 0, 1, 0, 1,...
## $ choicev2            <fct> 1, 1, 1, NA, 1, 0, NA, 1, 0, 1, NA, 0, 1, 1, 1,...
## $ playedv2            <fct> 1, 1, 1, 1, 1, 1, NA, 1, NA, 1, NA, 1, 1, 1, 1,...
## $ successr1           <fct> 0, 0, 0, NA, 0, 0, NA, 1, 1, 1, NA, 0, 0, 0, 0,...
## $ successr2           <fct> 0, 0, 1, NA, 0, 0, NA, 0, 0, 0, NA, 0, 0, 1, 0,...
## $ successr3           <fct> 0, 1, 1, NA, 1, 1, NA, 1, 1, 1, NA, 0, 0, 0, 0,...
## $ successr4           <fct> 1, 1, 1, NA, 1, 1, NA, 0, 1, 0, NA, 0, 0, 0, 0,...
## $ successr5           <fct> 1, 1, 0, NA, 1, 1, NA, 1, 1, 1, NA, 0, 0, 1, 0,...
## $ successv2           <fct> 0, 0, 1, 0, 1, 0, NA, 1, NA, 1, NA, 0, 1, 0, 0,...
## $ payoffr1            <fct> 0, 0, 0, NA, 0, 0, NA, 4, 4, 4, NA, 0, 0, 0, 0,...
## $ payoffr2            <fct> 0, 0, 4, NA, 0, 0, NA, 0, 0, 0, NA, 0, 0, 1, 0,...
## $ payoffr3            <fct> 0, 1, 1, NA, 1, 1, NA, 4, 1, 4, NA, 0, 0, 0, 0,...
## $ payoffr4            <fct> 1, 1, 4, NA, 1, 1, NA, 0, 1, 0, NA, 0, 0, 0, 0,...
## $ payoffr5            <fct> 1, 1, 0, NA, 1, 1, NA, 4, 1, 1, NA, 0, 0, 1, 0,...
## $ payoffv2            <fct> 0, 0, 4, 0, 4, 0, NA, 4, NA, 4, NA, 0, 4, 0, 0,...
## $ bothpayoffs         <fct> 0.400000005960464, 0.600000023841858, 5.8000001...
## $ avpayoffv1          <fct> 0.400000005960464, 0.600000023841858, 1.7999999...
## $ difficult_imposedr1 <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ difficult_imposedv2 <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
## $ inconsistent        <fct> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
## $ belief_survey1      <dbl> -0.8300257, -0.8300257, -0.8300257, 0.2235301, ...
## $ grit_survey1        <dbl> -0.9890393, -0.1146530, 0.7597334, -1.8634257, ...
## $ belief_survey2      <dbl> 0.39143115, 0.83131617, 1.45293784, -0.07900735...
## $ grit_survey2        <dbl> 1.23553312, 0.54137754, 0.38077089, -1.32405376...
## $ confidence_survey2  <dbl> -0.36769900, -1.60354412, -0.46631369, -1.15136...
## $ male                <fct> 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0,...
## $ age                 <dbl> NA, 9.833333, 9.416667, NA, 11.916667, 10.66666...
## $ risk                <fct> NA, 4, 3, 3, 1, 1, 1, 1, 1, 2, 3, 3, 1, 1, 3, N...
## $ success             <fct> 3, 3, 5, 2, 3, 3, 3, 4, 3, 4, 5, 3, 4, 4, 2, 3,...
## $ wealth              <fct> 3, 2, 3, 3, 2, 2, 3, 4, 3, 3, 2, 3, 3, 2, 2, 3,...
## $ raven               <dbl> 0.09375709, 0.83751386, 1.58127069, -2.13751340...

We notice that numeric variables have already been standardized. This makes comparisons of their relative effects easier.

Visual exploration

For the experiment 16 schools were randomly divided into a control and intervention group. In the intervention group students followed a special training program to increase their grit. Let us see how schools, classes and students were divided over the two groups.

data2 %>% group_by(grit) %>% 
  summarize(count_school = n_distinct(schoolid),
            count_class = n_distinct(classid), 
            count_students = n_distinct(studentid))
## # A tibble: 2 x 4
##   grit         count_school count_class count_students
##   <fct>               <int>       <int>          <int>
## 1 control                 8          24            816
## 2 intervention            8          18            683

Whereas schools were divided evenly over the groups, classes and students were not. This confirms that the researchers exerted control over the allocation of schools, but not over classes and students.

Regardless, the graphs below show that properties such as raven IQ and verbal scores are pretty evenly distributed among the two groups. This is not true for wealth though, a variable that measures the income group of the parents.

p1 <- data2 %>% ggplot(aes(x=raven)) +
  geom_density() +
  facet_wrap(~ grit, nrow=2) +
  labs(x="raven IQ score") +
  theme_tufte() +
    theme(
    panel.border = element_rect(colour = "black", fill=NA, size=1),
    strip.background = element_rect(
     color="black", fill="#F9EBEA", size=1.5, linetype="solid"
     ))

p2 <- data2 %>% drop_na() %>% 
  ggplot(aes(x=wealth)) +
  geom_bar(aes(x = wealth, y = ..prop.., group=1), stat = "count") +
  facet_wrap(~ grit, nrow=2)+
  labs(y="proportion") +
  theme_tufte()+
    theme(
    panel.border = element_rect(colour = "black", fill=NA, size=1),
    strip.background = element_rect(
     color="black", fill="#F9EBEA", size=1.5, linetype="solid"
     ))

p3 <- data2 %>% group_by(grit) %>% ggplot(aes(x=verbalscore1)) +
  geom_bar(aes(x = verbalscore1, y = ..prop..), stat = "count", width=0.7) +
  facet_wrap(~ grit, nrow=2)+
  labs(x="verbal score 1", y="proportion") +
  theme_tufte()+
    theme(
    panel.border = element_rect(colour = "black", fill=NA, size=1),
    strip.background = element_rect(
     color="black", fill="#F9EBEA", size=1.5, linetype="solid"
     ))

p1 + p3 +p2 

In order to get a feel for the impact of the experiment, we split out the effect of grit on the differences in scores on a math test before and after the intervention.

data2 <- data2 %>% mutate(math_diff = mathscore2-mathscore1)

ggplot(data = na.omit(data2[c("grit", "wealth", "math_diff")]), aes(factor(wealth), math_diff)) +
  geom_boxplot() +
  facet_wrap(~ factor(grit)) +
  labs(y="difference in math scores",
       x= "wealth groups") +
  geom_hline(yintercept = 0, color="red", size=1) +
  theme_tufte() +
  theme(
    panel.border = element_rect(colour = "black", fill=NA, size=1),
    strip.background = element_rect(
     color="black", fill="#F9EBEA", size=1.5, linetype="solid"
     ))

There is some movement in the intervention group. Pupils from lower wealth classes seem to benefit from the grit intervention, whereas those from higher wealth classes may suffer.

Let us also quickly check if the difference in math scores depends on the skill level of the student. To this end we draw a least squares line that fits the score on the second math test based on the first. We do this both for students in the control group and for those in the intervention group. The transparent grey band around the lines are 95% confidence intervals.

data2 %>% ggplot(aes(x=mathscore1, y=mathscore2, color=grit)) +
  geom_jitter() +
  geom_smooth(method="lm") +
  scale_color_manual(values=c("grey", "red")) +
  theme_tufte() +
  theme(
    panel.border = element_rect(colour = "black", fill=NA, size=1))
## `geom_smooth()` using formula 'y ~ x'

The graph can be interpreted as follows. Suppose we were given a student’s score on the first math test and asked to predict the score on the second math test. In that case we would predict a larger increase if we were also told that the student was in the intervention group. We would do so confidently if the student had a low score on the first test and less so if the initial score was higher. This makes sense. Fostering grit is likely to benefit those who need to work the hardest for a good score.

Missing values

Next, we want to get an overview of missing values.

vis_miss(data2)

We note that about 10% of values are missing. Let’s look at hotspots of missingsness.

gg_miss_upset(data2)

The main culprits are mathscore3 and verbalscore3, which is as expected given that mathscore1 and mathscore2 were obtained right before and after the experiment, while mathscore3 was collected two and a half years later.

Leaving the missing data out is a bad idea, because they could bias results and increase the standard error. Below we see that the missingness of scores on the math tests is not distributed evenly over the control and intervention groups, for example.

data2 %>% 
  select(mathscore2, grit, mathscore3) %>%
  group_by(grit) %>% 
  summarise_all(funs(sum(is.na(.))))
## # A tibble: 2 x 3
##   grit         mathscore2 mathscore3
##   <fct>             <int>      <int>
## 1 control              62        384
## 2 intervention         90        334

So instead we impute values. That is, we carry out a bunch of regressions in several orders until the imputed values converge. The regression models have an error component however, such as the standard deviation for a standard linear regression. When we predict one value from such a model, it will be a little different every time. We deal with this problem by making many predictions, and storing them in several data sets, which we will then all feed into the model that we use for our analysis. The package mice does the imputation for us. We only need to specify which method should be used for which type of variable.

data2_imp <- mice(data2, m = 5, 
                         defaultMethod =c("cart", "lda", "pmm", "polr"),
                  file="fits/data2_imp")
## 
##  iter imp variable
##   1   1  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   1   2  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   1   3  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   1   4  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   1   5  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   2   1  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   2   2  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   2   3  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   2   4  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   2   5  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   3   1  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   3   2  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   3   3  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   3   4  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   3   5  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   4   1  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   4   2  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   4   3  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   4   4  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   4   5  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   5   1  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   5   2  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   5   3  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   5   4  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
##   5   5  mathscore1  verbalscore1  mathscore2  verbalscore2  mathscore3  verbalscore3  mathgrade2  verbalgrade2  task_ability*  choicer1  choicer2  choicer3  choicer4  choicer5  playedr1  alldiff  choicev2  playedv2  successr1  successr2  successr3  successr4  successr5  successv2  payoffr1*  payoffr2*  payoffr3*  payoffr4*  payoffr5*  payoffv2*  bothpayoffs*  avpayoffv1*  belief_survey1  grit_survey1  belief_survey2  grit_survey2  confidence_survey2  age  risk*  success*  wealth*  raven  math_diff
stripplot(data2_imp, verbalscore3 ~ age | .imp, pch = 20, cex = 0.1,
                    jitter.data = TRUE)

stripplot(data2_imp, mathscore3 ~ age | .imp, pch = 20, cex = 0.1,
                    jitter.data = TRUE)

stripplot(data2_imp, age ~ mathscore2 | .imp, pch = 20, cex = 0.1,
                    factor=2,
                    jitter.data = TRUE)

The graphs of the imputation process suggest that we haven’t imputed any crazy values.

Edi Terlaak
Edi Terlaak

I like to tell stories about statistics.