source("0_helpers.R")
##
## Attaching package: 'formr'
## The following object is masked from 'package:rmarkdown':
##
## word_document
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:lubridate':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week, yday, year
## The following objects are masked from 'package:formr':
##
## first, last
## Loading required package: Matrix
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
## This is lavaan 0.6-3
## lavaan is BETA software! Please report any bugs.
##
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
##
## cor2cov
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
##
## describe
## The following objects are masked from 'package:base':
##
## format.pval, units
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:Matrix':
##
## expand
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
##
## src, summarize
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:lubridate':
##
## intersect, setdiff, union
## The following objects are masked from 'package:formr':
##
## first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
##
## Attaching package: 'codebook'
## The following object is masked from 'package:psych':
##
## bfi
## The following objects are masked from 'package:formr':
##
## aggregate_and_document_scale, asis_knit_child, expired, paste.knit_asis
##
## Attaching package: 'effsize'
## The following object is masked from 'package:psych':
##
## cohen.d
### Import all data with known birthorder
birthorder = readRDS("data/alldata_birthorder.rds")
# codebook(birthorder)
## we have to exclude people in the control group who are part of the birthorder group
birthorder = birthorder %>%
# mark people who have missing birthorder data
mutate(check_birthorder = ifelse(!is.na(birthorder_genes), 1, 0),
# mark people who have missing outcomes
check_outcome = ifelse(!is.na(raven_2015_old), 1,
ifelse(!is.na(math_2015_old), 1,
ifelse(!is.na(raven_2015_young), 1,
ifelse(!is.na(math_2015_young), 1,
ifelse(!is.na(raven_2007_old), 1,
ifelse(!is.na(math_2007_old), 1,
ifelse(!is.na(raven_2007_young), 1,
ifelse(!is.na(math_2007_young), 1,
ifelse(!is.na(adaptive_numbering), 1,
ifelse(!is.na(words_remembered_avg), 1,
ifelse(!is.na(count_backwards), 1,
ifelse(!is.na(big5_ext), 1,
ifelse(!is.na(riskA), 1,
ifelse(!is.na(riskB), 1,
ifelse(!is.na(years_of_education), 1,
ifelse(!is.na(Elementary_missed), 1,
ifelse(!is.na(Elementary_worked), 1,
ifelse(!is.na(attended_school), 1,
ifelse(!is.na(wage_last_month_log), 1,
ifelse(!is.na(wage_last_year_log), 1,
ifelse(!is.na(Self_employed), 1,
ifelse(!is.na(Category), 1,
ifelse(!is.na(Sector), 1,
ifelse(!is.na(ever_smoked), 1,
ifelse(!is.na(still_smoking), 1,
0))))))))))))))))))))))))),
group_birthorder = ifelse(check_birthorder == 0, "control", "test"),
group_outcome = ifelse(check_outcome == 0, "control", "test"))
descriptives = birthorder %>%
group_by(group_outcome) %>%
summarise(individuals = n(),
mothers = length(unique(mother_pidlink)),
sibship_size_mean = mean(sibling_count_genes, na.rm = T),
sibship_size_confidence_low = mean(sibling_count_genes, na.rm = T) -
(qt(.975, n()-1)*sd(sibling_count_genes, na.rm = T)/sqrt(n())),
sibship_size_confidence_high = mean(sibling_count_genes, na.rm = T) +
(qt(.975, n()-1)*sd(sibling_count_genes, na.rm = T)/sqrt(n())),
sibship_size_min = min(sibling_count_genes, na.rm = TRUE),
sibship_size_max = max(sibling_count_genes, na.rm = TRUE),
birthorder_mean = mean(birthorder_genes, na.rm = T),
birthorder_size_confidence_low = mean(birthorder_genes, na.rm = T) -
(qt(.975, n()-1)*sd(birthorder_genes, na.rm = T)/sqrt(n())),
birthorder_size_confidence_high = mean(birthorder_genes, na.rm = T) +
(qt(.975, n()-1)*sd(birthorder_genes, na.rm = T)/sqrt(n())),
birthorder_size_min = min(birthorder_genes, na.rm = TRUE),
birthorder_size_max = max(birthorder_genes, na.rm = TRUE),
number_siblings_mean = mean(sibling_count_genes, na.rm =T),
number_siblings_confidence_low = mean(sibling_count_genes, na.rm = T) -
(qt(.975, n()-1)*sd(sibling_count_genes, na.rm = T)/sqrt(n())),
number_siblings_confidence_high = mean(sibling_count_genes, na.rm = T) +
(qt(.975, n()-1)*sd(sibling_count_genes, na.rm = T)/sqrt(n())))
descriptives
group_outcome | individuals | mothers | sibship_size_mean | sibship_size_confidence_low | sibship_size_confidence_high | sibship_size_min | sibship_size_max | birthorder_mean | birthorder_size_confidence_low | birthorder_size_confidence_high | birthorder_size_min | birthorder_size_max | number_siblings_mean | number_siblings_confidence_low | number_siblings_confidence_high |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
control | 55765 | 16301 | 4.422 | 4.396 | 4.448 | 1 | 22 | 2.689 | 2.672 | 2.707 | 1 | 22 | 4.422 | 4.396 | 4.448 |
test | 45476 | 13187 | 3.702 | 3.68 | 3.724 | 1 | 22 | 2.374 | 2.357 | 2.391 | 1 | 21 | 3.702 | 3.68 | 3.724 |
birthorder %>%
t.test(sibling_count_genes ~ group_outcome, data = ., var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
24.32 | 42680 | 9.738e-130 * * * | two.sided | 4.422 | 3.702 |
birthorder %>%
t.test(birthorder_genes ~ group_outcome, data = ., var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
15.13 | 42680 | 1.458e-51 * * * | two.sided | 2.689 | 2.374 |
birthorder %>% filter(!is.na(birthorder_genes), group_outcome == "test") %>% group_by(mother_pidlink) %>% summarise(with_data = n(), all = mean(sibling_count_genes)) -> counts
birthorder %>% filter(!is.na(birthorder_genes), group_outcome == "control") %>% group_by(mother_pidlink) %>% summarise(with_data = n(), all = mean(sibling_count_genes)) -> counts1
In our test sample families with an average size of 3.1623 siblings, we retain 1.7438.
In the original sample families with an average size of 2.896 siblings, we retain 2.2035.
ggplot(counts, aes(all, with_data)) + geom_jitter(alpha = 0.1) + geom_smooth() + scale_x_continuous(breaks=1:15) + scale_y_continuous(breaks=1:15)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
descriptives = birthorder %>%
group_by(group_outcome) %>%
summarise(individuals = n(),
mothers = length(unique(mother_pidlink)),
sibship_size_mean = mean(sibling_count_uterus_alive, na.rm = T),
sibship_size_confidence_low = mean(sibling_count_uterus_alive, na.rm = T) -
(qt(.975, n()-1)*sd(sibling_count_uterus_alive, na.rm = T)/sqrt(n())),
sibship_size_confidence_high = mean(sibling_count_uterus_alive, na.rm = T) +
(qt(.975, n()-1)*sd(sibling_count_uterus_alive, na.rm = T)/sqrt(n())),
sibship_size_min = min(sibling_count_uterus_alive, na.rm = TRUE),
sibship_size_max = max(sibling_count_uterus_alive, na.rm = TRUE),
birthorder_mean = mean(birthorder_uterus_alive, na.rm = T),
birthorder_size_confidence_low = mean(birthorder_uterus_alive, na.rm = T) -
(qt(.975, n()-1)*sd(birthorder_uterus_alive, na.rm = T)/sqrt(n())),
birthorder_size_confidence_high = mean(birthorder_uterus_alive, na.rm = T) +
(qt(.975, n()-1)*sd(birthorder_uterus_alive, na.rm = T)/sqrt(n())),
birthorder_size_min = min(birthorder_uterus_alive, na.rm = TRUE),
birthorder_size_max = max(birthorder_uterus_alive, na.rm = TRUE),
number_siblings_mean = mean(sibling_count_uterus_alive, na.rm =T),
number_siblings_confidence_low = mean(sibling_count_uterus_alive, na.rm = T) -
(qt(.975, n()-1)*sd(sibling_count_uterus_alive, na.rm = T)/sqrt(n())),
number_siblings_confidence_high = mean(sibling_count_uterus_alive, na.rm = T) +
(qt(.975, n()-1)*sd(sibling_count_uterus_alive, na.rm = T)/sqrt(n())))
descriptives
group_outcome | individuals | mothers | sibship_size_mean | sibship_size_confidence_low | sibship_size_confidence_high | sibship_size_min | sibship_size_max | birthorder_mean | birthorder_size_confidence_low | birthorder_size_confidence_high | birthorder_size_min | birthorder_size_max | number_siblings_mean | number_siblings_confidence_low | number_siblings_confidence_high |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
control | 55765 | 16301 | 4.614 | 4.587 | 4.641 | 1 | 22 | 2.775 | 2.757 | 2.793 | 1 | 22 | 4.614 | 4.587 | 4.641 |
test | 45476 | 13187 | 3.823 | 3.8 | 3.845 | 1 | 22 | 2.454 | 2.436 | 2.471 | 1 | 21 | 3.823 | 3.8 | 3.845 |
birthorder %>%
t.test(sibling_count_uterus_alive ~ group_outcome, data = ., var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
26.37 | 43320 | 5.226e-152 * * * | two.sided | 4.614 | 3.823 |
birthorder %>%
t.test(birthorder_uterus_alive ~ group_outcome, data = ., var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
15.08 | 43320 | 2.809e-51 * * * | two.sided | 2.775 | 2.454 |
birthorder %>% filter(!is.na(birthorder_uterus_alive), group_outcome == 1) %>% group_by(mother_pidlink) %>% summarise(with_data = n(), all = mean(sibling_count_uterus_alive)) -> counts
birthorder %>% filter(!is.na(birthorder_uterus_alive), group_outcome == 0) %>% group_by(mother_pidlink) %>% summarise(with_data = n(), all = mean(sibling_count_uterus_alive)) -> counts1
In our test sample families with an average size of NaN siblings, we retain 0.
In the original sample families with an average size of NaN siblings, we retain 0.
ggplot(counts, aes(all, with_data)) + geom_jitter(alpha = 0.1) + geom_smooth() + scale_x_continuous(breaks=1:15) + scale_y_continuous(breaks=1:15)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
### Maternal pregnancy birthorder
descriptives = birthorder %>%
group_by(group_outcome) %>%
summarise(individuals = n(),
mothers = length(unique(mother_pidlink)),
sibship_size_mean = mean(sibling_count_uterus_preg, na.rm = T),
sibship_size_confidence_low = mean(sibling_count_uterus_preg, na.rm = T) -
(qt(.975, n()-1)*sd(sibling_count_uterus_preg, na.rm = T)/sqrt(n())),
sibship_size_confidence_high = mean(sibling_count_uterus_preg, na.rm = T) +
(qt(.975, n()-1)*sd(sibling_count_uterus_preg, na.rm = T)/sqrt(n())),
sibship_size_min = min(sibling_count_uterus_preg, na.rm = TRUE),
sibship_size_max = max(sibling_count_uterus_preg, na.rm = TRUE),
birthorder_mean = mean(birthorder_uterus_preg, na.rm = T),
birthorder_size_confidence_low = mean(birthorder_uterus_preg, na.rm = T) -
(qt(.975, n()-1)*sd(birthorder_uterus_preg, na.rm = T)/sqrt(n())),
birthorder_size_confidence_high = mean(birthorder_uterus_preg, na.rm = T) +
(qt(.975, n()-1)*sd(birthorder_uterus_preg, na.rm = T)/sqrt(n())),
birthorder_size_min = min(birthorder_uterus_preg, na.rm = TRUE),
birthorder_size_max = max(birthorder_uterus_preg, na.rm = TRUE),
number_siblings_mean = mean(sibling_count_uterus_preg, na.rm =T),
number_siblings_confidence_low = mean(sibling_count_uterus_preg, na.rm = T) -
(qt(.975, n()-1)*sd(sibling_count_uterus_preg, na.rm = T)/sqrt(n())),
number_siblings_confidence_high = mean(sibling_count_uterus_preg, na.rm = T) +
(qt(.975, n()-1)*sd(sibling_count_uterus_preg, na.rm = T)/sqrt(n())))
descriptives
group_outcome | individuals | mothers | sibship_size_mean | sibship_size_confidence_low | sibship_size_confidence_high | sibship_size_min | sibship_size_max | birthorder_mean | birthorder_size_confidence_low | birthorder_size_confidence_high | birthorder_size_min | birthorder_size_max | number_siblings_mean | number_siblings_confidence_low | number_siblings_confidence_high |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
control | 55765 | 16301 | 5.184 | 5.154 | 5.214 | 1 | 26 | 3.072 | 3.052 | 3.093 | 1 | 26 | 5.184 | 5.154 | 5.214 |
test | 45476 | 13187 | 4.279 | 4.253 | 4.305 | 1 | 26 | 2.663 | 2.644 | 2.683 | 1 | 25 | 4.279 | 4.253 | 4.305 |
birthorder %>%
t.test(sibling_count_uterus_preg ~ group_outcome, data = ., var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
27.27 | 48544 | 1.473e-162 * * * | two.sided | 5.184 | 4.279 |
birthorder %>%
t.test(birthorder_uterus_preg ~ group_outcome, data = ., var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
17.36 | 48544 | 2.76e-67 * * * | two.sided | 3.072 | 2.663 |
birthorder %>% filter(!is.na(birthorder_uterus_preg), group_outcome == 1) %>% group_by(mother_pidlink) %>% summarise(with_data = n(), all = mean(sibling_count_uterus_preg)) -> counts
birthorder %>% filter(!is.na(birthorder_uterus_preg), group_outcome == 0) %>% group_by(mother_pidlink) %>% summarise(with_data = n(), all = mean(sibling_count_uterus_preg)) -> counts1
In our test sample families with an average size of NaN siblings, we retain 0.
In the original sample families with an average size of NaN siblings, we retain 0.
ggplot(counts, aes(all, with_data)) + geom_jitter(alpha = 0.1) + geom_smooth() + scale_x_continuous(breaks=1:15) + scale_y_continuous(breaks=1:15)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Descriptives
descriptives = birthorder %>%
group_by(group_birthorder) %>%
summarise(n = n(),
age_mean = mean(age, na.rm=TRUE),
age_confidence_low = mean(age, na.rm = T) -
(qt(.975, n()-1)*sd(age, na.rm = T)/sqrt(n())),
age_confidence_high = mean(age, na.rm = T) +
(qt(.975, n()-1)*sd(age, na.rm = T)/sqrt(n())),
age_min = min(age, na.rm = TRUE),
age_max = max(age, na.rm = TRUE),
gender = mean(male, na.rm=TRUE))
descriptives
group_birthorder | n | age_mean | age_confidence_low | age_confidence_high | age_min | age_max | gender |
---|---|---|---|---|---|---|---|
control | 58559 | 39.06 | 38.8 | 39.33 | 0 | 999 | 0.4885 |
test | 42682 | 13.75 | 13.64 | 13.85 | 0 | 52 | 0.5104 |
## Ttest
tidy(t.test(birthorder$age ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
39.06 | 13.75 | 114.2 | 0 | 69280 | 24.89 | 25.75 | Two Sample t-test | two.sided |
cohen.d(birthorder$age, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: 0.9244 (large)
## 95 percent confidence interval:
## lower upper
## 0.9078 0.9410
gender = birthorder %>%
group_by(group_birthorder) %>%
summarise(gender = sum(male == 1, na.rm=T),
gender2 = sum(male ==0,na.rm=T)) %>%
select(gender, gender2)
prop.table(gender)
gender | gender2 |
---|---|
0.3284 | 0.3438 |
0.1673 | 0.1605 |
tidy(chisq.test(gender))
statistic | p.value | parameter | method |
---|---|---|---|
29.15 | 0.0000000671 | 1 | Pearson’s Chi-squared test with Yates’ continuity correction |
## Ratings
ratings = birthorder %>%
group_by(group_birthorder) %>%
summarise(g_factor_mean = mean(g_factor_2015_old, na.rm=T),
g_factor_confidence_low= mean(g_factor_2015_old, na.rm = T) -
(qt(.975, n()-1)*sd(g_factor_2015_old, na.rm = T)/sqrt(n())),
g_factor_confidence_high = mean(g_factor_2015_old, na.rm = T) +
(qt(.975, n()-1)*sd(g_factor_2015_old, na.rm = T)/sqrt(n())),
big5_ext_mean = mean(big5_ext, na.rm=T),
big5_ext_confidence_low= mean(big5_ext, na.rm = T) -
(qt(.975, n()-1)*sd(big5_ext, na.rm = T)/sqrt(n())),
big5_ext_confidence_high = mean(big5_ext, na.rm = T) +
(qt(.975, n()-1)*sd(big5_ext, na.rm = T)/sqrt(n())),
big5_neu_mean = mean(big5_neu, na.rm=T),
big5_neu_confidence_low= mean(big5_neu, na.rm = T) -
(qt(.975, n()-1)*sd(big5_neu, na.rm = T)/sqrt(n())),
big5_neu_confidence_high = mean(big5_neu, na.rm = T) +
(qt(.975, n()-1)*sd(big5_neu, na.rm = T)/sqrt(n())),
big5_con_mean = mean(big5_con, na.rm=T),
big5_con_confidence_low= mean(big5_con, na.rm = T) -
(qt(.975, n()-1)*sd(big5_con, na.rm = T)/sqrt(n())),
big5_con_confidence_high = mean(big5_con, na.rm = T) +
(qt(.975, n()-1)*sd(big5_con, na.rm = T)/sqrt(n())),
big5_agree_mean = mean(big5_agree, na.rm=T),
big5_agree_confidence_low= mean(big5_agree, na.rm = T) -
(qt(.975, n()-1)*sd(big5_agree, na.rm = T)/sqrt(n())),
big5_agree_confidence_high = mean(big5_agree, na.rm = T) +
(qt(.975, n()-1)*sd(big5_agree, na.rm = T)/sqrt(n())),
big5_open_mean = mean(big5_open, na.rm=T),
big5_open_confidence_low= mean(big5_open, na.rm = T) -
(qt(.975, n()-1)*sd(big5_open, na.rm = T)/sqrt(n())),
big5_open_confidence_high = mean(big5_open, na.rm = T) +
(qt(.975, n()-1)*sd(big5_open, na.rm = T)/sqrt(n())),
riskA_mean = mean(riskA, na.rm=T),
riskA_confidence_low= mean(riskA, na.rm = T) -
(qt(.975, n()-1)*sd(riskA, na.rm = T)/sqrt(n())),
riskA_confidence_high = mean(riskA, na.rm = T) +
(qt(.975, n()-1)*sd(riskA, na.rm = T)/sqrt(n())),
riskB_mean = mean(riskB, na.rm=T),
riskB_confidence_low= mean(riskB, na.rm = T) -
(qt(.975, n()-1)*sd(riskB, na.rm = T)/sqrt(n())),
riskB_confidence_high = mean(riskB, na.rm = T) +
(qt(.975, n()-1)*sd(riskB, na.rm = T)/sqrt(n())))
ratings
group_birthorder | g_factor_mean | g_factor_confidence_low | g_factor_confidence_high | big5_ext_mean | big5_ext_confidence_low | big5_ext_confidence_high | big5_neu_mean | big5_neu_confidence_low | big5_neu_confidence_high | big5_con_mean | big5_con_confidence_low | big5_con_confidence_high | big5_agree_mean | big5_agree_confidence_low | big5_agree_confidence_high | big5_open_mean | big5_open_confidence_low | big5_open_confidence_high | riskA_mean | riskA_confidence_low | riskA_confidence_high | riskB_mean | riskB_confidence_low | riskB_confidence_high |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
control | -0.1381 | -0.1448 | -0.1314 | 3.429 | 3.424 | 3.434 | 2.669 | 2.664 | 2.674 | 3.837 | 3.833 | 3.842 | 3.915 | 3.911 | 3.919 | 3.674 | 3.668 | 3.68 | 3.433 | 3.421 | 3.446 | 4.185 | 4.174 | 4.197 |
test | 0.4502 | 0.4438 | 0.4567 | 3.493 | 3.487 | 3.5 | 2.724 | 2.717 | 2.73 | 3.73 | 3.724 | 3.735 | 3.85 | 3.846 | 3.855 | 3.817 | 3.812 | 3.823 | 3.292 | 3.278 | 3.305 | 4.288 | 4.276 | 4.301 |
tidy(t.test(birthorder$g_factor_2015_old ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
-0.1381 | 0.4502 | -51.98 | 0 | 27524 | -0.6105 | -0.5661 | Two Sample t-test | two.sided |
cohen.d(birthorder$g_factor_2015_old, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: -0.7392 (medium)
## 95 percent confidence interval:
## lower upper
## -0.7678 -0.7107
tidy(t.test(birthorder$years_of_education ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
8.283 | 11.4 | -49.98 | 0 | 33816 | -3.236 | -2.992 | Two Sample t-test | two.sided |
cohen.d(birthorder$years_of_education, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: -0.6763 (medium)
## 95 percent confidence interval:
## lower upper
## -0.7033 -0.6493
tidy(t.test(birthorder$big5_ext ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
3.429 | 3.493 | -6.982 | 2.971e-12 | 31444 | -0.08258 | -0.04638 | Two Sample t-test | two.sided |
cohen.d(birthorder$big5_ext, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: -0.09677 (negligible)
## 95 percent confidence interval:
## lower upper
## -0.12395 -0.06959
tidy(t.test(birthorder$big5_neu ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
2.669 | 2.724 | -5.923 | 0.000000003185 | 31444 | -0.07268 | -0.03654 | Two Sample t-test | two.sided |
cohen.d(birthorder$big5_neu, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: -0.0821 (negligible)
## 95 percent confidence interval:
## lower upper
## -0.10927 -0.05493
tidy(t.test(birthorder$big5_con ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
3.837 | 3.73 | 14.06 | 9.458e-45 | 31444 | 0.09249 | 0.1225 | Two Sample t-test | two.sided |
cohen.d(birthorder$big5_con, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: 0.1948 (negligible)
## 95 percent confidence interval:
## lower upper
## 0.1676 0.2221
tidy(t.test(birthorder$big5_agree ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
3.915 | 3.85 | 9.136 | 6.863e-20 | 31444 | 0.0508 | 0.07854 | Two Sample t-test | two.sided |
cohen.d(birthorder$big5_agree, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: 0.1266 (negligible)
## 95 percent confidence interval:
## lower upper
## 0.09944 0.15381
tidy(t.test(birthorder$big5_open ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
3.674 | 3.817 | -15.52 | 3.76e-54 | 31444 | -0.1615 | -0.1253 | Two Sample t-test | two.sided |
cohen.d(birthorder$big5_open, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: -0.2152 (small)
## 95 percent confidence interval:
## lower upper
## -0.2424 -0.1880
tidy(t.test(birthorder$riskA ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
3.433 | 3.292 | 6.415 | 0.0000000001434 | 27778 | 0.0985 | 0.1852 | Two Sample t-test | two.sided |
cohen.d(birthorder$riskA, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: 0.094 (negligible)
## 95 percent confidence interval:
## lower upper
## 0.06526 0.12273
tidy(t.test(birthorder$riskB ~ birthorder$group_birthorder, var.equal = T))
estimate1 | estimate2 | statistic | p.value | parameter | conf.low | conf.high | method | alternative |
---|---|---|---|---|---|---|---|---|
4.185 | 4.288 | -5.116 | 0.0000003147 | 29576 | -0.1426 | -0.06362 | Two Sample t-test | two.sided |
cohen.d(birthorder$riskB, as.factor(birthorder$group_birthorder), na.rm = T)
##
## Cohen's d
##
## d estimate: -0.0729 (negligible)
## 95 percent confidence interval:
## lower upper
## -0.10084 -0.04496
## Educational Attainment
educational_attainment = birthorder %>%
group_by(group_birthorder) %>%
summarise(years_of_education_mean = mean(years_of_education, na.rm=T),
years_of_education_confidence_low= mean(years_of_education, na.rm = T) -
(qt(.975, n()-1)*sd(years_of_education, na.rm = T)/sqrt(n())),
years_of_education_high = mean(years_of_education, na.rm = T) +
(qt(.975, n()-1)*sd(years_of_education, na.rm = T)/sqrt(n())))
educational_attainment
group_birthorder | years_of_education_mean | years_of_education_confidence_low | years_of_education_high |
---|---|---|---|
control | 8.283 | 8.244 | 8.322 |
test | 11.4 | 11.36 | 11.43 |
t.test(birthorder$years_of_education ~ birthorder$group_birthorder, var.equal = T)
Test statistic | df | P value | Alternative hypothesis | mean in group control | mean in group test |
---|---|---|---|---|---|
-49.98 | 33816 | 0 * * * | two.sided | 8.283 | 11.4 |
ggplot(data=birthorder, aes(x=years_of_education, fill=group_birthorder)) +
geom_histogram(stat="count", binwidth=.5, position="dodge")
x = birthorder %>% filter(group_birthorder == "test", group_outcome == "test")
mean_sd = birthorder %>%
group_by(group_birthorder) %>%
summarise(age_mean = mean(age, na.rm=T),
age_sd = sd(age, na.rm=T),
g_factor_mean = mean(g_factor_2015_old, na.rm=T),
g_factor_sd = sd(g_factor_2015_old, na.rm=T),
big5_ext_mean = mean(big5_ext, na.rm=T),
big5_ext_sd = sd(big5_ext, na.rm=T),
big5_neu_mean = mean(big5_neu, na.rm=T),
big5_neu_sd = sd(big5_neu, na.rm=T),
big5_con_mean = mean(big5_con, na.rm=T),
big5_con_sd = sd(big5_con, na.rm=T),
big5_agree_mean = mean(big5_agree, na.rm=T),
big5_agree_sd = sd(big5_agree, na.rm=T),
big5_open_mean = mean(big5_open, na.rm=T),
big5_open_sd = sd(big5_open, na.rm=T),
riskA_mean = mean(riskA, na.rm=T),
riskA_sd = sd(riskA, na.rm=T),
riskB_mean = mean(riskB, na.rm=T),
riskB_sd = sd(riskB, na.rm=T),
years_of_education_mean = mean(years_of_education, na.rm=T),
years_of_education_sd = sd(years_of_education, na.rm=T))
mean_sd
group_birthorder | age_mean | age_sd | g_factor_mean | g_factor_sd | big5_ext_mean | big5_ext_sd | big5_neu_mean | big5_neu_sd | big5_con_mean | big5_con_sd | big5_agree_mean | big5_agree_sd | big5_open_mean | big5_open_sd | riskA_mean | riskA_sd | riskB_mean | riskB_sd | years_of_education_mean | years_of_education_sd |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
control | 39.06 | 32.54 | -0.1381 | 0.8272 | 3.429 | 0.6616 | 2.669 | 0.6655 | 3.837 | 0.5447 | 3.915 | 0.5111 | 3.674 | 0.6824 | 3.433 | 1.528 | 4.185 | 1.441 | 8.283 | 4.847 |
test | 13.75 | 10.83 | 0.4502 | 0.6835 | 3.493 | 0.6839 | 2.724 | 0.6638 | 3.73 | 0.5768 | 3.85 | 0.5094 | 3.817 | 0.6013 | 3.292 | 1.437 | 4.288 | 1.313 | 11.4 | 3.488 |
cor = round(cor(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup() %>% select(age, male, g_factor_2015_old, years_of_education, big5_ext, big5_neu, big5_con, big5_agree, big5_open, riskA, riskB), use = "pairwise.complete.obs"), 2)
cor
age | male | g_factor_2015_old | years_of_education | big5_ext | big5_neu | big5_con | big5_agree | big5_open | riskA | riskB |
---|---|---|---|---|---|---|---|---|---|---|
1 | -0.03 | -0.1 | 0.24 | 0 | -0.13 | 0.24 | 0.1 | 0 | -0.06 | -0.01 |
-0.03 | 1 | -0.01 | -0.05 | -0.13 | -0.13 | 0.02 | 0.03 | 0.08 | -0.13 | -0.12 |
-0.1 | -0.01 | 1 | 0.35 | 0.06 | -0.05 | -0.03 | -0.04 | 0.08 | -0.15 | 0.05 |
0.24 | -0.05 | 0.35 | 1 | 0.07 | -0.08 | 0.1 | 0.03 | 0.15 | -0.19 | -0.02 |
0 | -0.13 | 0.06 | 0.07 | 1 | -0.09 | 0.07 | 0.07 | 0.17 | -0.01 | 0 |
-0.13 | -0.13 | -0.05 | -0.08 | -0.09 | 1 | -0.2 | -0.17 | -0.07 | 0.04 | 0.02 |
0.24 | 0.02 | -0.03 | 0.1 | 0.07 | -0.2 | 1 | 0.32 | 0.27 | -0.04 | 0.02 |
0.1 | 0.03 | -0.04 | 0.03 | 0.07 | -0.17 | 0.32 | 1 | 0.23 | -0.02 | -0.01 |
0 | 0.08 | 0.08 | 0.15 | 0.17 | -0.07 | 0.27 | 0.23 | 1 | -0.08 | -0.03 |
-0.06 | -0.13 | -0.15 | -0.19 | -0.01 | 0.04 | -0.04 | -0.02 | -0.08 | 1 | 0.3 |
-0.01 | -0.12 | 0.05 | -0.02 | 0 | 0.02 | 0.02 | -0.01 | -0.03 | 0.3 | 1 |
alpha(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup() %>% select(raven_2015_old, math_2015_old, count_backwards, words_delayed, adaptive_numbering))
##
## Reliability analysis
## Call: alpha(x = birthorder %>% filter(group_birthorder == "test", group_outcome ==
## "test") %>% ungroup() %>% select(raven_2015_old, math_2015_old,
## count_backwards, words_delayed, adaptive_numbering))
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.025 0.61 0.56 0.24 1.6 0.00066 109 16 0.22
##
## lower alpha upper 95% confidence boundaries
## 0.02 0.03 0.03
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## raven_2015_old 0.024 0.54 0.47 0.23 1.2 0.00069 0.0026 0.22
## math_2015_old 0.022 0.53 0.46 0.22 1.1 0.00068 0.0029 0.19
## count_backwards 0.023 0.57 0.51 0.25 1.4 0.00069 0.0042 0.25
## words_delayed 0.011 0.60 0.53 0.27 1.5 0.00020 0.0027 0.29
## adaptive_numbering 0.214 0.53 0.46 0.22 1.1 0.00484 0.0040 0.20
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## raven_2015_old 6598 0.27 0.64 0.50 0.30 0.75 0.21
## math_2015_old 6598 0.26 0.66 0.54 0.30 0.44 0.30
## count_backwards 6492 0.26 0.60 0.42 0.28 0.80 0.26
## words_delayed 6593 0.20 0.56 0.35 0.20 5.04 1.68
## adaptive_numbering 6581 0.88 0.66 0.53 0.29 539.96 54.83
##Extraversion
alpha(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup() %>%
select(e1, e2r_reversed, e3))
##
## Reliability analysis
## Call: alpha(x = birthorder %>% filter(group_birthorder == "test", group_outcome ==
## "test") %>% ungroup() %>% select(e1, e2r_reversed, e3))
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.45 0.43 0.35 0.2 0.77 0.0072 3.5 0.68 0.17
##
## lower alpha upper 95% confidence boundaries
## 0.43 0.45 0.46
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## e1 0.17 0.19 0.11 0.11 0.24 0.0121 NA 0.11
## e2r_reversed 0.26 0.29 0.17 0.17 0.42 0.0106 NA 0.17
## e3 0.50 0.50 0.33 0.33 1.00 0.0083 NA 0.33
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## e1 6584 0.79 0.73 0.52 0.36 3.2 1.13
## e2r_reversed 6584 0.76 0.70 0.45 0.32 3.0 1.11
## e3 6584 0.48 0.62 0.25 0.17 4.2 0.67
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## e1 0.02 0.35 0.11 0.40 0.12 0.55
## e2r_reversed 0.07 0.34 0.11 0.43 0.05 0.55
## e3 0.00 0.02 0.06 0.61 0.30 0.55
## Neuroticism
alpha(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup()
%>% select(n1r_reversed, n2, n3))
##
## Reliability analysis
## Call: alpha(x = birthorder %>% filter(group_birthorder == "test", group_outcome ==
## "test") %>% ungroup() %>% select(n1r_reversed, n2, n3))
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.37 0.33 0.29 0.14 0.5 0.0084 2.7 0.66 0.056
##
## lower alpha upper 95% confidence boundaries
## 0.35 0.37 0.38
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## n1r_reversed 0.510 0.510 0.342 0.342 1.041 0.0081 NA 0.342
## n2 0.099 0.105 0.056 0.056 0.118 0.0140 NA 0.056
## n3 0.059 0.062 0.032 0.032 0.067 0.0145 NA 0.032
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## n1r_reversed 6584 0.43 0.55 0.087 0.053 2.1 0.77
## n2 6584 0.75 0.70 0.469 0.291 3.1 1.11
## n3 6584 0.76 0.71 0.493 0.308 3.0 1.09
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## n1r_reversed 0.17 0.67 0.08 0.07 0.01 0.55
## n2 0.02 0.39 0.10 0.40 0.09 0.55
## n3 0.03 0.46 0.09 0.36 0.06 0.55
##conscientiousness
alpha(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup() %>% select(c1, c2r_reversed, c3))
##
## Reliability analysis
## Call: alpha(x = birthorder %>% filter(group_birthorder == "test", group_outcome ==
## "test") %>% ungroup() %>% select(c1, c2r_reversed, c3))
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.37 0.39 0.31 0.18 0.65 0.009 3.7 0.58 0.19
##
## lower alpha upper 95% confidence boundaries
## 0.36 0.37 0.39
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## c1 0.17 0.17 0.094 0.094 0.21 0.0135 NA 0.094
## c2r_reversed 0.39 0.40 0.249 0.249 0.66 0.0098 NA 0.249
## c3 0.31 0.32 0.189 0.189 0.47 0.0109 NA 0.189
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## c1 6584 0.65 0.71 0.47 0.29 4.1 0.73
## c2r_reversed 6584 0.70 0.64 0.29 0.17 3.4 0.99
## c3 6584 0.65 0.67 0.36 0.21 3.8 0.86
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## c1 0.00 0.04 0.07 0.63 0.25 0.55
## c2r_reversed 0.03 0.25 0.11 0.56 0.05 0.55
## c3 0.01 0.11 0.12 0.63 0.13 0.55
##Agreeableness
alpha(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup() %>% select(a1, a2, a3r_reversed))
##
## Reliability analysis
## Call: alpha(x = birthorder %>% filter(group_birthorder == "test", group_outcome ==
## "test") %>% ungroup() %>% select(a1, a2, a3r_reversed))
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.28 0.36 0.33 0.16 0.57 0.01 3.9 0.51 0.047
##
## lower alpha upper 95% confidence boundaries
## 0.26 0.28 0.3
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## a1 0.048 0.054 0.028 0.028 0.057 0.014 NA 0.028
## a2 0.081 0.089 0.047 0.047 0.098 0.014 NA 0.047
## a3r_reversed 0.577 0.577 0.406 0.406 1.367 0.007 NA 0.406
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## a1 6584 0.63 0.73 0.544 0.250 4.2 0.66
## a2 6584 0.61 0.72 0.526 0.236 4.1 0.64
## a3r_reversed 6584 0.71 0.54 0.067 0.044 3.2 1.03
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## a1 0.00 0.02 0.06 0.62 0.30 0.55
## a2 0.00 0.02 0.08 0.66 0.24 0.55
## a3r_reversed 0.03 0.29 0.12 0.51 0.05 0.55
##Openness
alpha(birthorder %>% filter(group_birthorder == "test", group_outcome == "test") %>% ungroup() %>% select(o1, o2, o3))
##
## Reliability analysis
## Call: alpha(x = birthorder %>% filter(group_birthorder == "test", group_outcome ==
## "test") %>% ungroup() %>% select(o1, o2, o3))
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.46 0.46 0.37 0.22 0.86 0.0077 3.8 0.6 0.22
##
## lower alpha upper 95% confidence boundaries
## 0.44 0.46 0.47
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## o1 0.32 0.33 0.20 0.20 0.49 0.0109 NA 0.20
## o2 0.40 0.40 0.25 0.25 0.67 0.0098 NA 0.25
## o3 0.36 0.36 0.22 0.22 0.57 0.0104 NA 0.22
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## o1 6584 0.71 0.71 0.45 0.30 3.8 0.87
## o2 6584 0.72 0.68 0.39 0.27 3.6 0.96
## o3 6584 0.65 0.69 0.42 0.28 4.1 0.76
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## o1 0.01 0.12 0.11 0.62 0.14 0.55
## o2 0.02 0.17 0.13 0.56 0.13 0.55
## o3 0.01 0.05 0.07 0.61 0.27 0.55
birthorder = birthorder %>% filter(age<=100)
birthorder = birthorder %>%
mutate(outcome = age)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = birthorder_genes)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = sibling_count_genes)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = g_factor_2015_old)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = g_factor_2015_young)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = g_factor_2007_old)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = g_factor_2007_young)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = big5_ext)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = big5_con)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = big5_open)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = big5_neu)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = big5_agree)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = riskA)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = riskB)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = years_of_education)
plot_gender(birthorder)
plot_gender(birthorder %>% filter(!is.na(attended_school)) %>% mutate(outcome = as.numeric(attended_school)))
birthorder = birthorder %>%
mutate(outcome = Elementary_missed)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = Elementary_worked)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = wage_last_month_log)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = wage_last_year_log)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = Self_employed)
plot_gender(birthorder)
birthorder = birthorder %>%
mutate(outcome = ever_smoked)
plot_gender(birthorder)
plot_age(birthorder %>% filter(age<= 100) %>% mutate(outcome = birthorder_genes))
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = sibling_count_genes)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = g_factor_2015_old)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = g_factor_2015_young)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = g_factor_2007_old)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = g_factor_2007_young)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = big5_ext)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = big5_con)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = big5_open)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = big5_neu)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = big5_agree)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = riskA)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = riskB)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = years_of_education)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
plot_age(birthorder %>% filter(!is.na(attended_school)) %>% mutate(outcome = as.numeric(attended_school)))
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = Elementary_missed)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = Elementary_worked)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = wage_last_month_log)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = wage_last_year_log)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = Self_employed)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
birthorder = birthorder %>%
mutate(outcome = ever_smoked)
plot_age(birthorder)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'