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
## Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
## TMB was built with Matrix version 1.2.18
## Current Matrix version is 1.2.15
## Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package
##
## Attaching package: 'broom.mixed'
## The following object is masked from 'package:broom':
##
## tidyMCMC
## 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
## Loading required package: usethis
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
## This is lavaan 0.6-5
## 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 objects are masked from 'package:Matrix':
##
## expand, pack, unpack
##
## 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, rescue_attributes,
## reverse_labelled_values
##
## Attaching package: 'effsize'
## The following object is masked from 'package:psych':
##
## cohen.d
birthorder = readRDS("data/alldata_birthorder.rds")
# For analyses we want to clean the dataset and get rid of all uninteresting data
birthorder = birthorder %>%
filter(!is.na(pidlink)) %>% # no individuals who are only known from the pregnancy file
filter(is.na(lifebirths) | lifebirths == 2) %>% # remove 7 and 2 individuals who are known as stillbirth or miscarriage but still have PID
select(-lifebirths) %>%
filter(!is.na(mother_pidlink)) %>%
select(-father_pidlink) %>%
filter(is.na(any_multiple_birth) | any_multiple_birth != 1) %>% # remove families with twins/triplets/..
filter(!is.na(birthorder_naive)) %>%
select(-starts_with("age_"), -wave, -any_multiple_birth, -multiple_birth) %>%
mutate(money_spent_smoking_log = if_else(is.na(money_spent_smoking_log) & ever_smoked == 0, 0, money_spent_smoking_log),
amount = if_else(is.na(amount) & ever_smoked == 0, 0, amount),
amount_still_smokers = if_else(is.na(amount_still_smokers) & still_smoking == 0, 0, amount_still_smokers),
birthyear = lubridate::year(birthdate))
# recode Factor Variable as Dummy Variable
birthorder = left_join(birthorder,
birthorder %>%
filter(!is.na(Category)) %>%
mutate(var = 1) %>%
select(pidlink, Category, var) %>%
spread(Category, var, fill = 0, sep = "_"), by = "pidlink") %>%
select(-Category)
# recode Factor Variable as Dummy Variable
birthorder = left_join(birthorder,
birthorder %>%
filter(!is.na(Sector)) %>%
mutate(var = 1) %>%
select(pidlink, Sector, var) %>%
spread(Sector, var, fill = 0, sep = "_"), by = "pidlink") %>%
select(-Sector)
### Variables
birthorder = birthorder %>%
mutate(
# center variables that are used for analysis
g_factor_2015_old = scale(g_factor_2015_old),
g_factor_2015_young = scale(g_factor_2015_young),
g_factor_2007_old = scale(g_factor_2007_old),
g_factor_2007_young = scale(g_factor_2007_young),
raven_2015_old = scale(raven_2015_old),
math_2015_old = scale(math_2015_old),
count_backwards = scale(count_backwards),
raven_2015_young = scale(raven_2015_young),
math_2015_young = scale(math_2015_young),
words_remembered_avg = scale(words_remembered_avg),
words_immediate = scale(words_immediate),
words_delayed = scale(words_delayed),
adaptive_numbering = scale(adaptive_numbering),
raven_2007_old = scale(raven_2007_old),
math_2007_old = scale(math_2007_old),
raven_2007_young = scale(raven_2007_young),
math_2007_young = scale(math_2007_young),
riskA = scale(riskA),
riskB = scale(riskB),
years_of_education_z = scale(years_of_education),
Total_score_highest_z = scale(Total_score_highest),
wage_last_month_z = scale(wage_last_month_log),
wage_last_year_z = scale(wage_last_year_log),
big5_ext = scale(big5_ext),
big5_con = scale(big5_con),
big5_agree = scale(big5_agree),
big5_open = scale(big5_open),
big5_neu = scale(big5_neu),
attended_school = as.integer(attended_school),
attended_school = ifelse(attended_school == 1, 0,
ifelse(attended_school == 2, 1, NA)))
### Birthorder and Sibling Count
birthorder = birthorder %>%
mutate(
# birthorder as factors with levels of 1, 2, 3, 4, 5, >5
birthorder_naive_factor = as.character(birthorder_naive),
birthorder_naive_factor = ifelse(birthorder_naive > 5, ">5",
birthorder_naive_factor),
birthorder_naive_factor = factor(birthorder_naive_factor,
levels = c("1","2","3","4","5",">5")),
sibling_count_naive_factor = as.character(sibling_count_naive),
sibling_count_naive_factor = ifelse(sibling_count_naive > 5, ">5",
sibling_count_naive_factor),
sibling_count_naive_factor = factor(sibling_count_naive_factor,
levels = c("2","3","4","5",">5")),
birthorder_uterus_alive_factor = as.character(birthorder_uterus_alive),
birthorder_uterus_alive_factor = ifelse(birthorder_uterus_alive > 5, ">5",
birthorder_uterus_alive_factor),
birthorder_uterus_alive_factor = factor(birthorder_uterus_alive_factor,
levels = c("1","2","3","4","5",">5")),
sibling_count_uterus_alive_factor = as.character(sibling_count_uterus_alive),
sibling_count_uterus_alive_factor = ifelse(sibling_count_uterus_alive > 5, ">5",
sibling_count_uterus_alive_factor),
sibling_count_uterus_alive_factor = factor(sibling_count_uterus_alive_factor,
levels = c("2","3","4","5",">5")),
birthorder_uterus_preg_factor = as.character(birthorder_uterus_preg),
birthorder_uterus_preg_factor = ifelse(birthorder_uterus_preg > 5, ">5",
birthorder_uterus_preg_factor),
birthorder_uterus_preg_factor = factor(birthorder_uterus_preg_factor,
levels = c("1","2","3","4","5",">5")),
sibling_count_uterus_preg_factor = as.character(sibling_count_uterus_preg),
sibling_count_uterus_preg_factor = ifelse(sibling_count_uterus_preg > 5, ">5",
sibling_count_uterus_preg_factor),
sibling_count_uterus_preg_factor = factor(sibling_count_uterus_preg_factor,
levels = c("2","3","4","5",">5")),
birthorder_genes_factor = as.character(birthorder_genes),
birthorder_genes_factor = ifelse(birthorder_genes >5 , ">5", birthorder_genes_factor),
birthorder_genes_factor = factor(birthorder_genes_factor,
levels = c("1","2","3","4","5",">5")),
sibling_count_genes_factor = as.character(sibling_count_genes),
sibling_count_genes_factor = ifelse(sibling_count_genes >5 , ">5",
sibling_count_genes_factor),
sibling_count_genes_factor = factor(sibling_count_genes_factor,
levels = c("2","3","4","5",">5")),
# interaction birthorder * siblingcout for each birthorder
count_birthorder_naive =
factor(str_replace(as.character(interaction(birthorder_naive_factor, sibling_count_naive_factor)),
"\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/>5", "2/>5", "3/>5", "4/>5",
"5/>5", ">5/>5")),
count_birthorder_uterus_alive =
factor(str_replace(as.character(interaction(birthorder_uterus_alive_factor, sibling_count_uterus_alive_factor)),
"\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/>5", "2/>5", "3/>5", "4/>5",
"5/>5", ">5/>5")),
count_birthorder_uterus_preg =
factor(str_replace(as.character(interaction(birthorder_uterus_preg_factor, sibling_count_uterus_preg_factor)),
"\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/>5", "2/>5", "3/>5", "4/>5",
"5/>5", ">5/>5")),
count_birthorder_genes =
factor(str_replace(as.character(interaction(birthorder_genes_factor, sibling_count_genes_factor)), "\\.", "/"),
levels = c("1/2","2/2", "1/3", "2/3",
"3/3", "1/4", "2/4", "3/4", "4/4",
"1/5", "2/5", "3/5", "4/5", "5/5",
"1/>5", "2/>5", "3/>5", "4/>5",
"5/>5", ">5/>5")))
birthorder <- birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive)
birthorder <- birthorder %>% mutate(outcome = g_factor_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count +
(1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1911 | 0.2 | 0.9555 | 12937 | 0.3394 | -0.3702 | 0.7523 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0243 | 0.02056 | 1.182 | 12872 | 0.2371 | -0.0334 | 0.082 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001017 | 0.0006584 | -1.544 | 12882 | 0.1226 | -0.002865 | 0.0008315 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003728 | 0.000006632 | 0.5621 | 12904 | 0.5741 | -0.00001489 | 0.00002234 |
fixed | NA | male | 0.06205 | 0.01493 | 4.156 | 11916 | 0.00003257 | 0.02014 | 0.104 |
fixed | NA | sibling_count3 | 0.03391 | 0.03437 | 0.9865 | 8796 | 0.3239 | -0.06257 | 0.1304 |
fixed | NA | sibling_count4 | -0.0006889 | 0.03585 | -0.01922 | 8292 | 0.9847 | -0.1013 | 0.09993 |
fixed | NA | sibling_count5 | -0.001687 | 0.03755 | -0.04492 | 7786 | 0.9642 | -0.1071 | 0.1037 |
fixed | NA | sibling_count>5 | -0.1915 | 0.02919 | -6.56 | 8383 | 0.00000000005705 | -0.2734 | -0.1096 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5824 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7438 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1824 | 0.2002 | 0.9114 | 12932 | 0.3621 | -0.3795 | 0.7444 |
fixed | NA | birth_order | -0.003077 | 0.00332 | -0.9269 | 13491 | 0.354 | -0.01239 | 0.006241 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02632 | 0.02067 | 1.273 | 12936 | 0.203 | -0.03171 | 0.08435 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001092 | 0.0006635 | -1.646 | 13003 | 0.09983 | -0.002955 | 0.0007705 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000448 | 0.000006683 | 0.6704 | 13031 | 0.5026 | -0.00001428 | 0.00002324 |
fixed | NA | male | 0.06218 | 0.01493 | 4.164 | 11914 | 0.00003142 | 0.02027 | 0.1041 |
fixed | NA | sibling_count3 | 0.03436 | 0.03437 | 0.9997 | 8799 | 0.3175 | -0.06211 | 0.1308 |
fixed | NA | sibling_count4 | 0.001231 | 0.0359 | 0.0343 | 8343 | 0.9726 | -0.09954 | 0.102 |
fixed | NA | sibling_count5 | 0.001859 | 0.03773 | 0.04927 | 7893 | 0.9607 | -0.1041 | 0.1078 |
fixed | NA | sibling_count>5 | -0.18 | 0.0317 | -5.679 | 9540 | 0.00000001392 | -0.269 | -0.09105 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.744 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1974 | 0.2017 | 0.9789 | 13030 | 0.3276 | -0.3687 | 0.7636 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02456 | 0.02074 | 1.184 | 12998 | 0.2363 | -0.03365 | 0.08276 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001027 | 0.0006661 | -1.542 | 13061 | 0.1232 | -0.002896 | 0.0008429 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003763 | 0.000006717 | 0.5601 | 13102 | 0.5754 | -0.00001509 | 0.00002262 |
fixed | NA | male | 0.06205 | 0.01493 | 4.155 | 11911 | 0.00003274 | 0.02013 | 0.104 |
fixed | NA | sibling_count3 | 0.03503 | 0.0347 | 1.01 | 9051 | 0.3128 | -0.06237 | 0.1324 |
fixed | NA | sibling_count4 | 0.005935 | 0.03659 | 0.1622 | 8837 | 0.8711 | -0.09677 | 0.1086 |
fixed | NA | sibling_count5 | 0.001283 | 0.03871 | 0.03314 | 8517 | 0.9736 | -0.1074 | 0.1099 |
fixed | NA | sibling_count>5 | -0.1803 | 0.03284 | -5.489 | 10296 | 0.00000004129 | -0.2724 | -0.08808 |
fixed | NA | birth_order_nonlinear2 | -0.01433 | 0.02147 | -0.6675 | 11566 | 0.5045 | -0.07459 | 0.04593 |
fixed | NA | birth_order_nonlinear3 | -0.0118 | 0.02501 | -0.4716 | 10932 | 0.6372 | -0.08201 | 0.05842 |
fixed | NA | birth_order_nonlinear4 | -0.03464 | 0.0284 | -1.22 | 10886 | 0.2226 | -0.1144 | 0.04507 |
fixed | NA | birth_order_nonlinear5 | 0.01513 | 0.03228 | 0.4688 | 10781 | 0.6392 | -0.07549 | 0.1058 |
fixed | NA | birth_order_nonlinear>5 | -0.02847 | 0.02793 | -1.019 | 12922 | 0.308 | -0.1069 | 0.04992 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5822 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.744 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1955 | 0.203 | 0.9634 | 13102 | 0.3354 | -0.3742 | 0.7652 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02567 | 0.02079 | 1.235 | 13049 | 0.2169 | -0.03268 | 0.08403 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00106 | 0.0006683 | -1.586 | 13115 | 0.1128 | -0.002936 | 0.000816 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004077 | 0.000006744 | 0.6046 | 13160 | 0.5454 | -0.00001485 | 0.00002301 |
fixed | NA | male | 0.06191 | 0.01493 | 4.145 | 11899 | 0.00003418 | 0.01999 | 0.1038 |
fixed | NA | count_birth_order2/2 | -0.04118 | 0.04236 | -0.9722 | 12345 | 0.331 | -0.1601 | 0.07772 |
fixed | NA | count_birth_order1/3 | 0.02571 | 0.04281 | 0.6006 | 12456 | 0.5481 | -0.09446 | 0.1459 |
fixed | NA | count_birth_order2/3 | 0.01942 | 0.04732 | 0.4103 | 12963 | 0.6816 | -0.1134 | 0.1523 |
fixed | NA | count_birth_order3/3 | 0.0007667 | 0.05251 | 0.0146 | 13323 | 0.9883 | -0.1466 | 0.1482 |
fixed | NA | count_birth_order1/4 | -0.01819 | 0.04862 | -0.374 | 12948 | 0.7084 | -0.1547 | 0.1183 |
fixed | NA | count_birth_order2/4 | 0.01964 | 0.05083 | 0.3863 | 13147 | 0.6993 | -0.1231 | 0.1623 |
fixed | NA | count_birth_order3/4 | -0.02461 | 0.05444 | -0.4519 | 13381 | 0.6513 | -0.1774 | 0.1282 |
fixed | NA | count_birth_order4/4 | -0.059 | 0.05719 | -1.032 | 13447 | 0.3022 | -0.2195 | 0.1015 |
fixed | NA | count_birth_order1/5 | -0.09978 | 0.05416 | -1.842 | 13259 | 0.06544 | -0.2518 | 0.05225 |
fixed | NA | count_birth_order2/5 | -0.00005492 | 0.05667 | -0.0009691 | 13379 | 0.9992 | -0.1591 | 0.159 |
fixed | NA | count_birth_order3/5 | 0.003105 | 0.05811 | 0.05344 | 13443 | 0.9574 | -0.16 | 0.1662 |
fixed | NA | count_birth_order4/5 | -0.01033 | 0.06116 | -0.1689 | 13479 | 0.8659 | -0.182 | 0.1614 |
fixed | NA | count_birth_order5/5 | 0.0591 | 0.06229 | 0.9489 | 13479 | 0.3427 | -0.1157 | 0.2339 |
fixed | NA | count_birth_order1/>5 | -0.1474 | 0.04374 | -3.371 | 13431 | 0.000752 | -0.2702 | -0.02466 |
fixed | NA | count_birth_order2/>5 | -0.2332 | 0.04485 | -5.198 | 13471 | 0.0000002042 | -0.3591 | -0.1073 |
fixed | NA | count_birth_order3/>5 | -0.1994 | 0.04399 | -4.531 | 13469 | 0.000005911 | -0.3228 | -0.07586 |
fixed | NA | count_birth_order4/>5 | -0.2272 | 0.04306 | -5.276 | 13449 | 0.0000001338 | -0.3481 | -0.1063 |
fixed | NA | count_birth_order5/>5 | -0.1914 | 0.04332 | -4.419 | 13465 | 0.000009987 | -0.313 | -0.06984 |
fixed | NA | count_birth_order>5/>5 | -0.2187 | 0.03572 | -6.122 | 11512 | 0.0000000009539 | -0.319 | -0.1184 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5821 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7439 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 35518 | 35600 | -17748 | 35496 | NA | NA | NA |
12 | 35519 | 35609 | -17747 | 35495 | 0.8602 | 1 | 0.3537 |
16 | 35524 | 35644 | -17746 | 35492 | 2.576 | 4 | 0.631 |
26 | 35532 | 35728 | -17740 | 35480 | 11.82 | 10 | 0.2971 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8339 | 0.3708 | -2.249 | 5418 | 0.02455 | -1.875 | 0.2069 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1467 | 0.04203 | 3.489 | 5384 | 0.0004886 | 0.02867 | 0.2646 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004903 | 0.001499 | -3.271 | 5361 | 0.001079 | -0.00911 | -0.0006951 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004724 | 0.00001697 | 2.784 | 5351 | 0.005384 | -0.0000003866 | 0.00009487 |
fixed | NA | male | -0.02065 | 0.02158 | -0.9572 | 5211 | 0.3385 | -0.08122 | 0.03991 |
fixed | NA | sibling_count3 | 0.0003067 | 0.03701 | 0.008289 | 4039 | 0.9934 | -0.1036 | 0.1042 |
fixed | NA | sibling_count4 | -0.0771 | 0.04036 | -1.91 | 3743 | 0.05616 | -0.1904 | 0.03619 |
fixed | NA | sibling_count5 | -0.1511 | 0.04636 | -3.26 | 3538 | 0.001126 | -0.2812 | -0.02098 |
fixed | NA | sibling_count>5 | -0.2821 | 0.04094 | -6.891 | 3492 | 6.533e-12 | -0.3971 | -0.1672 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5177 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6977 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8412 | 0.3708 | -2.269 | 5416 | 0.02332 | -1.882 | 0.1996 |
fixed | NA | birth_order | 0.009041 | 0.007302 | 1.238 | 5681 | 0.2157 | -0.01146 | 0.02954 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.146 | 0.04203 | 3.473 | 5385 | 0.0005188 | 0.02799 | 0.264 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004888 | 0.001499 | -3.261 | 5362 | 0.001117 | -0.009095 | -0.0006806 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004746 | 0.00001697 | 2.797 | 5347 | 0.005177 | -0.000000171 | 0.00009508 |
fixed | NA | male | -0.02114 | 0.02158 | -0.9795 | 5210 | 0.3274 | -0.0817 | 0.03943 |
fixed | NA | sibling_count3 | -0.004319 | 0.0372 | -0.1161 | 4053 | 0.9076 | -0.1087 | 0.1001 |
fixed | NA | sibling_count4 | -0.08824 | 0.04135 | -2.134 | 3778 | 0.03293 | -0.2043 | 0.02784 |
fixed | NA | sibling_count5 | -0.169 | 0.04857 | -3.48 | 3665 | 0.0005071 | -0.3054 | -0.03269 |
fixed | NA | sibling_count>5 | -0.3178 | 0.05005 | -6.349 | 4053 | 0.0000000002406 | -0.4583 | -0.1773 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.518 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6974 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8705 | 0.3718 | -2.341 | 5449 | 0.01925 | -1.914 | 0.1731 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1492 | 0.04209 | 3.546 | 5405 | 0.0003944 | 0.0311 | 0.2674 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005006 | 0.001501 | -3.336 | 5376 | 0.000857 | -0.009218 | -0.0007932 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004879 | 0.00001699 | 2.872 | 5356 | 0.004092 | 0.000001108 | 0.00009648 |
fixed | NA | male | -0.02051 | 0.02158 | -0.9504 | 5204 | 0.342 | -0.08109 | 0.04007 |
fixed | NA | sibling_count3 | -0.006197 | 0.0378 | -0.164 | 4209 | 0.8698 | -0.1123 | 0.0999 |
fixed | NA | sibling_count4 | -0.08533 | 0.04264 | -2.001 | 4040 | 0.04544 | -0.205 | 0.03436 |
fixed | NA | sibling_count5 | -0.175 | 0.05049 | -3.466 | 4004 | 0.0005347 | -0.3167 | -0.03325 |
fixed | NA | sibling_count>5 | -0.3206 | 0.05119 | -6.263 | 4234 | 0.0000000004144 | -0.4643 | -0.1769 |
fixed | NA | birth_order_nonlinear2 | 0.03959 | 0.02714 | 1.459 | 4385 | 0.1448 | -0.0366 | 0.1158 |
fixed | NA | birth_order_nonlinear3 | 0.02682 | 0.03361 | 0.7981 | 4542 | 0.4249 | -0.06751 | 0.1212 |
fixed | NA | birth_order_nonlinear4 | 0.0122 | 0.04178 | 0.292 | 4691 | 0.7703 | -0.1051 | 0.1295 |
fixed | NA | birth_order_nonlinear5 | 0.09656 | 0.05185 | 1.862 | 4475 | 0.06265 | -0.049 | 0.2421 |
fixed | NA | birth_order_nonlinear>5 | 0.06261 | 0.05372 | 1.166 | 5388 | 0.2438 | -0.08818 | 0.2134 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5179 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6975 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8752 | 0.3728 | -2.348 | 5450 | 0.01892 | -1.922 | 0.1712 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1489 | 0.04219 | 3.53 | 5397 | 0.0004186 | 0.03051 | 0.2674 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004981 | 0.001505 | -3.311 | 5370 | 0.0009373 | -0.009204 | -0.0007576 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004837 | 0.00001704 | 2.839 | 5353 | 0.00454 | 0.0000005476 | 0.00009619 |
fixed | NA | male | -0.02137 | 0.0216 | -0.9894 | 5190 | 0.3225 | -0.082 | 0.03926 |
fixed | NA | count_birth_order2/2 | 0.05487 | 0.04968 | 1.105 | 4871 | 0.2694 | -0.08458 | 0.1943 |
fixed | NA | count_birth_order1/3 | -0.006477 | 0.04639 | -0.1396 | 5611 | 0.889 | -0.1367 | 0.1237 |
fixed | NA | count_birth_order2/3 | 0.04298 | 0.05006 | 0.8586 | 5747 | 0.3906 | -0.09754 | 0.1835 |
fixed | NA | count_birth_order3/3 | 0.02919 | 0.0557 | 0.5241 | 5788 | 0.6003 | -0.1272 | 0.1856 |
fixed | NA | count_birth_order1/4 | -0.1094 | 0.05641 | -1.939 | 5741 | 0.05254 | -0.2677 | 0.04896 |
fixed | NA | count_birth_order2/4 | -0.02503 | 0.05803 | -0.4314 | 5787 | 0.6662 | -0.1879 | 0.1379 |
fixed | NA | count_birth_order3/4 | -0.06345 | 0.06065 | -1.046 | 5776 | 0.2955 | -0.2337 | 0.1068 |
fixed | NA | count_birth_order4/4 | -0.03422 | 0.06329 | -0.5408 | 5767 | 0.5887 | -0.2119 | 0.1434 |
fixed | NA | count_birth_order1/5 | -0.1232 | 0.07517 | -1.639 | 5781 | 0.1012 | -0.3342 | 0.08776 |
fixed | NA | count_birth_order2/5 | -0.0938 | 0.08081 | -1.161 | 5673 | 0.2458 | -0.3206 | 0.133 |
fixed | NA | count_birth_order3/5 | -0.1584 | 0.07568 | -2.093 | 5702 | 0.03641 | -0.3708 | 0.05405 |
fixed | NA | count_birth_order4/5 | -0.1877 | 0.07323 | -2.563 | 5750 | 0.0104 | -0.3932 | 0.01787 |
fixed | NA | count_birth_order5/5 | -0.1089 | 0.07511 | -1.45 | 5726 | 0.1471 | -0.3197 | 0.1019 |
fixed | NA | count_birth_order1/>5 | -0.2572 | 0.07465 | -3.446 | 5691 | 0.0005734 | -0.4668 | -0.04768 |
fixed | NA | count_birth_order2/>5 | -0.373 | 0.07449 | -5.008 | 5643 | 0.0000005675 | -0.5821 | -0.1639 |
fixed | NA | count_birth_order3/>5 | -0.2644 | 0.07378 | -3.583 | 5591 | 0.0003422 | -0.4715 | -0.05727 |
fixed | NA | count_birth_order4/>5 | -0.3211 | 0.06919 | -4.641 | 5619 | 0.000003543 | -0.5153 | -0.1269 |
fixed | NA | count_birth_order5/>5 | -0.1957 | 0.06586 | -2.972 | 5637 | 0.002974 | -0.3806 | -0.01084 |
fixed | NA | count_birth_order>5/>5 | -0.2531 | 0.05163 | -4.903 | 5494 | 0.0000009697 | -0.3981 | -0.1082 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5182 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6977 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14535 | 14608 | -7257 | 14513 | NA | NA | NA |
12 | 14536 | 14616 | -7256 | 14512 | 1.533 | 1 | 0.2156 |
16 | 14540 | 14647 | -7254 | 14508 | 3.603 | 4 | 0.4623 |
26 | 14553 | 14727 | -7251 | 14501 | 6.45 | 10 | 0.7761 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8021 | 0.3701 | -2.168 | 5459 | 0.03024 | -1.841 | 0.2367 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1431 | 0.04197 | 3.41 | 5421 | 0.0006539 | 0.02531 | 0.2609 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004819 | 0.001497 | -3.219 | 5397 | 0.001293 | -0.009021 | -0.0006169 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004624 | 0.00001695 | 2.728 | 5386 | 0.006384 | -0.000001332 | 0.00009382 |
fixed | NA | male | -0.02123 | 0.02151 | -0.9869 | 5249 | 0.3237 | -0.08162 | 0.03916 |
fixed | NA | sibling_count3 | 0.006856 | 0.03997 | 0.1715 | 4166 | 0.8638 | -0.1053 | 0.1191 |
fixed | NA | sibling_count4 | -0.0426 | 0.0426 | -1 | 3920 | 0.3174 | -0.1622 | 0.07698 |
fixed | NA | sibling_count5 | -0.07804 | 0.04578 | -1.705 | 3698 | 0.08831 | -0.2065 | 0.05046 |
fixed | NA | sibling_count>5 | -0.1916 | 0.04007 | -4.783 | 3860 | 0.000001794 | -0.3041 | -0.07917 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5208 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6974 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7996 | 0.3702 | -2.16 | 5458 | 0.03081 | -1.839 | 0.2395 |
fixed | NA | birth_order | -0.002276 | 0.006431 | -0.354 | 5827 | 0.7234 | -0.02033 | 0.01578 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1432 | 0.04197 | 3.412 | 5421 | 0.0006499 | 0.02539 | 0.261 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00482 | 0.001497 | -3.219 | 5397 | 0.001293 | -0.009022 | -0.0006171 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004615 | 0.00001695 | 2.722 | 5382 | 0.0065 | -0.000001433 | 0.00009374 |
fixed | NA | male | -0.02113 | 0.02152 | -0.9817 | 5249 | 0.3263 | -0.08153 | 0.03928 |
fixed | NA | sibling_count3 | 0.008026 | 0.04011 | 0.2001 | 4170 | 0.8414 | -0.1046 | 0.1206 |
fixed | NA | sibling_count4 | -0.03991 | 0.04327 | -0.9224 | 3928 | 0.3564 | -0.1614 | 0.08155 |
fixed | NA | sibling_count5 | -0.07387 | 0.04727 | -1.563 | 3750 | 0.1182 | -0.2066 | 0.05882 |
fixed | NA | sibling_count>5 | -0.183 | 0.04692 | -3.9 | 4229 | 0.00009751 | -0.3147 | -0.0513 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5206 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6975 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8363 | 0.371 | -2.254 | 5489 | 0.02424 | -1.878 | 0.2052 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1458 | 0.04202 | 3.469 | 5440 | 0.0005261 | 0.02782 | 0.2637 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004913 | 0.001499 | -3.278 | 5411 | 0.001053 | -0.00912 | -0.0007057 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004722 | 0.00001697 | 2.782 | 5393 | 0.005418 | -0.0000004217 | 0.00009485 |
fixed | NA | male | -0.02023 | 0.02152 | -0.9401 | 5244 | 0.3472 | -0.08065 | 0.04018 |
fixed | NA | sibling_count3 | 0.008151 | 0.04069 | 0.2003 | 4306 | 0.8412 | -0.1061 | 0.1224 |
fixed | NA | sibling_count4 | -0.03462 | 0.04449 | -0.7782 | 4167 | 0.4365 | -0.1595 | 0.09026 |
fixed | NA | sibling_count5 | -0.0762 | 0.04905 | -1.554 | 4063 | 0.1204 | -0.2139 | 0.06148 |
fixed | NA | sibling_count>5 | -0.1822 | 0.04805 | -3.792 | 4413 | 0.0001514 | -0.3171 | -0.04733 |
fixed | NA | birth_order_nonlinear2 | 0.0345 | 0.02777 | 1.242 | 4518 | 0.2142 | -0.04345 | 0.1125 |
fixed | NA | birth_order_nonlinear3 | -0.005354 | 0.03358 | -0.1595 | 4642 | 0.8733 | -0.09961 | 0.0889 |
fixed | NA | birth_order_nonlinear4 | -0.02399 | 0.0407 | -0.5894 | 4817 | 0.5556 | -0.1382 | 0.09026 |
fixed | NA | birth_order_nonlinear5 | 0.04948 | 0.0496 | 0.9975 | 4667 | 0.3186 | -0.08975 | 0.1887 |
fixed | NA | birth_order_nonlinear>5 | -0.009693 | 0.04843 | -0.2002 | 5619 | 0.8414 | -0.1456 | 0.1262 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5206 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6975 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8476 | 0.3718 | -2.28 | 5494 | 0.02267 | -1.891 | 0.1961 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1447 | 0.04207 | 3.438 | 5435 | 0.00059 | 0.02656 | 0.2628 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004861 | 0.001501 | -3.238 | 5408 | 0.00121 | -0.009074 | -0.0006473 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004649 | 0.000017 | 2.734 | 5391 | 0.006271 | -0.000001236 | 0.00009421 |
fixed | NA | male | -0.02115 | 0.02153 | -0.9822 | 5231 | 0.326 | -0.08157 | 0.03928 |
fixed | NA | count_birth_order2/2 | 0.09269 | 0.05458 | 1.698 | 5017 | 0.0895 | -0.06051 | 0.2459 |
fixed | NA | count_birth_order1/3 | 0.03991 | 0.05027 | 0.7939 | 5665 | 0.4273 | -0.1012 | 0.181 |
fixed | NA | count_birth_order2/3 | 0.02977 | 0.05389 | 0.5524 | 5789 | 0.5807 | -0.1215 | 0.181 |
fixed | NA | count_birth_order3/3 | 0.04257 | 0.06031 | 0.7058 | 5839 | 0.4803 | -0.1267 | 0.2119 |
fixed | NA | count_birth_order1/4 | -0.07608 | 0.05917 | -1.286 | 5785 | 0.1986 | -0.2422 | 0.09002 |
fixed | NA | count_birth_order2/4 | 0.08764 | 0.06018 | 1.456 | 5832 | 0.1454 | -0.0813 | 0.2566 |
fixed | NA | count_birth_order3/4 | -0.0303 | 0.065 | -0.4661 | 5822 | 0.6411 | -0.2128 | 0.1522 |
fixed | NA | count_birth_order4/4 | -0.03003 | 0.06725 | -0.4466 | 5821 | 0.6552 | -0.2188 | 0.1587 |
fixed | NA | count_birth_order1/5 | -0.0001437 | 0.06919 | -0.002077 | 5837 | 0.9983 | -0.1944 | 0.1941 |
fixed | NA | count_birth_order2/5 | -0.01429 | 0.07426 | -0.1925 | 5782 | 0.8474 | -0.2227 | 0.1942 |
fixed | NA | count_birth_order3/5 | -0.1014 | 0.07188 | -1.411 | 5792 | 0.1584 | -0.3032 | 0.1004 |
fixed | NA | count_birth_order4/5 | -0.1037 | 0.07452 | -1.391 | 5759 | 0.1641 | -0.3129 | 0.1055 |
fixed | NA | count_birth_order5/5 | -0.02898 | 0.07439 | -0.3896 | 5767 | 0.6969 | -0.2378 | 0.1798 |
fixed | NA | count_birth_order1/>5 | -0.1089 | 0.06599 | -1.65 | 5835 | 0.09905 | -0.2941 | 0.07637 |
fixed | NA | count_birth_order2/>5 | -0.2303 | 0.06883 | -3.346 | 5750 | 0.0008244 | -0.4235 | -0.03712 |
fixed | NA | count_birth_order3/>5 | -0.1537 | 0.06699 | -2.294 | 5736 | 0.02182 | -0.3417 | 0.03436 |
fixed | NA | count_birth_order4/>5 | -0.1817 | 0.06466 | -2.81 | 5752 | 0.00497 | -0.3632 | -0.0001943 |
fixed | NA | count_birth_order5/>5 | -0.1002 | 0.06589 | -1.52 | 5664 | 0.1284 | -0.2851 | 0.08477 |
fixed | NA | count_birth_order>5/>5 | -0.1736 | 0.05057 | -3.433 | 5562 | 0.0006013 | -0.3156 | -0.03166 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5209 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6971 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14682 | 14755 | -7330 | 14660 | NA | NA | NA |
12 | 14684 | 14764 | -7330 | 14660 | 0.1261 | 1 | 0.7225 |
16 | 14687 | 14794 | -7328 | 14655 | 4.215 | 4 | 0.3777 |
26 | 14694 | 14868 | -7321 | 14642 | 13.01 | 10 | 0.2232 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.9226 | 0.3751 | -2.46 | 5314 | 0.01394 | -1.976 | 0.1303 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1559 | 0.04254 | 3.665 | 5280 | 0.0002495 | 0.03651 | 0.2753 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005258 | 0.001517 | -3.465 | 5254 | 0.0005345 | -0.009517 | -0.0009983 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000515 | 0.00001718 | 2.997 | 5240 | 0.002742 | 0.000003259 | 0.00009974 |
fixed | NA | male | -0.02117 | 0.0218 | -0.9713 | 5119 | 0.3314 | -0.08236 | 0.04001 |
fixed | NA | sibling_count3 | 0.01472 | 0.03647 | 0.4035 | 4008 | 0.6866 | -0.08767 | 0.1171 |
fixed | NA | sibling_count4 | -0.06404 | 0.04 | -1.601 | 3736 | 0.1095 | -0.1763 | 0.04826 |
fixed | NA | sibling_count5 | -0.1279 | 0.04754 | -2.691 | 3450 | 0.007154 | -0.2614 | 0.005507 |
fixed | NA | sibling_count>5 | -0.271 | 0.04142 | -6.541 | 3409 | 0.00000000007002 | -0.3872 | -0.1547 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5155 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6986 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.9298 | 0.3751 | -2.479 | 5313 | 0.01321 | -1.983 | 0.1231 |
fixed | NA | birth_order | 0.01005 | 0.007512 | 1.338 | 5537 | 0.181 | -0.01104 | 0.03114 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1551 | 0.04254 | 3.646 | 5281 | 0.000269 | 0.03569 | 0.2745 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005241 | 0.001517 | -3.454 | 5255 | 0.0005566 | -0.009499 | -0.0009817 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005174 | 0.00001718 | 3.011 | 5237 | 0.002619 | 0.0000035 | 0.00009997 |
fixed | NA | male | -0.0215 | 0.0218 | -0.9866 | 5118 | 0.3239 | -0.08269 | 0.03968 |
fixed | NA | sibling_count3 | 0.009523 | 0.03668 | 0.2596 | 4021 | 0.7952 | -0.09344 | 0.1125 |
fixed | NA | sibling_count4 | -0.07619 | 0.04102 | -1.857 | 3784 | 0.06335 | -0.1913 | 0.03896 |
fixed | NA | sibling_count5 | -0.147 | 0.04963 | -2.962 | 3564 | 0.003076 | -0.2863 | -0.007695 |
fixed | NA | sibling_count>5 | -0.3101 | 0.0507 | -6.116 | 4032 | 0.000000001052 | -0.4524 | -0.1678 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5157 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6984 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.9568 | 0.3761 | -2.544 | 5347 | 0.01098 | -2.013 | 0.0989 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1581 | 0.0426 | 3.711 | 5301 | 0.0002086 | 0.0385 | 0.2776 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005346 | 0.001519 | -3.519 | 5270 | 0.0004364 | -0.00961 | -0.001082 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000529 | 0.0000172 | 3.075 | 5247 | 0.002118 | 0.000004605 | 0.0001012 |
fixed | NA | male | -0.0212 | 0.0218 | -0.9723 | 5112 | 0.3309 | -0.0824 | 0.04 |
fixed | NA | sibling_count3 | 0.00883 | 0.03729 | 0.2368 | 4177 | 0.8129 | -0.09586 | 0.1135 |
fixed | NA | sibling_count4 | -0.07612 | 0.04236 | -1.797 | 4044 | 0.07238 | -0.195 | 0.04278 |
fixed | NA | sibling_count5 | -0.1499 | 0.05142 | -2.914 | 3864 | 0.003586 | -0.2942 | -0.005511 |
fixed | NA | sibling_count>5 | -0.3102 | 0.05189 | -5.978 | 4227 | 0.000000002442 | -0.4559 | -0.1646 |
fixed | NA | birth_order_nonlinear2 | 0.04352 | 0.02709 | 1.606 | 4296 | 0.1083 | -0.03253 | 0.1196 |
fixed | NA | birth_order_nonlinear3 | 0.02617 | 0.03362 | 0.7785 | 4446 | 0.4363 | -0.0682 | 0.1205 |
fixed | NA | birth_order_nonlinear4 | 0.0344 | 0.04292 | 0.8015 | 4559 | 0.4229 | -0.08607 | 0.1549 |
fixed | NA | birth_order_nonlinear5 | 0.07337 | 0.05415 | 1.355 | 4375 | 0.1755 | -0.07862 | 0.2254 |
fixed | NA | birth_order_nonlinear>5 | 0.06926 | 0.0553 | 1.252 | 5207 | 0.2105 | -0.08596 | 0.2245 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5155 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6987 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.9636 | 0.3773 | -2.554 | 5349 | 0.01067 | -2.023 | 0.09537 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1579 | 0.04271 | 3.697 | 5297 | 0.0002206 | 0.038 | 0.2778 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005325 | 0.001524 | -3.495 | 5268 | 0.0004781 | -0.009602 | -0.001048 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000525 | 0.00001726 | 3.042 | 5248 | 0.002365 | 0.00000405 | 0.000101 |
fixed | NA | male | -0.02235 | 0.02182 | -1.024 | 5097 | 0.3058 | -0.08361 | 0.03891 |
fixed | NA | count_birth_order2/2 | 0.06086 | 0.04827 | 1.261 | 4697 | 0.2074 | -0.07464 | 0.1964 |
fixed | NA | count_birth_order1/3 | 0.007247 | 0.04578 | 0.1583 | 5515 | 0.8742 | -0.1212 | 0.1357 |
fixed | NA | count_birth_order2/3 | 0.0644 | 0.04994 | 1.29 | 5653 | 0.1973 | -0.07578 | 0.2046 |
fixed | NA | count_birth_order3/3 | 0.04643 | 0.05471 | 0.8486 | 5674 | 0.3962 | -0.1071 | 0.2 |
fixed | NA | count_birth_order1/4 | -0.09561 | 0.05654 | -1.691 | 5649 | 0.09087 | -0.2543 | 0.06309 |
fixed | NA | count_birth_order2/4 | -0.0208 | 0.05792 | -0.3592 | 5674 | 0.7195 | -0.1834 | 0.1418 |
fixed | NA | count_birth_order3/4 | -0.04594 | 0.06005 | -0.765 | 5657 | 0.4443 | -0.2145 | 0.1226 |
fixed | NA | count_birth_order4/4 | -0.004906 | 0.06335 | -0.07745 | 5632 | 0.9383 | -0.1827 | 0.1729 |
fixed | NA | count_birth_order1/5 | -0.1047 | 0.07511 | -1.394 | 5672 | 0.1633 | -0.3156 | 0.1061 |
fixed | NA | count_birth_order2/5 | -0.07203 | 0.08321 | -0.8656 | 5534 | 0.3867 | -0.3056 | 0.1616 |
fixed | NA | count_birth_order3/5 | -0.1374 | 0.0791 | -1.738 | 5567 | 0.08235 | -0.3595 | 0.0846 |
fixed | NA | count_birth_order4/5 | -0.1243 | 0.0766 | -1.623 | 5620 | 0.1046 | -0.3394 | 0.09067 |
fixed | NA | count_birth_order5/5 | -0.112 | 0.08027 | -1.395 | 5586 | 0.163 | -0.3373 | 0.1133 |
fixed | NA | count_birth_order1/>5 | -0.2309 | 0.07637 | -3.024 | 5564 | 0.002509 | -0.4453 | -0.01654 |
fixed | NA | count_birth_order2/>5 | -0.3469 | 0.07643 | -4.539 | 5509 | 0.000005763 | -0.5615 | -0.1324 |
fixed | NA | count_birth_order3/>5 | -0.2686 | 0.07462 | -3.599 | 5471 | 0.0003218 | -0.4781 | -0.05913 |
fixed | NA | count_birth_order4/>5 | -0.3014 | 0.07262 | -4.15 | 5417 | 0.0000337 | -0.5052 | -0.09755 |
fixed | NA | count_birth_order5/>5 | -0.2063 | 0.06741 | -3.061 | 5498 | 0.002217 | -0.3956 | -0.01712 |
fixed | NA | count_birth_order>5/>5 | -0.2356 | 0.05257 | -4.482 | 5397 | 0.000007558 | -0.3832 | -0.08803 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5157 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.699 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14247 | 14320 | -7112 | 14225 | NA | NA | NA |
12 | 14247 | 14327 | -7111 | 14223 | 1.792 | 1 | 0.1807 |
16 | 14253 | 14359 | -7110 | 14221 | 2.106 | 4 | 0.7163 |
26 | 14267 | 14440 | -7108 | 14215 | 5.623 | 10 | 0.8458 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = raven_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2589 | 0.1483 | -1.745 | 13929 | 0.08095 | -0.6753 | 0.1575 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.05817 | 0.01424 | 4.085 | 13917 | 0.00004427 | 0.0182 | 0.09814 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001978 | 0.0004199 | -4.709 | 13856 | 0.000002507 | -0.003156 | -0.0007989 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001287 | 0.000003875 | 3.32 | 13750 | 0.0009022 | 0.000001988 | 0.00002374 |
fixed | NA | male | 0.1522 | 0.01535 | 9.916 | 13196 | 4.293e-23 | 0.1091 | 0.1953 |
fixed | NA | sibling_count3 | 0.03526 | 0.0328 | 1.075 | 9632 | 0.2824 | -0.05682 | 0.1273 |
fixed | NA | sibling_count4 | -0.001169 | 0.03399 | -0.03439 | 8938 | 0.9726 | -0.09657 | 0.09424 |
fixed | NA | sibling_count5 | 0.03681 | 0.03559 | 1.034 | 8256 | 0.301 | -0.06309 | 0.1367 |
fixed | NA | sibling_count>5 | -0.1097 | 0.02774 | -3.955 | 9049 | 0.000077 | -0.1876 | -0.03185 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4621 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8175 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2593 | 0.1483 | -1.748 | 13928 | 0.08044 | -0.6757 | 0.1571 |
fixed | NA | birth_order | -0.006107 | 0.003326 | -1.836 | 13743 | 0.06633 | -0.01544 | 0.003228 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.06006 | 0.01428 | 4.207 | 13911 | 0.00002601 | 0.01999 | 0.1001 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002051 | 0.0004218 | -4.862 | 13823 | 0.000001175 | -0.003235 | -0.0008667 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001355 | 0.000003893 | 3.482 | 13690 | 0.0004996 | 0.000002627 | 0.00002448 |
fixed | NA | male | 0.1523 | 0.01535 | 9.924 | 13197 | 3.93e-23 | 0.1092 | 0.1954 |
fixed | NA | sibling_count3 | 0.03641 | 0.0328 | 1.11 | 9645 | 0.267 | -0.05566 | 0.1285 |
fixed | NA | sibling_count4 | 0.00274 | 0.03404 | 0.0805 | 9001 | 0.9358 | -0.09282 | 0.0983 |
fixed | NA | sibling_count5 | 0.04392 | 0.03578 | 1.227 | 8376 | 0.2198 | -0.05653 | 0.1444 |
fixed | NA | sibling_count>5 | -0.08692 | 0.03038 | -2.861 | 10247 | 0.004227 | -0.1722 | -0.001649 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4614 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8177 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2533 | 0.1487 | -1.703 | 13924 | 0.08852 | -0.6707 | 0.1641 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.05911 | 0.01428 | 4.14 | 13910 | 0.0000349 | 0.01903 | 0.09918 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002023 | 0.0004217 | -4.798 | 13823 | 0.000001623 | -0.003207 | -0.0008395 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001335 | 0.000003894 | 3.429 | 13683 | 0.0006066 | 0.000002424 | 0.00002428 |
fixed | NA | male | 0.1521 | 0.01535 | 9.913 | 13190 | 4.402e-23 | 0.109 | 0.1952 |
fixed | NA | sibling_count3 | 0.02663 | 0.03319 | 0.8024 | 9945 | 0.4223 | -0.06653 | 0.1198 |
fixed | NA | sibling_count4 | -0.00795 | 0.03484 | -0.2282 | 9597 | 0.8195 | -0.1058 | 0.08986 |
fixed | NA | sibling_count5 | 0.02496 | 0.03693 | 0.6759 | 9146 | 0.4991 | -0.0787 | 0.1286 |
fixed | NA | sibling_count>5 | -0.1004 | 0.0317 | -3.166 | 11147 | 0.00155 | -0.1894 | -0.01138 |
fixed | NA | birth_order_nonlinear2 | -0.01635 | 0.02205 | -0.7413 | 12346 | 0.4585 | -0.07825 | 0.04555 |
fixed | NA | birth_order_nonlinear3 | 0.03193 | 0.02594 | 1.231 | 11954 | 0.2184 | -0.04089 | 0.1048 |
fixed | NA | birth_order_nonlinear4 | -0.01247 | 0.02955 | -0.4222 | 11946 | 0.6729 | -0.09542 | 0.07047 |
fixed | NA | birth_order_nonlinear5 | 0.02924 | 0.03368 | 0.8682 | 11900 | 0.3853 | -0.0653 | 0.1238 |
fixed | NA | birth_order_nonlinear>5 | -0.04653 | 0.02843 | -1.636 | 13682 | 0.1018 | -0.1263 | 0.03328 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4618 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8174 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.23 | 0.1493 | -1.54 | 13913 | 0.1235 | -0.6492 | 0.1892 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.05915 | 0.01428 | 4.142 | 13898 | 0.00003458 | 0.01907 | 0.09923 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002015 | 0.0004219 | -4.777 | 13806 | 0.000001799 | -0.003199 | -0.000831 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000132 | 0.000003896 | 3.389 | 13657 | 0.0007026 | 0.000002269 | 0.00002414 |
fixed | NA | male | 0.1523 | 0.01535 | 9.921 | 13184 | 4.082e-23 | 0.1092 | 0.1954 |
fixed | NA | count_birth_order2/2 | -0.08968 | 0.04298 | -2.087 | 12674 | 0.03694 | -0.2103 | 0.03096 |
fixed | NA | count_birth_order1/3 | 0.001331 | 0.04216 | 0.03157 | 13409 | 0.9748 | -0.117 | 0.1197 |
fixed | NA | count_birth_order2/3 | -0.01655 | 0.04682 | -0.3534 | 13662 | 0.7238 | -0.148 | 0.1149 |
fixed | NA | count_birth_order3/3 | 0.02862 | 0.05232 | 0.547 | 13843 | 0.5844 | -0.1182 | 0.1755 |
fixed | NA | count_birth_order1/4 | -0.05712 | 0.04776 | -1.196 | 13656 | 0.2318 | -0.1912 | 0.07695 |
fixed | NA | count_birth_order2/4 | -0.00643 | 0.0504 | -0.1276 | 13758 | 0.8985 | -0.1479 | 0.135 |
fixed | NA | count_birth_order3/4 | -0.003269 | 0.0545 | -0.05998 | 13880 | 0.9522 | -0.1563 | 0.1497 |
fixed | NA | count_birth_order4/4 | -0.07443 | 0.05735 | -1.298 | 13912 | 0.1943 | -0.2354 | 0.08654 |
fixed | NA | count_birth_order1/5 | -0.06156 | 0.05424 | -1.135 | 13827 | 0.2564 | -0.2138 | 0.09069 |
fixed | NA | count_birth_order2/5 | 0.001736 | 0.05671 | 0.03062 | 13883 | 0.9756 | -0.1574 | 0.1609 |
fixed | NA | count_birth_order3/5 | 0.04451 | 0.05839 | 0.7622 | 13912 | 0.4459 | -0.1194 | 0.2084 |
fixed | NA | count_birth_order4/5 | -0.03346 | 0.06165 | -0.5427 | 13925 | 0.5874 | -0.2065 | 0.1396 |
fixed | NA | count_birth_order5/5 | 0.09651 | 0.06314 | 1.529 | 13921 | 0.1264 | -0.08072 | 0.2737 |
fixed | NA | count_birth_order1/>5 | -0.1224 | 0.04362 | -2.805 | 13915 | 0.005039 | -0.2448 | 0.00009071 |
fixed | NA | count_birth_order2/>5 | -0.1417 | 0.04493 | -3.153 | 13925 | 0.001617 | -0.2678 | -0.01556 |
fixed | NA | count_birth_order3/>5 | -0.1007 | 0.04394 | -2.291 | 13925 | 0.02199 | -0.224 | 0.02268 |
fixed | NA | count_birth_order4/>5 | -0.1217 | 0.04315 | -2.82 | 13922 | 0.004806 | -0.2428 | -0.0005698 |
fixed | NA | count_birth_order5/>5 | -0.1216 | 0.04345 | -2.798 | 13925 | 0.005143 | -0.2436 | 0.0003755 |
fixed | NA | count_birth_order>5/>5 | -0.174 | 0.0348 | -5 | 12310 | 0.0000005819 | -0.2717 | -0.07631 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4612 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8177 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 37283 | 37366 | -18631 | 37261 | NA | NA | NA |
12 | 37282 | 37372 | -18629 | 37258 | 3.375 | 1 | 0.06621 |
16 | 37283 | 37404 | -18625 | 37251 | 6.817 | 4 | 0.1459 |
26 | 37293 | 37489 | -18621 | 37241 | 9.765 | 10 | 0.4614 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5241 | 0.3667 | -1.429 | 5788 | 0.153 | -1.553 | 0.5053 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09035 | 0.04162 | 2.171 | 5785 | 0.02997 | -0.02647 | 0.2072 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002746 | 0.001486 | -1.849 | 5785 | 0.06455 | -0.006916 | 0.001424 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002114 | 0.00001683 | 1.256 | 5789 | 0.2092 | -0.00002611 | 0.00006838 |
fixed | NA | male | 0.09392 | 0.02139 | 4.392 | 5674 | 0.00001146 | 0.03389 | 0.154 |
fixed | NA | sibling_count3 | 0.0296 | 0.03472 | 0.8526 | 4233 | 0.394 | -0.06786 | 0.1271 |
fixed | NA | sibling_count4 | -0.0397 | 0.03752 | -1.058 | 3809 | 0.2901 | -0.145 | 0.06562 |
fixed | NA | sibling_count5 | -0.08843 | 0.04313 | -2.05 | 3485 | 0.04042 | -0.2095 | 0.03265 |
fixed | NA | sibling_count>5 | -0.1438 | 0.03792 | -3.792 | 3348 | 0.0001518 | -0.2503 | -0.03737 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3938 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7424 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5258 | 0.3668 | -1.434 | 5786 | 0.1517 | -1.555 | 0.5037 |
fixed | NA | birth_order | 0.002299 | 0.007146 | 0.3216 | 5923 | 0.7477 | -0.01776 | 0.02236 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09021 | 0.04162 | 2.167 | 5784 | 0.03025 | -0.02662 | 0.207 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002745 | 0.001486 | -1.848 | 5784 | 0.06472 | -0.006915 | 0.001425 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002121 | 0.00001683 | 1.26 | 5786 | 0.2077 | -0.00002604 | 0.00006846 |
fixed | NA | male | 0.09381 | 0.02139 | 4.386 | 5673 | 0.00001177 | 0.03377 | 0.1538 |
fixed | NA | sibling_count3 | 0.02845 | 0.03491 | 0.815 | 4241 | 0.4151 | -0.06954 | 0.1264 |
fixed | NA | sibling_count4 | -0.0424 | 0.03845 | -1.103 | 3831 | 0.2702 | -0.1503 | 0.06554 |
fixed | NA | sibling_count5 | -0.09284 | 0.04527 | -2.051 | 3592 | 0.04035 | -0.2199 | 0.03423 |
fixed | NA | sibling_count>5 | -0.1526 | 0.04681 | -3.261 | 3900 | 0.001121 | -0.2841 | -0.02123 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.394 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7423 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5665 | 0.3675 | -1.541 | 5802 | 0.1233 | -1.598 | 0.4652 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09346 | 0.04166 | 2.243 | 5792 | 0.02491 | -0.02348 | 0.2104 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00286 | 0.001487 | -1.923 | 5790 | 0.05454 | -0.007034 | 0.001315 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002249 | 0.00001685 | 1.335 | 5790 | 0.182 | -0.00002481 | 0.00006979 |
fixed | NA | male | 0.09389 | 0.02139 | 4.389 | 5669 | 0.00001161 | 0.03384 | 0.1539 |
fixed | NA | sibling_count3 | 0.01664 | 0.03555 | 0.468 | 4419 | 0.6398 | -0.08316 | 0.1164 |
fixed | NA | sibling_count4 | -0.05847 | 0.03981 | -1.469 | 4138 | 0.142 | -0.1702 | 0.05329 |
fixed | NA | sibling_count5 | -0.1133 | 0.04732 | -2.394 | 3993 | 0.0167 | -0.2462 | 0.01953 |
fixed | NA | sibling_count>5 | -0.1617 | 0.04806 | -3.365 | 4136 | 0.0007719 | -0.2966 | -0.02683 |
fixed | NA | birth_order_nonlinear2 | 0.04528 | 0.02729 | 1.659 | 4735 | 0.09717 | -0.03133 | 0.1219 |
fixed | NA | birth_order_nonlinear3 | 0.0584 | 0.03378 | 1.729 | 4941 | 0.08393 | -0.03643 | 0.1532 |
fixed | NA | birth_order_nonlinear4 | 0.03984 | 0.04188 | 0.9514 | 5104 | 0.3415 | -0.07771 | 0.1574 |
fixed | NA | birth_order_nonlinear5 | 0.05613 | 0.05225 | 1.074 | 4916 | 0.2827 | -0.09053 | 0.2028 |
fixed | NA | birth_order_nonlinear>5 | 0.01605 | 0.05306 | 0.3025 | 5783 | 0.7623 | -0.1329 | 0.165 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3928 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7428 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5931 | 0.3685 | -1.61 | 5797 | 0.1076 | -1.627 | 0.4412 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09665 | 0.04176 | 2.314 | 5784 | 0.02068 | -0.02057 | 0.2139 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002961 | 0.001491 | -1.986 | 5783 | 0.04709 | -0.007146 | 0.001224 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002349 | 0.0000169 | 1.39 | 5784 | 0.1646 | -0.00002395 | 0.00007092 |
fixed | NA | male | 0.09428 | 0.02141 | 4.403 | 5659 | 0.00001087 | 0.03418 | 0.1544 |
fixed | NA | count_birth_order2/2 | 0.03312 | 0.04956 | 0.6683 | 5102 | 0.5039 | -0.106 | 0.1722 |
fixed | NA | count_birth_order1/3 | -0.01387 | 0.04484 | -0.3094 | 5827 | 0.757 | -0.1398 | 0.112 |
fixed | NA | count_birth_order2/3 | 0.08776 | 0.04873 | 1.801 | 5891 | 0.07174 | -0.04902 | 0.2245 |
fixed | NA | count_birth_order3/3 | 0.08144 | 0.0544 | 1.497 | 5909 | 0.1345 | -0.07127 | 0.2341 |
fixed | NA | count_birth_order1/4 | -0.06891 | 0.05445 | -1.265 | 5884 | 0.2057 | -0.2217 | 0.08394 |
fixed | NA | count_birth_order2/4 | -0.02435 | 0.05634 | -0.4322 | 5909 | 0.6656 | -0.1825 | 0.1338 |
fixed | NA | count_birth_order3/4 | 0.006464 | 0.05937 | 0.1089 | 5899 | 0.9133 | -0.1602 | 0.1731 |
fixed | NA | count_birth_order4/4 | -0.0157 | 0.06178 | -0.2541 | 5897 | 0.7994 | -0.1891 | 0.1577 |
fixed | NA | count_birth_order1/5 | -0.05962 | 0.07384 | -0.8075 | 5906 | 0.4194 | -0.2669 | 0.1476 |
fixed | NA | count_birth_order2/5 | -0.04247 | 0.07901 | -0.5376 | 5853 | 0.5909 | -0.2642 | 0.1793 |
fixed | NA | count_birth_order3/5 | -0.05223 | 0.07429 | -0.703 | 5863 | 0.4821 | -0.2608 | 0.1563 |
fixed | NA | count_birth_order4/5 | -0.1066 | 0.07177 | -1.486 | 5884 | 0.1374 | -0.3081 | 0.09481 |
fixed | NA | count_birth_order5/5 | -0.1237 | 0.07425 | -1.666 | 5866 | 0.09572 | -0.3321 | 0.0847 |
fixed | NA | count_birth_order1/>5 | -0.1206 | 0.07347 | -1.642 | 5868 | 0.1007 | -0.3269 | 0.0856 |
fixed | NA | count_birth_order2/>5 | -0.1956 | 0.07265 | -2.693 | 5846 | 0.007103 | -0.3996 | 0.00829 |
fixed | NA | count_birth_order3/>5 | -0.1502 | 0.07269 | -2.066 | 5800 | 0.0389 | -0.3542 | 0.05389 |
fixed | NA | count_birth_order4/>5 | -0.1115 | 0.06833 | -1.631 | 5806 | 0.1029 | -0.3033 | 0.08034 |
fixed | NA | count_birth_order5/>5 | -0.06799 | 0.06468 | -1.051 | 5817 | 0.2932 | -0.2495 | 0.1136 |
fixed | NA | count_birth_order>5/>5 | -0.1493 | 0.0495 | -3.016 | 5523 | 0.002577 | -0.2882 | -0.01032 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3924 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7433 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14652 | 14726 | -7315 | 14630 | NA | NA | NA |
12 | 14654 | 14734 | -7315 | 14630 | 0.1023 | 1 | 0.7491 |
16 | 14657 | 14764 | -7313 | 14625 | 4.598 | 4 | 0.3311 |
26 | 14671 | 14844 | -7309 | 14619 | 6.858 | 10 | 0.7388 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4997 | 0.3654 | -1.367 | 5839 | 0.1716 | -1.525 | 0.5261 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08706 | 0.04149 | 2.098 | 5834 | 0.03592 | -0.02941 | 0.2035 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002669 | 0.001481 | -1.801 | 5833 | 0.0717 | -0.006827 | 0.00149 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000203 | 0.00001679 | 1.209 | 5838 | 0.2266 | -0.00002682 | 0.00006742 |
fixed | NA | male | 0.09351 | 0.02129 | 4.392 | 5722 | 0.00001146 | 0.03374 | 0.1533 |
fixed | NA | sibling_count3 | 0.03147 | 0.0375 | 0.8392 | 4389 | 0.4014 | -0.0738 | 0.1367 |
fixed | NA | sibling_count4 | -0.009716 | 0.03964 | -0.2451 | 4039 | 0.8064 | -0.121 | 0.1016 |
fixed | NA | sibling_count5 | -0.01839 | 0.04258 | -0.4318 | 3719 | 0.6659 | -0.1379 | 0.1011 |
fixed | NA | sibling_count>5 | -0.0805 | 0.03731 | -2.157 | 3862 | 0.03103 | -0.1852 | 0.02424 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3954 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7416 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4938 | 0.3655 | -1.351 | 5839 | 0.1768 | -1.52 | 0.5323 |
fixed | NA | birth_order | -0.005347 | 0.006257 | -0.8546 | 5930 | 0.3928 | -0.02291 | 0.01222 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08718 | 0.0415 | 2.101 | 5834 | 0.03568 | -0.0293 | 0.2037 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002665 | 0.001482 | -1.799 | 5833 | 0.07212 | -0.006824 | 0.001494 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002004 | 0.00001679 | 1.193 | 5836 | 0.2329 | -0.0000271 | 0.00006717 |
fixed | NA | male | 0.09375 | 0.0213 | 4.402 | 5723 | 0.00001092 | 0.03397 | 0.1535 |
fixed | NA | sibling_count3 | 0.03414 | 0.03762 | 0.9075 | 4389 | 0.3642 | -0.07147 | 0.1398 |
fixed | NA | sibling_count4 | -0.003681 | 0.04025 | -0.09145 | 4036 | 0.9271 | -0.1167 | 0.1093 |
fixed | NA | sibling_count5 | -0.008885 | 0.044 | -0.2019 | 3753 | 0.84 | -0.1324 | 0.1146 |
fixed | NA | sibling_count>5 | -0.06066 | 0.04394 | -1.381 | 4203 | 0.1675 | -0.184 | 0.06268 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3946 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7419 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5303 | 0.3662 | -1.448 | 5853 | 0.1477 | -1.558 | 0.4977 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08914 | 0.04153 | 2.146 | 5842 | 0.03189 | -0.02744 | 0.2057 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002734 | 0.001483 | -1.844 | 5840 | 0.06528 | -0.006897 | 0.001429 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002084 | 0.00001681 | 1.24 | 5841 | 0.2152 | -0.00002635 | 0.00006802 |
fixed | NA | male | 0.09355 | 0.0213 | 4.391 | 5720 | 0.00001148 | 0.03375 | 0.1533 |
fixed | NA | sibling_count3 | 0.02214 | 0.03824 | 0.579 | 4541 | 0.5626 | -0.0852 | 0.1295 |
fixed | NA | sibling_count4 | -0.02317 | 0.04153 | -0.558 | 4308 | 0.5769 | -0.1398 | 0.09341 |
fixed | NA | sibling_count5 | -0.03049 | 0.04591 | -0.6641 | 4121 | 0.5066 | -0.1594 | 0.09838 |
fixed | NA | sibling_count>5 | -0.07221 | 0.04516 | -1.599 | 4447 | 0.1099 | -0.199 | 0.05456 |
fixed | NA | birth_order_nonlinear2 | 0.036 | 0.02783 | 1.294 | 4879 | 0.1959 | -0.04213 | 0.1141 |
fixed | NA | birth_order_nonlinear3 | 0.04407 | 0.03368 | 1.309 | 5071 | 0.1907 | -0.05046 | 0.1386 |
fixed | NA | birth_order_nonlinear4 | 0.03472 | 0.04065 | 0.8542 | 5249 | 0.393 | -0.07937 | 0.1488 |
fixed | NA | birth_order_nonlinear5 | 0.01614 | 0.04974 | 0.3245 | 5143 | 0.7456 | -0.1235 | 0.1558 |
fixed | NA | birth_order_nonlinear>5 | -0.03226 | 0.04754 | -0.6786 | 5933 | 0.4974 | -0.1657 | 0.1012 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3933 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7425 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.527 | 0.3668 | -1.437 | 5847 | 0.1509 | -1.557 | 0.5027 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08859 | 0.04158 | 2.131 | 5831 | 0.03316 | -0.02812 | 0.2053 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002699 | 0.001485 | -1.817 | 5829 | 0.06921 | -0.006867 | 0.00147 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002026 | 0.00001683 | 1.203 | 5832 | 0.2288 | -0.00002699 | 0.00006751 |
fixed | NA | male | 0.09351 | 0.0213 | 4.389 | 5705 | 0.00001157 | 0.03371 | 0.1533 |
fixed | NA | count_birth_order2/2 | 0.03047 | 0.05428 | 0.5614 | 5243 | 0.5745 | -0.1219 | 0.1828 |
fixed | NA | count_birth_order1/3 | -0.005049 | 0.0485 | -0.1041 | 5879 | 0.9171 | -0.1412 | 0.1311 |
fixed | NA | count_birth_order2/3 | 0.07102 | 0.05237 | 1.356 | 5939 | 0.1751 | -0.07598 | 0.218 |
fixed | NA | count_birth_order3/3 | 0.09355 | 0.05888 | 1.589 | 5962 | 0.1121 | -0.07173 | 0.2588 |
fixed | NA | count_birth_order1/4 | -0.07743 | 0.05693 | -1.36 | 5934 | 0.1738 | -0.2372 | 0.08236 |
fixed | NA | count_birth_order2/4 | 0.04346 | 0.05822 | 0.7466 | 5959 | 0.4554 | -0.12 | 0.2069 |
fixed | NA | count_birth_order3/4 | 0.04852 | 0.0635 | 0.7642 | 5951 | 0.4448 | -0.1297 | 0.2268 |
fixed | NA | count_birth_order4/4 | 0.01437 | 0.06557 | 0.2191 | 5953 | 0.8266 | -0.1697 | 0.1984 |
fixed | NA | count_birth_order1/5 | 0.02045 | 0.06753 | 0.3029 | 5961 | 0.762 | -0.1691 | 0.21 |
fixed | NA | count_birth_order2/5 | 0.05005 | 0.07271 | 0.6884 | 5933 | 0.4912 | -0.154 | 0.2542 |
fixed | NA | count_birth_order3/5 | -0.02403 | 0.07055 | -0.3406 | 5935 | 0.7334 | -0.2221 | 0.174 |
fixed | NA | count_birth_order4/5 | -0.03049 | 0.07305 | -0.4174 | 5915 | 0.6764 | -0.2356 | 0.1746 |
fixed | NA | count_birth_order5/5 | -0.06213 | 0.07291 | -0.8522 | 5922 | 0.3941 | -0.2668 | 0.1425 |
fixed | NA | count_birth_order1/>5 | 0.008191 | 0.06447 | 0.127 | 5961 | 0.8989 | -0.1728 | 0.1892 |
fixed | NA | count_birth_order2/>5 | -0.146 | 0.06705 | -2.177 | 5922 | 0.02949 | -0.3342 | 0.04221 |
fixed | NA | count_birth_order3/>5 | -0.06925 | 0.06562 | -1.055 | 5907 | 0.2913 | -0.2534 | 0.1149 |
fixed | NA | count_birth_order4/>5 | -0.02285 | 0.06336 | -0.3607 | 5909 | 0.7184 | -0.2007 | 0.155 |
fixed | NA | count_birth_order5/>5 | -0.02685 | 0.06489 | -0.4137 | 5852 | 0.6791 | -0.209 | 0.1553 |
fixed | NA | count_birth_order>5/>5 | -0.1068 | 0.04849 | -2.204 | 5614 | 0.02759 | -0.2429 | 0.02925 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3949 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7416 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14783 | 14856 | -7380 | 14761 | NA | NA | NA |
12 | 14784 | 14864 | -7380 | 14760 | 0.7334 | 1 | 0.3918 |
16 | 14788 | 14895 | -7378 | 14756 | 3.844 | 4 | 0.4275 |
26 | 14795 | 14969 | -7371 | 14743 | 13.4 | 10 | 0.202 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5761 | 0.3711 | -1.552 | 5678 | 0.1206 | -1.618 | 0.4656 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09716 | 0.04213 | 2.306 | 5675 | 0.02115 | -0.02111 | 0.2154 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003018 | 0.001504 | -2.006 | 5673 | 0.04491 | -0.007241 | 0.001205 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002451 | 0.00001705 | 1.437 | 5676 | 0.1507 | -0.00002336 | 0.00007238 |
fixed | NA | male | 0.09125 | 0.02161 | 4.222 | 5570 | 0.00002462 | 0.03058 | 0.1519 |
fixed | NA | sibling_count3 | 0.01999 | 0.03422 | 0.5842 | 4169 | 0.5591 | -0.07607 | 0.1161 |
fixed | NA | sibling_count4 | -0.03413 | 0.03724 | -0.9165 | 3759 | 0.3595 | -0.1387 | 0.07041 |
fixed | NA | sibling_count5 | -0.08933 | 0.0442 | -2.021 | 3351 | 0.04336 | -0.2134 | 0.03474 |
fixed | NA | sibling_count>5 | -0.1448 | 0.03831 | -3.779 | 3215 | 0.00016 | -0.2523 | -0.03725 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3902 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7437 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5775 | 0.3712 | -1.556 | 5677 | 0.1198 | -1.619 | 0.4643 |
fixed | NA | birth_order | 0.002238 | 0.007356 | 0.3042 | 5802 | 0.761 | -0.01841 | 0.02289 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.097 | 0.04214 | 2.302 | 5674 | 0.02138 | -0.02129 | 0.2153 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003016 | 0.001505 | -2.004 | 5672 | 0.04508 | -0.007239 | 0.001208 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002458 | 0.00001706 | 1.441 | 5674 | 0.1496 | -0.0000233 | 0.00007246 |
fixed | NA | male | 0.09118 | 0.02162 | 4.218 | 5568 | 0.00002501 | 0.03051 | 0.1519 |
fixed | NA | sibling_count3 | 0.01887 | 0.03442 | 0.5481 | 4174 | 0.5837 | -0.07776 | 0.1155 |
fixed | NA | sibling_count4 | -0.03673 | 0.03821 | -0.9612 | 3791 | 0.3365 | -0.144 | 0.07053 |
fixed | NA | sibling_count5 | -0.09345 | 0.04623 | -2.022 | 3448 | 0.0433 | -0.2232 | 0.03631 |
fixed | NA | sibling_count>5 | -0.1533 | 0.04742 | -3.233 | 3844 | 0.001236 | -0.2864 | -0.02019 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3905 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7437 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6256 | 0.3718 | -1.683 | 5691 | 0.09253 | -1.669 | 0.4181 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1004 | 0.04217 | 2.382 | 5682 | 0.01725 | -0.01792 | 0.2188 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003136 | 0.001506 | -2.083 | 5678 | 0.03731 | -0.007362 | 0.00109 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002589 | 0.00001707 | 1.517 | 5677 | 0.1293 | -0.00002202 | 0.00007381 |
fixed | NA | male | 0.0914 | 0.02162 | 4.228 | 5564 | 0.00002394 | 0.03072 | 0.1521 |
fixed | NA | sibling_count3 | 0.008164 | 0.03508 | 0.2327 | 4353 | 0.816 | -0.09031 | 0.1066 |
fixed | NA | sibling_count4 | -0.05403 | 0.03961 | -1.364 | 4097 | 0.1727 | -0.1652 | 0.05717 |
fixed | NA | sibling_count5 | -0.1078 | 0.04814 | -2.239 | 3804 | 0.02522 | -0.2429 | 0.02735 |
fixed | NA | sibling_count>5 | -0.1591 | 0.04873 | -3.265 | 4097 | 0.001103 | -0.2959 | -0.02233 |
fixed | NA | birth_order_nonlinear2 | 0.06079 | 0.02726 | 2.23 | 4637 | 0.02578 | -0.01572 | 0.1373 |
fixed | NA | birth_order_nonlinear3 | 0.05707 | 0.03379 | 1.689 | 4822 | 0.09131 | -0.03778 | 0.1519 |
fixed | NA | birth_order_nonlinear4 | 0.05315 | 0.04308 | 1.234 | 4972 | 0.2174 | -0.06778 | 0.1741 |
fixed | NA | birth_order_nonlinear5 | 0.02966 | 0.05454 | 0.5438 | 4817 | 0.5866 | -0.1234 | 0.1828 |
fixed | NA | birth_order_nonlinear>5 | 0.02338 | 0.05469 | 0.4275 | 5627 | 0.669 | -0.1301 | 0.1769 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3892 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7441 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6437 | 0.3729 | -1.726 | 5687 | 0.08436 | -1.69 | 0.403 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1026 | 0.04228 | 2.427 | 5675 | 0.01527 | -0.01609 | 0.2213 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003204 | 0.00151 | -2.122 | 5672 | 0.03389 | -0.007443 | 0.001034 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002657 | 0.00001712 | 1.552 | 5673 | 0.1208 | -0.0000215 | 0.00007463 |
fixed | NA | male | 0.09147 | 0.02164 | 4.227 | 5553 | 0.0000241 | 0.03072 | 0.1522 |
fixed | NA | count_birth_order2/2 | 0.05327 | 0.04822 | 1.105 | 4942 | 0.2693 | -0.08207 | 0.1886 |
fixed | NA | count_birth_order1/3 | -0.01454 | 0.04425 | -0.3286 | 5715 | 0.7425 | -0.1388 | 0.1097 |
fixed | NA | count_birth_order2/3 | 0.09972 | 0.04866 | 2.049 | 5781 | 0.04046 | -0.03686 | 0.2363 |
fixed | NA | count_birth_order3/3 | 0.05742 | 0.05341 | 1.075 | 5790 | 0.2824 | -0.0925 | 0.2073 |
fixed | NA | count_birth_order1/4 | -0.0668 | 0.05467 | -1.222 | 5776 | 0.2219 | -0.2203 | 0.08668 |
fixed | NA | count_birth_order2/4 | -0.003471 | 0.05641 | -0.06154 | 5790 | 0.9509 | -0.1618 | 0.1549 |
fixed | NA | count_birth_order3/4 | 0.0155 | 0.05882 | 0.2634 | 5778 | 0.7922 | -0.1496 | 0.1806 |
fixed | NA | count_birth_order4/4 | 0.004197 | 0.06202 | 0.06768 | 5767 | 0.946 | -0.1699 | 0.1783 |
fixed | NA | count_birth_order1/5 | -0.05474 | 0.07389 | -0.7408 | 5789 | 0.4588 | -0.2621 | 0.1527 |
fixed | NA | count_birth_order2/5 | -0.04276 | 0.08163 | -0.5239 | 5725 | 0.6004 | -0.2719 | 0.1864 |
fixed | NA | count_birth_order3/5 | -0.04845 | 0.07764 | -0.624 | 5735 | 0.5326 | -0.2664 | 0.1695 |
fixed | NA | count_birth_order4/5 | -0.07973 | 0.07529 | -1.059 | 5758 | 0.2897 | -0.2911 | 0.1316 |
fixed | NA | count_birth_order5/5 | -0.1367 | 0.07946 | -1.72 | 5737 | 0.08545 | -0.3597 | 0.08636 |
fixed | NA | count_birth_order1/>5 | -0.1208 | 0.0752 | -1.607 | 5743 | 0.1081 | -0.3319 | 0.09024 |
fixed | NA | count_birth_order2/>5 | -0.1781 | 0.07448 | -2.391 | 5721 | 0.01683 | -0.3872 | 0.03098 |
fixed | NA | count_birth_order3/>5 | -0.1208 | 0.07353 | -1.643 | 5680 | 0.1004 | -0.3272 | 0.0856 |
fixed | NA | count_birth_order4/>5 | -0.1009 | 0.07186 | -1.404 | 5640 | 0.1603 | -0.3026 | 0.1008 |
fixed | NA | count_birth_order5/>5 | -0.09842 | 0.06622 | -1.486 | 5687 | 0.1372 | -0.2843 | 0.08745 |
fixed | NA | count_birth_order>5/>5 | -0.1381 | 0.0504 | -2.74 | 5392 | 0.006161 | -0.2796 | 0.003369 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3886 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7447 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14356 | 14429 | -7167 | 14334 | NA | NA | NA |
12 | 14358 | 14438 | -7167 | 14334 | 0.09157 | 1 | 0.7622 |
16 | 14360 | 14467 | -7164 | 14328 | 6.1 | 4 | 0.1918 |
26 | 14375 | 14548 | -7161 | 14323 | 5.282 | 10 | 0.8716 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = math_2015_old)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3193 | 0.2143 | 1.49 | 13784 | 0.1362 | -0.2822 | 0.9207 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007294 | 0.02199 | 0.3316 | 13792 | 0.7402 | -0.05444 | 0.06903 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005758 | 0.0007025 | -0.8196 | 13807 | 0.4124 | -0.002548 | 0.001396 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004245 | 0.000007055 | 0.6017 | 13815 | 0.5474 | -0.00001556 | 0.00002405 |
fixed | NA | male | -0.07804 | 0.01633 | -4.778 | 13293 | 0.000001792 | -0.1239 | -0.03219 |
fixed | NA | sibling_count3 | 0.03562 | 0.03434 | 1.037 | 9605 | 0.2997 | -0.06078 | 0.132 |
fixed | NA | sibling_count4 | -0.04503 | 0.03547 | -1.27 | 8825 | 0.2042 | -0.1446 | 0.05452 |
fixed | NA | sibling_count5 | -0.01284 | 0.03704 | -0.3466 | 8040 | 0.7289 | -0.1168 | 0.09114 |
fixed | NA | sibling_count>5 | -0.1715 | 0.02895 | -5.922 | 8946 | 0.000000003304 | -0.2527 | -0.09018 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4447 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.881 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3021 | 0.2145 | 1.409 | 13785 | 0.1589 | -0.2999 | 0.9042 |
fixed | NA | birth_order | -0.006092 | 0.003514 | -1.734 | 13386 | 0.08303 | -0.01596 | 0.003773 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01092 | 0.02209 | 0.4941 | 13820 | 0.6212 | -0.0511 | 0.07293 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007057 | 0.0007065 | -0.9988 | 13848 | 0.3179 | -0.002689 | 0.001278 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005524 | 0.000007093 | 0.7787 | 13856 | 0.4362 | -0.00001439 | 0.00002544 |
fixed | NA | male | -0.07783 | 0.01633 | -4.765 | 13294 | 0.000001906 | -0.1237 | -0.03198 |
fixed | NA | sibling_count3 | 0.03689 | 0.03434 | 1.074 | 9620 | 0.2827 | -0.05951 | 0.1333 |
fixed | NA | sibling_count4 | -0.04087 | 0.03554 | -1.15 | 8893 | 0.2502 | -0.1406 | 0.05889 |
fixed | NA | sibling_count5 | -0.005543 | 0.03727 | -0.1487 | 8162 | 0.8818 | -0.1102 | 0.09907 |
fixed | NA | sibling_count>5 | -0.1485 | 0.03184 | -4.664 | 10121 | 0.000003137 | -0.2378 | -0.05912 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4442 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8811 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3361 | 0.2158 | 1.558 | 13816 | 0.1193 | -0.2696 | 0.9419 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.006561 | 0.02214 | 0.2963 | 13834 | 0.767 | -0.05559 | 0.06871 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005546 | 0.0007086 | -0.7827 | 13859 | 0.4338 | -0.002544 | 0.001435 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004035 | 0.000007122 | 0.5665 | 13869 | 0.571 | -0.00001596 | 0.00002403 |
fixed | NA | male | -0.0781 | 0.01634 | -4.781 | 13289 | 0.000001761 | -0.124 | -0.03225 |
fixed | NA | sibling_count3 | 0.03465 | 0.03477 | 0.9965 | 9939 | 0.319 | -0.06296 | 0.1323 |
fixed | NA | sibling_count4 | -0.05003 | 0.03642 | -1.374 | 9533 | 0.1696 | -0.1523 | 0.05221 |
fixed | NA | sibling_count5 | -0.02144 | 0.03854 | -0.5564 | 8989 | 0.578 | -0.1296 | 0.08673 |
fixed | NA | sibling_count>5 | -0.1731 | 0.03329 | -5.201 | 11107 | 0.0000002017 | -0.2666 | -0.07969 |
fixed | NA | birth_order_nonlinear2 | -0.02299 | 0.02364 | -0.9727 | 12407 | 0.3307 | -0.08935 | 0.04336 |
fixed | NA | birth_order_nonlinear3 | -0.002078 | 0.02775 | -0.07488 | 11992 | 0.9403 | -0.07998 | 0.07583 |
fixed | NA | birth_order_nonlinear4 | 0.01697 | 0.03155 | 0.5378 | 11980 | 0.5907 | -0.0716 | 0.1055 |
fixed | NA | birth_order_nonlinear5 | 0.01641 | 0.03594 | 0.4564 | 11936 | 0.6481 | -0.08449 | 0.1173 |
fixed | NA | birth_order_nonlinear>5 | -0.01964 | 0.03019 | -0.6505 | 13718 | 0.5154 | -0.1044 | 0.0651 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4443 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8812 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3273 | 0.217 | 1.509 | 13830 | 0.1314 | -0.2817 | 0.9363 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.006943 | 0.02219 | 0.3129 | 13840 | 0.7543 | -0.05533 | 0.06922 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005669 | 0.0007105 | -0.7979 | 13862 | 0.425 | -0.002561 | 0.001428 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004164 | 0.000007146 | 0.5828 | 13870 | 0.5601 | -0.00001589 | 0.00002422 |
fixed | NA | male | -0.07788 | 0.01634 | -4.766 | 13281 | 0.0000019 | -0.1238 | -0.03201 |
fixed | NA | count_birth_order2/2 | -0.00982 | 0.04618 | -0.2127 | 12703 | 0.8316 | -0.1394 | 0.1198 |
fixed | NA | count_birth_order1/3 | 0.05031 | 0.04467 | 1.126 | 13464 | 0.2601 | -0.07508 | 0.1757 |
fixed | NA | count_birth_order2/3 | 0.01198 | 0.04969 | 0.2411 | 13653 | 0.8095 | -0.1275 | 0.1515 |
fixed | NA | count_birth_order3/3 | 0.0213 | 0.05561 | 0.3831 | 13805 | 0.7016 | -0.1348 | 0.1774 |
fixed | NA | count_birth_order1/4 | -0.05016 | 0.05062 | -0.9909 | 13664 | 0.3218 | -0.1923 | 0.09194 |
fixed | NA | count_birth_order2/4 | -0.06037 | 0.05338 | -1.131 | 13741 | 0.2581 | -0.2102 | 0.08946 |
fixed | NA | count_birth_order3/4 | -0.03141 | 0.05772 | -0.5442 | 13835 | 0.5863 | -0.1934 | 0.1306 |
fixed | NA | count_birth_order4/4 | -0.04884 | 0.06074 | -0.8041 | 13865 | 0.4213 | -0.2193 | 0.1217 |
fixed | NA | count_birth_order1/5 | -0.05318 | 0.05742 | -0.9263 | 13802 | 0.3543 | -0.2144 | 0.108 |
fixed | NA | count_birth_order2/5 | -0.08221 | 0.06012 | -1.367 | 13844 | 0.1715 | -0.251 | 0.08654 |
fixed | NA | count_birth_order3/5 | 0.01386 | 0.06183 | 0.2241 | 13866 | 0.8227 | -0.1597 | 0.1874 |
fixed | NA | count_birth_order4/5 | 0.01906 | 0.06531 | 0.2918 | 13877 | 0.7704 | -0.1643 | 0.2024 |
fixed | NA | count_birth_order5/5 | 0.05706 | 0.06688 | 0.8531 | 13873 | 0.3936 | -0.1307 | 0.2448 |
fixed | NA | count_birth_order1/>5 | -0.1509 | 0.04641 | -3.251 | 13867 | 0.001153 | -0.2811 | -0.0206 |
fixed | NA | count_birth_order2/>5 | -0.1789 | 0.04772 | -3.75 | 13877 | 0.0001776 | -0.3129 | -0.045 |
fixed | NA | count_birth_order3/>5 | -0.183 | 0.04667 | -3.921 | 13877 | 0.00008855 | -0.314 | -0.05199 |
fixed | NA | count_birth_order4/>5 | -0.1483 | 0.04581 | -3.238 | 13876 | 0.001208 | -0.2769 | -0.01973 |
fixed | NA | count_birth_order5/>5 | -0.1708 | 0.04611 | -3.705 | 13877 | 0.0002124 | -0.3002 | -0.04139 |
fixed | NA | count_birth_order>5/>5 | -0.1879 | 0.03668 | -5.123 | 12289 | 0.0000003045 | -0.2909 | -0.08497 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.444 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8815 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 38695 | 38778 | -19337 | 38673 | NA | NA | NA |
12 | 38694 | 38785 | -19335 | 38670 | 3.008 | 1 | 0.08286 |
16 | 38702 | 38823 | -19335 | 38670 | 0.06628 | 4 | 0.9995 |
26 | 38718 | 38914 | -19333 | 38666 | 4.383 | 10 | 0.9284 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4124 | 0.4482 | -0.92 | 5845 | 0.3576 | -1.671 | 0.8458 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09996 | 0.05087 | 1.965 | 5846 | 0.04947 | -0.04284 | 0.2428 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003619 | 0.001816 | -1.993 | 5850 | 0.04632 | -0.008716 | 0.001478 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003836 | 0.00002057 | 1.865 | 5855 | 0.06226 | -0.00001938 | 0.00009611 |
fixed | NA | male | -0.1536 | 0.02616 | -5.869 | 5765 | 0.000000004617 | -0.227 | -0.08012 |
fixed | NA | sibling_count3 | 0.01062 | 0.04193 | 0.2533 | 4427 | 0.8001 | -0.1071 | 0.1283 |
fixed | NA | sibling_count4 | -0.08796 | 0.04522 | -1.945 | 3988 | 0.05182 | -0.2149 | 0.03898 |
fixed | NA | sibling_count5 | -0.1347 | 0.05191 | -2.594 | 3643 | 0.009518 | -0.2804 | 0.01105 |
fixed | NA | sibling_count>5 | -0.2428 | 0.04561 | -5.325 | 3482 | 0.0000001076 | -0.3708 | -0.1148 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4377 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.923 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4249 | 0.4482 | -0.9481 | 5844 | 0.3431 | -1.683 | 0.8332 |
fixed | NA | birth_order | 0.01582 | 0.008711 | 1.817 | 5914 | 0.06933 | -0.008628 | 0.04028 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09906 | 0.05086 | 1.948 | 5846 | 0.0515 | -0.04371 | 0.2418 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003611 | 0.001816 | -1.989 | 5849 | 0.04676 | -0.008707 | 0.001485 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003891 | 0.00002057 | 1.892 | 5853 | 0.0586 | -0.00001883 | 0.00009665 |
fixed | NA | male | -0.1543 | 0.02616 | -5.898 | 5765 | 0.000000003898 | -0.2277 | -0.08085 |
fixed | NA | sibling_count3 | 0.002788 | 0.04214 | 0.06616 | 4435 | 0.9473 | -0.1155 | 0.1211 |
fixed | NA | sibling_count4 | -0.1064 | 0.04634 | -2.296 | 4008 | 0.02172 | -0.2365 | 0.02368 |
fixed | NA | sibling_count5 | -0.1648 | 0.05449 | -3.024 | 3744 | 0.002508 | -0.3178 | -0.01185 |
fixed | NA | sibling_count>5 | -0.3032 | 0.05643 | -5.374 | 4014 | 0.00000008157 | -0.4616 | -0.1448 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4378 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9227 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4289 | 0.4491 | -0.955 | 5852 | 0.3396 | -1.69 | 0.8317 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1012 | 0.05091 | 1.987 | 5850 | 0.04695 | -0.04174 | 0.2441 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003688 | 0.001817 | -2.029 | 5851 | 0.04247 | -0.008789 | 0.001413 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003982 | 0.00002059 | 1.934 | 5854 | 0.0532 | -0.00001798 | 0.00009762 |
fixed | NA | male | -0.1543 | 0.02617 | -5.895 | 5760 | 0.000000003967 | -0.2277 | -0.0808 |
fixed | NA | sibling_count3 | -0.006667 | 0.04296 | -0.1552 | 4608 | 0.8767 | -0.1273 | 0.1139 |
fixed | NA | sibling_count4 | -0.1178 | 0.04805 | -2.451 | 4313 | 0.01427 | -0.2527 | 0.0171 |
fixed | NA | sibling_count5 | -0.1912 | 0.05708 | -3.35 | 4147 | 0.0008158 | -0.3514 | -0.03098 |
fixed | NA | sibling_count>5 | -0.317 | 0.058 | -5.465 | 4255 | 0.00000004897 | -0.4798 | -0.1542 |
fixed | NA | birth_order_nonlinear2 | 0.02081 | 0.03354 | 0.6204 | 4919 | 0.535 | -0.07334 | 0.115 |
fixed | NA | birth_order_nonlinear3 | 0.07339 | 0.04148 | 1.769 | 5119 | 0.07687 | -0.04303 | 0.1898 |
fixed | NA | birth_order_nonlinear4 | 0.05819 | 0.05138 | 1.132 | 5267 | 0.2575 | -0.08604 | 0.2024 |
fixed | NA | birth_order_nonlinear5 | 0.1455 | 0.06415 | 2.269 | 5115 | 0.02334 | -0.03455 | 0.3256 |
fixed | NA | birth_order_nonlinear>5 | 0.09315 | 0.06484 | 1.437 | 5851 | 0.1509 | -0.08886 | 0.2752 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4367 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9232 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4642 | 0.4503 | -1.031 | 5845 | 0.3026 | -1.728 | 0.7998 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1045 | 0.05104 | 2.048 | 5840 | 0.04057 | -0.03872 | 0.2478 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003813 | 0.001822 | -2.093 | 5842 | 0.03643 | -0.008928 | 0.001302 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004129 | 0.00002065 | 1.999 | 5846 | 0.04563 | -0.00001668 | 0.00009925 |
fixed | NA | male | -0.1531 | 0.0262 | -5.845 | 5749 | 0.000000005357 | -0.2266 | -0.07957 |
fixed | NA | count_birth_order2/2 | 0.03911 | 0.06081 | 0.6432 | 5211 | 0.5201 | -0.1316 | 0.2098 |
fixed | NA | count_birth_order1/3 | 0.004539 | 0.0546 | 0.08314 | 5856 | 0.9337 | -0.1487 | 0.1578 |
fixed | NA | count_birth_order2/3 | 0.02779 | 0.05938 | 0.4679 | 5897 | 0.6399 | -0.1389 | 0.1945 |
fixed | NA | count_birth_order3/3 | 0.05161 | 0.06635 | 0.7778 | 5909 | 0.4367 | -0.1346 | 0.2379 |
fixed | NA | count_birth_order1/4 | -0.1031 | 0.06635 | -1.553 | 5892 | 0.1204 | -0.2893 | 0.08318 |
fixed | NA | count_birth_order2/4 | -0.131 | 0.06871 | -1.907 | 5909 | 0.05654 | -0.3239 | 0.06182 |
fixed | NA | count_birth_order3/4 | -0.03292 | 0.07245 | -0.4543 | 5902 | 0.6496 | -0.2363 | 0.1704 |
fixed | NA | count_birth_order4/4 | -0.02071 | 0.0754 | -0.2747 | 5900 | 0.7836 | -0.2324 | 0.191 |
fixed | NA | count_birth_order1/5 | -0.1396 | 0.09008 | -1.55 | 5907 | 0.1212 | -0.3925 | 0.1133 |
fixed | NA | count_birth_order2/5 | -0.1104 | 0.0965 | -1.144 | 5873 | 0.2527 | -0.3813 | 0.1605 |
fixed | NA | count_birth_order3/5 | -0.06116 | 0.09072 | -0.6741 | 5878 | 0.5003 | -0.3158 | 0.1935 |
fixed | NA | count_birth_order4/5 | -0.2161 | 0.08761 | -2.466 | 5891 | 0.01368 | -0.462 | 0.02986 |
fixed | NA | count_birth_order5/5 | -0.08756 | 0.09067 | -0.9657 | 5878 | 0.3342 | -0.3421 | 0.1669 |
fixed | NA | count_birth_order1/>5 | -0.3657 | 0.08971 | -4.076 | 5887 | 0.00004633 | -0.6175 | -0.1139 |
fixed | NA | count_birth_order2/>5 | -0.3071 | 0.08873 | -3.461 | 5871 | 0.0005426 | -0.5562 | -0.05801 |
fixed | NA | count_birth_order3/>5 | -0.2507 | 0.08883 | -2.822 | 5838 | 0.004793 | -0.5 | -0.001302 |
fixed | NA | count_birth_order4/>5 | -0.2177 | 0.0835 | -2.607 | 5839 | 0.009165 | -0.4521 | 0.01673 |
fixed | NA | count_birth_order5/>5 | -0.1333 | 0.07903 | -1.687 | 5845 | 0.09166 | -0.3552 | 0.08852 |
fixed | NA | count_birth_order>5/>5 | -0.2173 | 0.06012 | -3.614 | 5535 | 0.0003043 | -0.386 | -0.04851 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4363 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9239 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 17008 | 17082 | -8493 | 16986 | NA | NA | NA |
12 | 17007 | 17087 | -8492 | 16983 | 3.304 | 1 | 0.06913 |
16 | 17012 | 17119 | -8490 | 16980 | 3.482 | 4 | 0.4806 |
26 | 17027 | 17200 | -8487 | 16975 | 4.996 | 10 | 0.8914 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3743 | 0.4477 | -0.8361 | 5896 | 0.4031 | -1.631 | 0.8824 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09573 | 0.05083 | 1.883 | 5896 | 0.05971 | -0.04696 | 0.2384 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003491 | 0.001815 | -1.924 | 5899 | 0.05445 | -0.008586 | 0.001603 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003683 | 0.00002057 | 1.791 | 5904 | 0.0734 | -0.0000209 | 0.00009456 |
fixed | NA | male | -0.1544 | 0.02611 | -5.913 | 5811 | 0.000000003555 | -0.2277 | -0.08109 |
fixed | NA | sibling_count3 | 0.02706 | 0.04542 | 0.5958 | 4569 | 0.5513 | -0.1004 | 0.1546 |
fixed | NA | sibling_count4 | -0.07306 | 0.04794 | -1.524 | 4212 | 0.1276 | -0.2076 | 0.0615 |
fixed | NA | sibling_count5 | -0.08228 | 0.05143 | -1.6 | 3875 | 0.1097 | -0.2266 | 0.06207 |
fixed | NA | sibling_count>5 | -0.1821 | 0.04509 | -4.039 | 4006 | 0.00005475 | -0.3087 | -0.05553 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4413 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.924 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3791 | 0.4478 | -0.8465 | 5894 | 0.3973 | -1.636 | 0.8779 |
fixed | NA | birth_order | 0.004275 | 0.007636 | 0.5599 | 5883 | 0.5756 | -0.01716 | 0.02571 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09565 | 0.05084 | 1.882 | 5895 | 0.05994 | -0.04705 | 0.2384 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003495 | 0.001815 | -1.926 | 5897 | 0.05421 | -0.00859 | 0.0016 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003704 | 0.00002057 | 1.801 | 5902 | 0.07182 | -0.0000207 | 0.00009478 |
fixed | NA | male | -0.1546 | 0.02611 | -5.919 | 5811 | 0.000000003432 | -0.2279 | -0.08125 |
fixed | NA | sibling_count3 | 0.02495 | 0.04558 | 0.5475 | 4569 | 0.5841 | -0.103 | 0.1529 |
fixed | NA | sibling_count4 | -0.07783 | 0.04869 | -1.598 | 4210 | 0.11 | -0.2145 | 0.05885 |
fixed | NA | sibling_count5 | -0.08982 | 0.05317 | -1.689 | 3906 | 0.0912 | -0.2391 | 0.05941 |
fixed | NA | sibling_count>5 | -0.1979 | 0.05319 | -3.721 | 4325 | 0.0002013 | -0.3472 | -0.04859 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4415 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.924 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3883 | 0.4486 | -0.8654 | 5902 | 0.3868 | -1.648 | 0.8711 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09661 | 0.05088 | 1.899 | 5897 | 0.05764 | -0.04621 | 0.2394 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003535 | 0.001817 | -1.946 | 5899 | 0.05174 | -0.008635 | 0.001565 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003765 | 0.00002059 | 1.828 | 5903 | 0.06754 | -0.00002015 | 0.00009545 |
fixed | NA | male | -0.1548 | 0.02612 | -5.928 | 5806 | 0.000000003245 | -0.2282 | -0.08152 |
fixed | NA | sibling_count3 | 0.01383 | 0.04637 | 0.2983 | 4713 | 0.7655 | -0.1163 | 0.144 |
fixed | NA | sibling_count4 | -0.09552 | 0.05032 | -1.898 | 4474 | 0.05772 | -0.2368 | 0.04573 |
fixed | NA | sibling_count5 | -0.1103 | 0.05558 | -1.984 | 4271 | 0.04728 | -0.2663 | 0.04573 |
fixed | NA | sibling_count>5 | -0.2216 | 0.05474 | -4.048 | 4571 | 0.00005241 | -0.3753 | -0.06796 |
fixed | NA | birth_order_nonlinear2 | 0.02009 | 0.03426 | 0.5864 | 5042 | 0.5576 | -0.07609 | 0.1163 |
fixed | NA | birth_order_nonlinear3 | 0.05782 | 0.04142 | 1.396 | 5231 | 0.1628 | -0.05846 | 0.1741 |
fixed | NA | birth_order_nonlinear4 | 0.05083 | 0.04996 | 1.018 | 5390 | 0.3089 | -0.0894 | 0.1911 |
fixed | NA | birth_order_nonlinear5 | 0.0438 | 0.06117 | 0.716 | 5309 | 0.474 | -0.1279 | 0.2155 |
fixed | NA | birth_order_nonlinear>5 | 0.05985 | 0.05819 | 1.029 | 5960 | 0.3037 | -0.1035 | 0.2232 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4413 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9242 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4364 | 0.4495 | -0.9708 | 5896 | 0.3317 | -1.698 | 0.8255 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1003 | 0.05096 | 1.969 | 5888 | 0.04902 | -0.04271 | 0.2434 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003676 | 0.00182 | -2.02 | 5890 | 0.04343 | -0.008785 | 0.001432 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003931 | 0.00002063 | 1.906 | 5895 | 0.05675 | -0.0000186 | 0.00009723 |
fixed | NA | male | -0.1557 | 0.02614 | -5.956 | 5795 | 0.00000000273 | -0.229 | -0.08231 |
fixed | NA | count_birth_order2/2 | 0.07481 | 0.06677 | 1.12 | 5335 | 0.2626 | -0.1126 | 0.2622 |
fixed | NA | count_birth_order1/3 | 0.06574 | 0.05921 | 1.11 | 5908 | 0.267 | -0.1005 | 0.232 |
fixed | NA | count_birth_order2/3 | 0.007638 | 0.06399 | 0.1194 | 5947 | 0.905 | -0.172 | 0.1873 |
fixed | NA | count_birth_order3/3 | 0.08768 | 0.07201 | 1.218 | 5962 | 0.2234 | -0.1145 | 0.2898 |
fixed | NA | count_birth_order1/4 | -0.1036 | 0.06955 | -1.49 | 5943 | 0.1363 | -0.2989 | 0.0916 |
fixed | NA | count_birth_order2/4 | -0.03628 | 0.07118 | -0.5097 | 5960 | 0.6103 | -0.2361 | 0.1635 |
fixed | NA | count_birth_order3/4 | -0.02561 | 0.07771 | -0.3295 | 5954 | 0.7418 | -0.2437 | 0.1925 |
fixed | NA | count_birth_order4/4 | -0.006286 | 0.08024 | -0.07833 | 5955 | 0.9376 | -0.2315 | 0.219 |
fixed | NA | count_birth_order1/5 | -0.007333 | 0.08258 | -0.0888 | 5961 | 0.9292 | -0.2391 | 0.2245 |
fixed | NA | count_birth_order2/5 | -0.07043 | 0.08902 | -0.7912 | 5943 | 0.4288 | -0.3203 | 0.1794 |
fixed | NA | count_birth_order3/5 | 0.01048 | 0.08637 | 0.1213 | 5944 | 0.9034 | -0.232 | 0.2529 |
fixed | NA | count_birth_order4/5 | -0.1567 | 0.08947 | -1.752 | 5929 | 0.07989 | -0.4078 | 0.09442 |
fixed | NA | count_birth_order5/5 | -0.09262 | 0.08928 | -1.037 | 5933 | 0.2996 | -0.3432 | 0.158 |
fixed | NA | count_birth_order1/>5 | -0.2681 | 0.07886 | -3.399 | 5962 | 0.00068 | -0.4894 | -0.0467 |
fixed | NA | count_birth_order2/>5 | -0.1808 | 0.0821 | -2.202 | 5938 | 0.02769 | -0.4113 | 0.04966 |
fixed | NA | count_birth_order3/>5 | -0.1727 | 0.08036 | -2.149 | 5926 | 0.03167 | -0.3983 | 0.05287 |
fixed | NA | count_birth_order4/>5 | -0.09252 | 0.0776 | -1.192 | 5925 | 0.2332 | -0.3103 | 0.1253 |
fixed | NA | count_birth_order5/>5 | -0.128 | 0.07952 | -1.61 | 5885 | 0.1075 | -0.3512 | 0.09521 |
fixed | NA | count_birth_order>5/>5 | -0.1425 | 0.05907 | -2.413 | 5628 | 0.01584 | -0.3083 | 0.02325 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4412 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9243 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 17187 | 17261 | -8583 | 17165 | NA | NA | NA |
12 | 17189 | 17269 | -8582 | 17165 | 0.3133 | 1 | 0.5757 |
16 | 17195 | 17302 | -8581 | 17163 | 2.203 | 4 | 0.6986 |
26 | 17205 | 17379 | -8577 | 17153 | 9.439 | 10 | 0.491 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5356 | 0.4544 | -1.179 | 5726 | 0.2386 | -1.811 | 0.7399 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1138 | 0.05159 | 2.206 | 5726 | 0.0274 | -0.03099 | 0.2587 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004171 | 0.001842 | -2.264 | 5728 | 0.02359 | -0.009342 | 0.0009998 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004509 | 0.00002088 | 2.16 | 5733 | 0.03084 | -0.00001352 | 0.0001037 |
fixed | NA | male | -0.1506 | 0.02649 | -5.685 | 5646 | 0.0000000137 | -0.2249 | -0.07623 |
fixed | NA | sibling_count3 | 0.01379 | 0.04149 | 0.3323 | 4340 | 0.7397 | -0.1027 | 0.1303 |
fixed | NA | sibling_count4 | -0.06312 | 0.04509 | -1.4 | 3922 | 0.1616 | -0.1897 | 0.06344 |
fixed | NA | sibling_count5 | -0.1219 | 0.05343 | -2.282 | 3498 | 0.02258 | -0.2719 | 0.02808 |
fixed | NA | sibling_count>5 | -0.2157 | 0.04628 | -4.662 | 3343 | 0.00000326 | -0.3457 | -0.08583 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4422 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9234 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5462 | 0.4544 | -1.202 | 5725 | 0.2294 | -1.822 | 0.7292 |
fixed | NA | birth_order | 0.01591 | 0.008989 | 1.77 | 5803 | 0.07671 | -0.009318 | 0.04115 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1127 | 0.05159 | 2.185 | 5726 | 0.0289 | -0.03207 | 0.2575 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004158 | 0.001842 | -2.258 | 5727 | 0.02401 | -0.009328 | 0.001012 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000456 | 0.00002088 | 2.184 | 5731 | 0.02902 | -0.00001301 | 0.0001042 |
fixed | NA | male | -0.151 | 0.02648 | -5.703 | 5645 | 0.00000001235 | -0.2254 | -0.0767 |
fixed | NA | sibling_count3 | 0.005873 | 0.04173 | 0.1408 | 4346 | 0.8881 | -0.1113 | 0.123 |
fixed | NA | sibling_count4 | -0.08142 | 0.04625 | -1.76 | 3953 | 0.0784 | -0.2112 | 0.0484 |
fixed | NA | sibling_count5 | -0.1509 | 0.05588 | -2.701 | 3591 | 0.006953 | -0.3078 | 0.005945 |
fixed | NA | sibling_count>5 | -0.2759 | 0.0574 | -4.806 | 3956 | 0.000001597 | -0.437 | -0.1147 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4423 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9231 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5386 | 0.4552 | -1.183 | 5733 | 0.2368 | -1.816 | 0.7392 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1138 | 0.05163 | 2.205 | 5729 | 0.02753 | -0.03111 | 0.2587 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004199 | 0.001843 | -2.278 | 5729 | 0.02276 | -0.009374 | 0.000975 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004613 | 0.0000209 | 2.207 | 5731 | 0.02733 | -0.00001253 | 0.0001048 |
fixed | NA | male | -0.1512 | 0.02649 | -5.709 | 5640 | 0.00000001192 | -0.2256 | -0.07688 |
fixed | NA | sibling_count3 | -0.002021 | 0.04257 | -0.04749 | 4520 | 0.9621 | -0.1215 | 0.1175 |
fixed | NA | sibling_count4 | -0.09644 | 0.04802 | -2.008 | 4255 | 0.0447 | -0.2312 | 0.03837 |
fixed | NA | sibling_count5 | -0.1759 | 0.0583 | -3.017 | 3950 | 0.002569 | -0.3395 | -0.01224 |
fixed | NA | sibling_count>5 | -0.2909 | 0.05907 | -4.924 | 4212 | 0.0000008797 | -0.4567 | -0.1251 |
fixed | NA | birth_order_nonlinear2 | 0.01337 | 0.03353 | 0.3987 | 4805 | 0.6901 | -0.08075 | 0.1075 |
fixed | NA | birth_order_nonlinear3 | 0.06506 | 0.04154 | 1.566 | 4981 | 0.1174 | -0.05154 | 0.1817 |
fixed | NA | birth_order_nonlinear4 | 0.08177 | 0.05293 | 1.545 | 5123 | 0.1225 | -0.06681 | 0.2303 |
fixed | NA | birth_order_nonlinear5 | 0.1201 | 0.06705 | 1.791 | 4995 | 0.07334 | -0.06812 | 0.3083 |
fixed | NA | birth_order_nonlinear>5 | 0.09651 | 0.06699 | 1.441 | 5696 | 0.1497 | -0.09153 | 0.2845 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4415 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9236 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5806 | 0.4565 | -1.272 | 5727 | 0.2035 | -1.862 | 0.7009 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1187 | 0.05177 | 2.292 | 5721 | 0.02193 | -0.02665 | 0.264 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004378 | 0.001849 | -2.368 | 5722 | 0.0179 | -0.009568 | 0.0008111 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004819 | 0.00002096 | 2.299 | 5725 | 0.02154 | -0.00001065 | 0.000107 |
fixed | NA | male | -0.15 | 0.02652 | -5.658 | 5629 | 0.00000001609 | -0.2245 | -0.0756 |
fixed | NA | count_birth_order2/2 | 0.01536 | 0.05925 | 0.2592 | 5053 | 0.7955 | -0.1509 | 0.1817 |
fixed | NA | count_birth_order1/3 | 0.003387 | 0.05402 | 0.0627 | 5738 | 0.95 | -0.1482 | 0.155 |
fixed | NA | count_birth_order2/3 | 0.008751 | 0.05945 | 0.1472 | 5784 | 0.883 | -0.1581 | 0.1756 |
fixed | NA | count_birth_order3/3 | 0.05884 | 0.06529 | 0.9012 | 5790 | 0.3675 | -0.1244 | 0.2421 |
fixed | NA | count_birth_order1/4 | -0.09925 | 0.06679 | -1.486 | 5780 | 0.1373 | -0.2867 | 0.08823 |
fixed | NA | count_birth_order2/4 | -0.123 | 0.06896 | -1.783 | 5790 | 0.07458 | -0.3165 | 0.07059 |
fixed | NA | count_birth_order3/4 | 0.001164 | 0.07194 | 0.01618 | 5781 | 0.9871 | -0.2008 | 0.2031 |
fixed | NA | count_birth_order4/4 | 0.008341 | 0.07586 | 0.11 | 5773 | 0.9125 | -0.2046 | 0.2213 |
fixed | NA | count_birth_order1/5 | -0.123 | 0.09033 | -1.361 | 5790 | 0.1735 | -0.3765 | 0.1306 |
fixed | NA | count_birth_order2/5 | -0.0875 | 0.0999 | -0.8758 | 5745 | 0.3812 | -0.3679 | 0.1929 |
fixed | NA | count_birth_order3/5 | -0.0931 | 0.09501 | -0.9799 | 5751 | 0.3272 | -0.3598 | 0.1736 |
fixed | NA | count_birth_order4/5 | -0.1781 | 0.09211 | -1.934 | 5767 | 0.05316 | -0.4367 | 0.08042 |
fixed | NA | count_birth_order5/5 | -0.11 | 0.09724 | -1.131 | 5751 | 0.2581 | -0.383 | 0.163 |
fixed | NA | count_birth_order1/>5 | -0.3524 | 0.09201 | -3.83 | 5761 | 0.0001293 | -0.6107 | -0.09416 |
fixed | NA | count_birth_order2/>5 | -0.2463 | 0.09116 | -2.702 | 5745 | 0.006907 | -0.5022 | 0.009553 |
fixed | NA | count_birth_order3/>5 | -0.2817 | 0.09003 | -3.129 | 5714 | 0.001761 | -0.5345 | -0.02901 |
fixed | NA | count_birth_order4/>5 | -0.1651 | 0.08801 | -1.876 | 5683 | 0.06067 | -0.4122 | 0.08192 |
fixed | NA | count_birth_order5/>5 | -0.1366 | 0.08107 | -1.685 | 5715 | 0.09204 | -0.3642 | 0.09096 |
fixed | NA | count_birth_order>5/>5 | -0.1927 | 0.06138 | -3.139 | 5405 | 0.001704 | -0.365 | -0.02038 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4406 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9244 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16690 | 16763 | -8334 | 16668 | NA | NA | NA |
12 | 16689 | 16769 | -8332 | 16665 | 3.138 | 1 | 0.07648 |
16 | 16695 | 16801 | -8331 | 16663 | 2.443 | 4 | 0.6549 |
26 | 16709 | 16882 | -8329 | 16657 | 5.429 | 10 | 0.8607 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = raven_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.913 | 0.1161 | -25.09 | 11555 | 2.58e-135 | -3.239 | -2.587 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4204 | 0.02155 | 19.5 | 11680 | 2.191e-83 | 0.3599 | 0.4809 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01677 | 0.00125 | -13.41 | 11811 | 1.002e-40 | -0.02028 | -0.01326 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000206 | 0.00002297 | 8.97 | 11829 | 3.408e-19 | 0.0001416 | 0.0002705 |
fixed | NA | male | 0.04925 | 0.01654 | 2.977 | 11006 | 0.002914 | 0.002818 | 0.09569 |
fixed | NA | sibling_count3 | -0.03514 | 0.02866 | -1.226 | 7714 | 0.2202 | -0.1156 | 0.0453 |
fixed | NA | sibling_count4 | -0.08887 | 0.03214 | -2.765 | 7047 | 0.005701 | -0.1791 | 0.001339 |
fixed | NA | sibling_count5 | -0.07689 | 0.03636 | -2.115 | 6427 | 0.03447 | -0.1789 | 0.02516 |
fixed | NA | sibling_count>5 | -0.244 | 0.02882 | -8.467 | 7187 | 3.014e-17 | -0.3249 | -0.1631 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5099 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.786 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.899 | 0.1165 | -24.88 | 11582 | 3.297e-133 | -3.226 | -2.572 |
fixed | NA | birth_order | -0.006508 | 0.004435 | -1.467 | 9943 | 0.1423 | -0.01896 | 0.00594 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4199 | 0.02156 | 19.48 | 11679 | 3.334e-83 | 0.3594 | 0.4804 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01677 | 0.00125 | -13.41 | 11810 | 1.04e-40 | -0.02028 | -0.01326 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002058 | 0.00002297 | 8.96 | 11828 | 3.716e-19 | 0.0001413 | 0.0002703 |
fixed | NA | male | 0.04936 | 0.01654 | 2.984 | 11007 | 0.002855 | 0.002922 | 0.09579 |
fixed | NA | sibling_count3 | -0.03129 | 0.02878 | -1.087 | 7689 | 0.2769 | -0.1121 | 0.04949 |
fixed | NA | sibling_count4 | -0.07961 | 0.03275 | -2.431 | 6933 | 0.01508 | -0.1715 | 0.01231 |
fixed | NA | sibling_count5 | -0.06196 | 0.03775 | -1.641 | 6268 | 0.1007 | -0.1679 | 0.044 |
fixed | NA | sibling_count>5 | -0.2073 | 0.03816 | -5.432 | 6679 | 0.0000000577 | -0.3144 | -0.1002 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5097 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7861 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.907 | 0.1177 | -24.7 | 11650 | 2.209e-131 | -3.237 | -2.577 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4201 | 0.02164 | 19.42 | 11706 | 1.131e-82 | 0.3593 | 0.4808 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01679 | 0.001252 | -13.41 | 11810 | 1.118e-40 | -0.0203 | -0.01327 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002063 | 0.00002299 | 8.976 | 11824 | 3.216e-19 | 0.0001418 | 0.0002709 |
fixed | NA | male | 0.04912 | 0.01655 | 2.969 | 11003 | 0.002995 | 0.002679 | 0.09557 |
fixed | NA | sibling_count3 | -0.03626 | 0.02964 | -1.223 | 8172 | 0.2213 | -0.1195 | 0.04694 |
fixed | NA | sibling_count4 | -0.08243 | 0.03527 | -2.337 | 7997 | 0.01945 | -0.1814 | 0.01657 |
fixed | NA | sibling_count5 | -0.05136 | 0.04155 | -1.236 | 7548 | 0.2164 | -0.168 | 0.06526 |
fixed | NA | sibling_count>5 | -0.1992 | 0.04201 | -4.74 | 8504 | 0.000002171 | -0.3171 | -0.08122 |
fixed | NA | birth_order_nonlinear2 | -0.0004814 | 0.02252 | -0.02137 | 9154 | 0.983 | -0.06371 | 0.06275 |
fixed | NA | birth_order_nonlinear3 | 0.007394 | 0.02843 | 0.2601 | 9816 | 0.7948 | -0.0724 | 0.08719 |
fixed | NA | birth_order_nonlinear4 | -0.02942 | 0.03523 | -0.835 | 10040 | 0.4037 | -0.1283 | 0.06948 |
fixed | NA | birth_order_nonlinear5 | -0.06717 | 0.04142 | -1.622 | 10362 | 0.1049 | -0.1834 | 0.0491 |
fixed | NA | birth_order_nonlinear>5 | -0.05048 | 0.03943 | -1.28 | 11825 | 0.2005 | -0.1612 | 0.06021 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.51 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.786 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.913 | 0.1186 | -24.56 | 11674 | 7.1e-130 | -3.246 | -2.58 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4217 | 0.02167 | 19.46 | 11712 | 5.229e-83 | 0.3609 | 0.4826 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01689 | 0.001254 | -13.47 | 11803 | 4.996e-41 | -0.0204 | -0.01337 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000208 | 0.00002301 | 9.043 | 11813 | 1.755e-19 | 0.0001435 | 0.0002726 |
fixed | NA | male | 0.04874 | 0.01655 | 2.945 | 10994 | 0.003232 | 0.002289 | 0.09519 |
fixed | NA | count_birth_order2/2 | -0.004616 | 0.0367 | -0.1258 | 9686 | 0.8999 | -0.1076 | 0.09841 |
fixed | NA | count_birth_order1/3 | -0.06756 | 0.03753 | -1.8 | 11550 | 0.07182 | -0.1729 | 0.03777 |
fixed | NA | count_birth_order2/3 | -0.03873 | 0.03826 | -1.012 | 11657 | 0.3115 | -0.1461 | 0.06869 |
fixed | NA | count_birth_order3/3 | 0.02046 | 0.04332 | 0.4722 | 11790 | 0.6368 | -0.1012 | 0.1421 |
fixed | NA | count_birth_order1/4 | -0.06759 | 0.05129 | -1.318 | 11816 | 0.1876 | -0.2116 | 0.07639 |
fixed | NA | count_birth_order2/4 | -0.04354 | 0.04874 | -0.8935 | 11815 | 0.3716 | -0.1803 | 0.09326 |
fixed | NA | count_birth_order3/4 | -0.1544 | 0.04591 | -3.362 | 11784 | 0.0007749 | -0.2833 | -0.0255 |
fixed | NA | count_birth_order4/4 | -0.07384 | 0.05012 | -1.473 | 11817 | 0.1406 | -0.2145 | 0.06683 |
fixed | NA | count_birth_order1/5 | 0.0104 | 0.0696 | 0.1495 | 11533 | 0.8812 | -0.185 | 0.2058 |
fixed | NA | count_birth_order2/5 | -0.08665 | 0.06625 | -1.308 | 11634 | 0.1909 | -0.2726 | 0.09932 |
fixed | NA | count_birth_order3/5 | -0.01868 | 0.06002 | -0.3112 | 11768 | 0.7557 | -0.1872 | 0.1498 |
fixed | NA | count_birth_order4/5 | -0.1326 | 0.05643 | -2.35 | 11815 | 0.01879 | -0.291 | 0.02579 |
fixed | NA | count_birth_order5/5 | -0.1062 | 0.05597 | -1.897 | 11816 | 0.05781 | -0.2633 | 0.05091 |
fixed | NA | count_birth_order1/>5 | -0.1548 | 0.0697 | -2.221 | 11101 | 0.0264 | -0.3504 | 0.04088 |
fixed | NA | count_birth_order2/>5 | -0.2376 | 0.06527 | -3.64 | 11201 | 0.000274 | -0.4208 | -0.05436 |
fixed | NA | count_birth_order3/>5 | -0.1763 | 0.0581 | -3.035 | 11506 | 0.002412 | -0.3394 | -0.01323 |
fixed | NA | count_birth_order4/>5 | -0.2312 | 0.05287 | -4.372 | 11629 | 0.0000124 | -0.3796 | -0.08276 |
fixed | NA | count_birth_order5/>5 | -0.2756 | 0.0475 | -5.802 | 11774 | 0.00000000672 | -0.4089 | -0.1423 |
fixed | NA | count_birth_order>5/>5 | -0.2508 | 0.03316 | -7.564 | 10427 | 4.239e-14 | -0.3439 | -0.1577 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5098 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7859 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 31548 | 31629 | -15763 | 31526 | NA | NA | NA |
12 | 31548 | 31636 | -15762 | 31524 | 2.156 | 1 | 0.142 |
16 | 31554 | 31672 | -15761 | 31522 | 2.168 | 4 | 0.705 |
26 | 31560 | 31752 | -15754 | 31508 | 14.05 | 10 | 0.1707 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.135 | 0.1776 | -17.65 | 6969 | 3.073e-68 | -3.634 | -2.637 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4673 | 0.03646 | 12.82 | 6899 | 3.477e-37 | 0.365 | 0.5696 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01963 | 0.00231 | -8.494 | 6902 | 2.413e-17 | -0.02611 | -0.01314 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002649 | 0.0000455 | 5.821 | 6905 | 0.000000006115 | 0.0001371 | 0.0003926 |
fixed | NA | male | 0.03061 | 0.01923 | 1.592 | 7906 | 0.1115 | -0.02338 | 0.0846 |
fixed | NA | sibling_count3 | -0.05946 | 0.02726 | -2.182 | 5246 | 0.02919 | -0.136 | 0.01705 |
fixed | NA | sibling_count4 | -0.1194 | 0.03344 | -3.571 | 4564 | 0.0003592 | -0.2133 | -0.02555 |
fixed | NA | sibling_count5 | -0.2169 | 0.04292 | -5.054 | 4129 | 0.0000004515 | -0.3374 | -0.09643 |
fixed | NA | sibling_count>5 | -0.2597 | 0.03991 | -6.508 | 4298 | 0.00000000008506 | -0.3718 | -0.1477 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4912 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7717 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.103 | 0.1799 | -17.25 | 7201 | 2.301e-65 | -3.608 | -2.598 |
fixed | NA | birth_order | -0.009805 | 0.008629 | -1.136 | 8264 | 0.2559 | -0.03403 | 0.01442 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4643 | 0.03656 | 12.7 | 6958 | 1.483e-36 | 0.3617 | 0.5669 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01948 | 0.002314 | -8.417 | 6927 | 4.631e-17 | -0.02597 | -0.01298 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002623 | 0.00004557 | 5.756 | 6926 | 0.000000008997 | 0.0001344 | 0.0003902 |
fixed | NA | male | 0.0307 | 0.01923 | 1.596 | 7907 | 0.1105 | -0.02329 | 0.0847 |
fixed | NA | sibling_count3 | -0.05286 | 0.02786 | -1.897 | 5212 | 0.05782 | -0.1311 | 0.02534 |
fixed | NA | sibling_count4 | -0.1048 | 0.03583 | -2.924 | 4584 | 0.003471 | -0.2054 | -0.004197 |
fixed | NA | sibling_count5 | -0.1926 | 0.04793 | -4.018 | 4318 | 0.0000596 | -0.3271 | -0.05806 |
fixed | NA | sibling_count>5 | -0.2124 | 0.05769 | -3.682 | 5150 | 0.0002337 | -0.3744 | -0.05049 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4907 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7719 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.137 | 0.1795 | -17.48 | 7152 | 5.132e-67 | -3.64 | -2.633 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4676 | 0.03657 | 12.79 | 6956 | 5.175e-37 | 0.3649 | 0.5703 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01965 | 0.002314 | -8.493 | 6918 | 2.445e-17 | -0.02615 | -0.01316 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002655 | 0.00004556 | 5.826 | 6921 | 0.000000005938 | 0.0001375 | 0.0003934 |
fixed | NA | male | 0.02997 | 0.01924 | 1.558 | 7903 | 0.1193 | -0.02403 | 0.08397 |
fixed | NA | sibling_count3 | -0.0652 | 0.02908 | -2.242 | 5705 | 0.02498 | -0.1468 | 0.01642 |
fixed | NA | sibling_count4 | -0.1234 | 0.03863 | -3.194 | 5346 | 0.001412 | -0.2318 | -0.01495 |
fixed | NA | sibling_count5 | -0.1819 | 0.05257 | -3.459 | 5238 | 0.0005461 | -0.3294 | -0.03428 |
fixed | NA | sibling_count>5 | -0.2346 | 0.06227 | -3.768 | 5989 | 0.0001662 | -0.4094 | -0.05983 |
fixed | NA | birth_order_nonlinear2 | 0.0033 | 0.02304 | 0.1432 | 6116 | 0.8861 | -0.06137 | 0.06797 |
fixed | NA | birth_order_nonlinear3 | 0.0203 | 0.03226 | 0.6294 | 7022 | 0.5291 | -0.07024 | 0.1108 |
fixed | NA | birth_order_nonlinear4 | -0.002993 | 0.04418 | -0.06775 | 7409 | 0.946 | -0.127 | 0.121 |
fixed | NA | birth_order_nonlinear5 | -0.1088 | 0.05943 | -1.831 | 7381 | 0.06711 | -0.2756 | 0.05799 |
fixed | NA | birth_order_nonlinear>5 | -0.01069 | 0.06881 | -0.1554 | 8447 | 0.8765 | -0.2038 | 0.1825 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4915 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7716 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.146 | 0.1802 | -17.46 | 7170 | 7.311e-67 | -3.652 | -2.64 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4697 | 0.03664 | 12.82 | 6956 | 3.382e-37 | 0.3669 | 0.5726 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01981 | 0.002319 | -8.545 | 6912 | 1.564e-17 | -0.02632 | -0.01331 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000269 | 0.00004566 | 5.891 | 6911 | 0.00000000402 | 0.0001408 | 0.0003972 |
fixed | NA | male | 0.03042 | 0.01924 | 1.581 | 7884 | 0.1139 | -0.02359 | 0.08443 |
fixed | NA | count_birth_order2/2 | 0.006774 | 0.03232 | 0.2096 | 6664 | 0.834 | -0.08394 | 0.09749 |
fixed | NA | count_birth_order1/3 | -0.08009 | 0.038 | -2.108 | 8391 | 0.0351 | -0.1868 | 0.02658 |
fixed | NA | count_birth_order2/3 | -0.07185 | 0.03655 | -1.966 | 8401 | 0.04936 | -0.1745 | 0.03075 |
fixed | NA | count_birth_order3/3 | -0.01001 | 0.04001 | -0.2501 | 8438 | 0.8025 | -0.1223 | 0.1023 |
fixed | NA | count_birth_order1/4 | -0.04987 | 0.05992 | -0.8323 | 8326 | 0.4052 | -0.2181 | 0.1183 |
fixed | NA | count_birth_order2/4 | -0.09864 | 0.05259 | -1.876 | 8435 | 0.06075 | -0.2463 | 0.04899 |
fixed | NA | count_birth_order3/4 | -0.1871 | 0.05021 | -3.726 | 8436 | 0.0001958 | -0.328 | -0.04614 |
fixed | NA | count_birth_order4/4 | -0.1056 | 0.04973 | -2.124 | 8446 | 0.03372 | -0.2452 | 0.03398 |
fixed | NA | count_birth_order1/5 | -0.2007 | 0.1043 | -1.924 | 7369 | 0.05443 | -0.4936 | 0.09218 |
fixed | NA | count_birth_order2/5 | -0.146 | 0.09299 | -1.57 | 7769 | 0.1164 | -0.407 | 0.115 |
fixed | NA | count_birth_order3/5 | -0.08258 | 0.07873 | -1.049 | 8171 | 0.2943 | -0.3036 | 0.1384 |
fixed | NA | count_birth_order4/5 | -0.2497 | 0.06518 | -3.83 | 8440 | 0.0001288 | -0.4326 | -0.0667 |
fixed | NA | count_birth_order5/5 | -0.2776 | 0.06325 | -4.388 | 8446 | 0.00001155 | -0.4551 | -0.1 |
fixed | NA | count_birth_order1/>5 | -0.268 | 0.1333 | -2.01 | 6843 | 0.04445 | -0.6422 | 0.1062 |
fixed | NA | count_birth_order2/>5 | -0.262 | 0.122 | -2.148 | 6913 | 0.03172 | -0.6044 | 0.08034 |
fixed | NA | count_birth_order3/>5 | -0.2095 | 0.1009 | -2.077 | 7561 | 0.03784 | -0.4927 | 0.07364 |
fixed | NA | count_birth_order4/>5 | -0.179 | 0.09054 | -1.977 | 7764 | 0.04811 | -0.4331 | 0.07518 |
fixed | NA | count_birth_order5/>5 | -0.359 | 0.07278 | -4.933 | 8225 | 0.0000008267 | -0.5633 | -0.1547 |
fixed | NA | count_birth_order>5/>5 | -0.244 | 0.04847 | -5.033 | 7297 | 0.0000004942 | -0.38 | -0.1079 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4921 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7711 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 22246 | 22323 | -11112 | 22224 | NA | NA | NA |
12 | 22246 | 22331 | -11111 | 22222 | 1.293 | 1 | 0.2554 |
16 | 22250 | 22363 | -11109 | 22218 | 4.165 | 4 | 0.3842 |
26 | 22259 | 22442 | -11103 | 22207 | 11.6 | 10 | 0.3129 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.141 | 0.177 | -17.75 | 7058 | 5.705e-69 | -3.638 | -2.644 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4677 | 0.03633 | 12.87 | 6968 | 1.719e-37 | 0.3657 | 0.5697 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01973 | 0.002303 | -8.564 | 6967 | 1.324e-17 | -0.02619 | -0.01326 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002666 | 0.00004538 | 5.876 | 6968 | 0.000000004403 | 0.0001393 | 0.000394 |
fixed | NA | male | 0.02784 | 0.01915 | 1.454 | 7992 | 0.1461 | -0.02592 | 0.0816 |
fixed | NA | sibling_count3 | -0.04184 | 0.0286 | -1.463 | 5531 | 0.1435 | -0.1221 | 0.03843 |
fixed | NA | sibling_count4 | -0.07294 | 0.03364 | -2.168 | 4993 | 0.03018 | -0.1674 | 0.02149 |
fixed | NA | sibling_count5 | -0.08591 | 0.03944 | -2.178 | 4612 | 0.02944 | -0.1966 | 0.0248 |
fixed | NA | sibling_count>5 | -0.1944 | 0.03514 | -5.532 | 4639 | 0.00000003339 | -0.2931 | -0.09576 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4946 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7717 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.082 | 0.1787 | -17.25 | 7233 | 2.258e-65 | -3.583 | -2.58 |
fixed | NA | birth_order | -0.0174 | 0.007239 | -2.404 | 8279 | 0.01625 | -0.03772 | 0.002919 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4622 | 0.0364 | 12.7 | 7010 | 1.553e-36 | 0.36 | 0.5644 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01947 | 0.002306 | -8.443 | 6984 | 3.712e-17 | -0.02594 | -0.013 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002621 | 0.00004541 | 5.772 | 6983 | 0.000000008185 | 0.0001346 | 0.0003896 |
fixed | NA | male | 0.02841 | 0.01915 | 1.484 | 7995 | 0.1379 | -0.02534 | 0.08217 |
fixed | NA | sibling_count3 | -0.03073 | 0.02895 | -1.062 | 5517 | 0.2884 | -0.112 | 0.05053 |
fixed | NA | sibling_count4 | -0.04801 | 0.03518 | -1.364 | 4998 | 0.1725 | -0.1468 | 0.05075 |
fixed | NA | sibling_count5 | -0.04672 | 0.04264 | -1.096 | 4706 | 0.2733 | -0.1664 | 0.07298 |
fixed | NA | sibling_count>5 | -0.1149 | 0.04825 | -2.381 | 5317 | 0.01728 | -0.2503 | 0.02053 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4935 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.772 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.112 | 0.1786 | -17.42 | 7207 | 1.296e-66 | -3.613 | -2.61 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4643 | 0.03643 | 12.75 | 7008 | 8.484e-37 | 0.362 | 0.5665 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01959 | 0.002306 | -8.495 | 6975 | 2.4e-17 | -0.02607 | -0.01312 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002645 | 0.00004542 | 5.823 | 6976 | 0.000000006049 | 0.000137 | 0.000392 |
fixed | NA | male | 0.0276 | 0.01915 | 1.441 | 7990 | 0.1496 | -0.02617 | 0.08137 |
fixed | NA | sibling_count3 | -0.03796 | 0.0301 | -1.261 | 5961 | 0.2073 | -0.1225 | 0.04653 |
fixed | NA | sibling_count4 | -0.05896 | 0.03796 | -1.553 | 5744 | 0.1204 | -0.1655 | 0.04758 |
fixed | NA | sibling_count5 | -0.03642 | 0.0465 | -0.7831 | 5574 | 0.4336 | -0.1669 | 0.09412 |
fixed | NA | sibling_count>5 | -0.1248 | 0.05121 | -2.436 | 6161 | 0.01487 | -0.2685 | 0.01899 |
fixed | NA | birth_order_nonlinear2 | -0.01198 | 0.02373 | -0.5048 | 6214 | 0.6137 | -0.07858 | 0.05462 |
fixed | NA | birth_order_nonlinear3 | -0.00978 | 0.03163 | -0.3092 | 7225 | 0.7572 | -0.09856 | 0.079 |
fixed | NA | birth_order_nonlinear4 | -0.03695 | 0.04151 | -0.8903 | 7595 | 0.3734 | -0.1535 | 0.07956 |
fixed | NA | birth_order_nonlinear5 | -0.132 | 0.05216 | -2.532 | 7529 | 0.01138 | -0.2784 | 0.01437 |
fixed | NA | birth_order_nonlinear>5 | -0.08421 | 0.05662 | -1.487 | 8540 | 0.137 | -0.2431 | 0.07472 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4944 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7717 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.121 | 0.1796 | -17.38 | 7231 | 2.423e-66 | -3.625 | -2.617 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.467 | 0.03649 | 12.8 | 7014 | 4.397e-37 | 0.3646 | 0.5694 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0198 | 0.00231 | -8.57 | 6970 | 1.262e-17 | -0.02628 | -0.01331 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000269 | 0.00004549 | 5.914 | 6965 | 0.000000003502 | 0.0001413 | 0.0003967 |
fixed | NA | male | 0.02854 | 0.01916 | 1.489 | 7974 | 0.1364 | -0.02525 | 0.08233 |
fixed | NA | count_birth_order2/2 | -0.01543 | 0.03533 | -0.4366 | 6716 | 0.6624 | -0.1146 | 0.08375 |
fixed | NA | count_birth_order1/3 | -0.06278 | 0.03938 | -1.594 | 8494 | 0.1109 | -0.1733 | 0.04776 |
fixed | NA | count_birth_order2/3 | -0.05192 | 0.03852 | -1.348 | 8511 | 0.1777 | -0.16 | 0.0562 |
fixed | NA | count_birth_order3/3 | -0.0183 | 0.04222 | -0.4335 | 8538 | 0.6647 | -0.1368 | 0.1002 |
fixed | NA | count_birth_order1/4 | -0.05623 | 0.05864 | -0.9588 | 8481 | 0.3377 | -0.2208 | 0.1084 |
fixed | NA | count_birth_order2/4 | -0.0529 | 0.05265 | -1.005 | 8530 | 0.3151 | -0.2007 | 0.0949 |
fixed | NA | count_birth_order3/4 | -0.1333 | 0.0504 | -2.644 | 8539 | 0.008209 | -0.2747 | 0.008219 |
fixed | NA | count_birth_order4/4 | -0.05557 | 0.05097 | -1.09 | 8548 | 0.2756 | -0.1987 | 0.08751 |
fixed | NA | count_birth_order1/5 | 0.07905 | 0.08526 | 0.9271 | 7943 | 0.3539 | -0.1603 | 0.3184 |
fixed | NA | count_birth_order2/5 | -0.03706 | 0.07632 | -0.4856 | 8242 | 0.6273 | -0.2513 | 0.1772 |
fixed | NA | count_birth_order3/5 | -0.03526 | 0.06854 | -0.5144 | 8385 | 0.607 | -0.2277 | 0.1571 |
fixed | NA | count_birth_order4/5 | -0.1447 | 0.06314 | -2.291 | 8484 | 0.02196 | -0.3219 | 0.03255 |
fixed | NA | count_birth_order5/5 | -0.1711 | 0.06082 | -2.813 | 8548 | 0.004927 | -0.3418 | -0.0003337 |
fixed | NA | count_birth_order1/>5 | -0.1041 | 0.09126 | -1.14 | 7671 | 0.2542 | -0.3603 | 0.1521 |
fixed | NA | count_birth_order2/>5 | -0.2198 | 0.1014 | -2.167 | 7149 | 0.03023 | -0.5043 | 0.06484 |
fixed | NA | count_birth_order3/>5 | -0.1055 | 0.07852 | -1.344 | 7935 | 0.1789 | -0.3259 | 0.1149 |
fixed | NA | count_birth_order4/>5 | -0.1646 | 0.07207 | -2.283 | 8091 | 0.02243 | -0.3669 | 0.03774 |
fixed | NA | count_birth_order5/>5 | -0.2587 | 0.06275 | -4.123 | 8328 | 0.00003776 | -0.4349 | -0.08258 |
fixed | NA | count_birth_order>5/>5 | -0.2101 | 0.04393 | -4.782 | 7699 | 0.000001765 | -0.3334 | -0.08677 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4947 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7716 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 22545 | 22623 | -11262 | 22523 | NA | NA | NA |
12 | 22542 | 22626 | -11259 | 22518 | 5.783 | 1 | 0.01618 |
16 | 22548 | 22661 | -11258 | 22516 | 1.276 | 4 | 0.8654 |
26 | 22558 | 22742 | -11253 | 22506 | 9.852 | 10 | 0.4535 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.112 | 0.1791 | -17.38 | 6789 | 3.385e-66 | -3.615 | -2.609 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4625 | 0.03675 | 12.58 | 6728 | 6.582e-36 | 0.3593 | 0.5656 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0194 | 0.002327 | -8.337 | 6734 | 9.142e-17 | -0.02594 | -0.01287 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002614 | 0.00004581 | 5.706 | 6739 | 0.00000001203 | 0.0001328 | 0.00039 |
fixed | NA | male | 0.03031 | 0.01944 | 1.559 | 7696 | 0.1189 | -0.02425 | 0.08487 |
fixed | NA | sibling_count3 | -0.04685 | 0.02732 | -1.715 | 5100 | 0.08647 | -0.1235 | 0.02984 |
fixed | NA | sibling_count4 | -0.09949 | 0.0338 | -2.944 | 4416 | 0.003262 | -0.1944 | -0.004613 |
fixed | NA | sibling_count5 | -0.2019 | 0.04473 | -4.514 | 4008 | 0.000006538 | -0.3275 | -0.07636 |
fixed | NA | sibling_count>5 | -0.2519 | 0.04129 | -6.1 | 4167 | 0.000000001156 | -0.3678 | -0.136 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4914 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7689 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.086 | 0.1816 | -17 | 7021 | 1.622e-63 | -3.596 | -2.577 |
fixed | NA | birth_order | -0.00767 | 0.008849 | -0.8668 | 8133 | 0.3861 | -0.03251 | 0.01717 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.46 | 0.03687 | 12.48 | 6788 | 2.442e-35 | 0.3565 | 0.5634 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01928 | 0.002332 | -8.267 | 6760 | 1.636e-16 | -0.02583 | -0.01273 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002592 | 0.00004589 | 5.648 | 6760 | 0.00000001688 | 0.0001304 | 0.000388 |
fixed | NA | male | 0.03038 | 0.01944 | 1.563 | 7697 | 0.1181 | -0.02418 | 0.08494 |
fixed | NA | sibling_count3 | -0.04173 | 0.02795 | -1.493 | 5076 | 0.1354 | -0.1202 | 0.03671 |
fixed | NA | sibling_count4 | -0.08812 | 0.03625 | -2.431 | 4466 | 0.01511 | -0.1899 | 0.01365 |
fixed | NA | sibling_count5 | -0.1833 | 0.04961 | -3.695 | 4215 | 0.0002223 | -0.3226 | -0.04407 |
fixed | NA | sibling_count>5 | -0.2153 | 0.05902 | -3.649 | 5066 | 0.0002662 | -0.381 | -0.04967 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4911 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7691 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.115 | 0.181 | -17.21 | 6973 | 5.081e-65 | -3.623 | -2.607 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4631 | 0.03688 | 12.56 | 6789 | 9.093e-36 | 0.3596 | 0.5667 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01947 | 0.002332 | -8.347 | 6757 | 8.441e-17 | -0.02601 | -0.01292 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002629 | 0.00004589 | 5.729 | 6764 | 0.00000001057 | 0.0001341 | 0.0003917 |
fixed | NA | male | 0.03004 | 0.01944 | 1.545 | 7692 | 0.1223 | -0.02452 | 0.08461 |
fixed | NA | sibling_count3 | -0.04791 | 0.02914 | -1.644 | 5555 | 0.1002 | -0.1297 | 0.0339 |
fixed | NA | sibling_count4 | -0.102 | 0.03901 | -2.615 | 5218 | 0.008942 | -0.2115 | 0.007483 |
fixed | NA | sibling_count5 | -0.1672 | 0.05419 | -3.085 | 5048 | 0.002047 | -0.3193 | -0.01506 |
fixed | NA | sibling_count>5 | -0.2479 | 0.06378 | -3.887 | 5853 | 0.0001026 | -0.427 | -0.06888 |
fixed | NA | birth_order_nonlinear2 | 0.003997 | 0.02302 | 0.1737 | 5944 | 0.8621 | -0.06062 | 0.06861 |
fixed | NA | birth_order_nonlinear3 | 0.003994 | 0.03243 | 0.1232 | 6780 | 0.902 | -0.08704 | 0.09503 |
fixed | NA | birth_order_nonlinear4 | 0.006891 | 0.04507 | 0.1529 | 7110 | 0.8785 | -0.1196 | 0.1334 |
fixed | NA | birth_order_nonlinear5 | -0.1106 | 0.06204 | -1.782 | 7190 | 0.07473 | -0.2847 | 0.06357 |
fixed | NA | birth_order_nonlinear>5 | 0.02731 | 0.07101 | 0.3846 | 8210 | 0.7005 | -0.172 | 0.2266 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4917 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7688 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.121 | 0.1818 | -17.17 | 6983 | 8.982e-65 | -3.632 | -2.611 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4648 | 0.03695 | 12.58 | 6782 | 6.807e-36 | 0.3611 | 0.5685 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01959 | 0.002337 | -8.384 | 6743 | 6.16e-17 | -0.02615 | -0.01303 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002656 | 0.00004598 | 5.776 | 6745 | 0.000000007998 | 0.0001365 | 0.0003946 |
fixed | NA | male | 0.03075 | 0.01944 | 1.582 | 7672 | 0.1137 | -0.02382 | 0.08532 |
fixed | NA | count_birth_order2/2 | 0.001768 | 0.03197 | 0.0553 | 6418 | 0.9559 | -0.08796 | 0.0915 |
fixed | NA | count_birth_order1/3 | -0.06413 | 0.03815 | -1.681 | 8172 | 0.09279 | -0.1712 | 0.04296 |
fixed | NA | count_birth_order2/3 | -0.05242 | 0.03664 | -1.431 | 8180 | 0.1526 | -0.1553 | 0.05044 |
fixed | NA | count_birth_order3/3 | -0.0167 | 0.04017 | -0.4156 | 8217 | 0.6777 | -0.1295 | 0.09606 |
fixed | NA | count_birth_order1/4 | -0.0457 | 0.06025 | -0.7585 | 8115 | 0.4481 | -0.2148 | 0.1234 |
fixed | NA | count_birth_order2/4 | -0.07186 | 0.05325 | -1.349 | 8208 | 0.1772 | -0.2213 | 0.07762 |
fixed | NA | count_birth_order3/4 | -0.1843 | 0.05056 | -3.645 | 8213 | 0.0002691 | -0.3262 | -0.04236 |
fixed | NA | count_birth_order4/4 | -0.07292 | 0.05041 | -1.447 | 8224 | 0.148 | -0.2144 | 0.06857 |
fixed | NA | count_birth_order1/5 | -0.1909 | 0.1042 | -1.832 | 7330 | 0.06699 | -0.4835 | 0.1016 |
fixed | NA | count_birth_order2/5 | -0.1379 | 0.09972 | -1.383 | 7456 | 0.1667 | -0.4178 | 0.142 |
fixed | NA | count_birth_order3/5 | -0.07514 | 0.0808 | -0.9299 | 8008 | 0.3524 | -0.302 | 0.1517 |
fixed | NA | count_birth_order4/5 | -0.2494 | 0.06853 | -3.639 | 8214 | 0.0002757 | -0.4417 | -0.05699 |
fixed | NA | count_birth_order5/5 | -0.2528 | 0.06699 | -3.774 | 8224 | 0.0001619 | -0.4409 | -0.06477 |
fixed | NA | count_birth_order1/>5 | -0.2926 | 0.1343 | -2.179 | 6611 | 0.02934 | -0.6695 | 0.08428 |
fixed | NA | count_birth_order2/>5 | -0.2989 | 0.1239 | -2.412 | 6839 | 0.01588 | -0.6467 | 0.04891 |
fixed | NA | count_birth_order3/>5 | -0.2104 | 0.1014 | -2.076 | 7472 | 0.03795 | -0.495 | 0.07413 |
fixed | NA | count_birth_order4/>5 | -0.1581 | 0.09617 | -1.644 | 7459 | 0.1001 | -0.4281 | 0.1118 |
fixed | NA | count_birth_order5/>5 | -0.3945 | 0.07643 | -5.161 | 7979 | 0.0000002513 | -0.609 | -0.1799 |
fixed | NA | count_birth_order>5/>5 | -0.2215 | 0.05033 | -4.401 | 7128 | 0.00001093 | -0.3628 | -0.08024 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4926 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7681 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 21616 | 21693 | -10797 | 21594 | NA | NA | NA |
12 | 21617 | 21701 | -10796 | 21593 | 0.753 | 1 | 0.3855 |
16 | 21620 | 21732 | -10794 | 21588 | 4.805 | 4 | 0.3079 |
26 | 21627 | 21810 | -10788 | 21575 | 12.77 | 10 | 0.2369 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = math_2015_young)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.466 | 0.1215 | -20.3 | 11620 | 4.621e-90 | -2.807 | -2.125 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4048 | 0.02252 | 17.97 | 11708 | 2.803e-71 | 0.3416 | 0.468 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01815 | 0.001303 | -13.93 | 11808 | 8.797e-44 | -0.02181 | -0.0145 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002515 | 0.00002388 | 10.53 | 11832 | 8.169e-26 | 0.0001845 | 0.0003185 |
fixed | NA | male | -0.1617 | 0.01737 | -9.306 | 11421 | 1.566e-20 | -0.2104 | -0.1129 |
fixed | NA | sibling_count3 | -0.003588 | 0.02894 | -0.124 | 7959 | 0.9013 | -0.08483 | 0.07765 |
fixed | NA | sibling_count4 | -0.08819 | 0.03232 | -2.729 | 7151 | 0.00637 | -0.1789 | 0.002524 |
fixed | NA | sibling_count5 | -0.04881 | 0.0364 | -1.341 | 6386 | 0.18 | -0.151 | 0.05337 |
fixed | NA | sibling_count>5 | -0.2076 | 0.02899 | -7.16 | 7116 | 8.847e-13 | -0.2889 | -0.1262 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4412 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.857 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.454 | 0.1219 | -20.14 | 11640 | 1.067e-88 | -2.796 | -2.112 |
fixed | NA | birth_order | -0.00565 | 0.004521 | -1.25 | 9229 | 0.2115 | -0.01834 | 0.007042 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4044 | 0.02252 | 17.95 | 11706 | 4.06e-71 | 0.3411 | 0.4676 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01814 | 0.001303 | -13.93 | 11806 | 9.745e-44 | -0.0218 | -0.01449 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002512 | 0.00002388 | 10.52 | 11831 | 9.269e-26 | 0.0001842 | 0.0003183 |
fixed | NA | male | -0.1616 | 0.01737 | -9.302 | 11421 | 1.629e-20 | -0.2104 | -0.1128 |
fixed | NA | sibling_count3 | -0.000338 | 0.02905 | -0.01163 | 7928 | 0.9907 | -0.08189 | 0.08122 |
fixed | NA | sibling_count4 | -0.08042 | 0.0329 | -2.444 | 7013 | 0.01454 | -0.1728 | 0.01194 |
fixed | NA | sibling_count5 | -0.03629 | 0.03775 | -0.9613 | 6187 | 0.3365 | -0.1423 | 0.06968 |
fixed | NA | sibling_count>5 | -0.1764 | 0.03825 | -4.612 | 6410 | 0.00000406 | -0.2838 | -0.06904 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4408 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8571 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.481 | 0.1229 | -20.18 | 11694 | 5.025e-89 | -2.826 | -2.135 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4066 | 0.02259 | 18 | 11728 | 1.712e-71 | 0.3432 | 0.47 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01824 | 0.001304 | -13.98 | 11807 | 4.62e-44 | -0.0219 | -0.01457 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002523 | 0.00002389 | 10.56 | 11827 | 5.96e-26 | 0.0001853 | 0.0003194 |
fixed | NA | male | -0.1618 | 0.01737 | -9.315 | 11416 | 1.447e-20 | -0.2106 | -0.113 |
fixed | NA | sibling_count3 | -0.01878 | 0.03001 | -0.6259 | 8433 | 0.5314 | -0.103 | 0.06545 |
fixed | NA | sibling_count4 | -0.09841 | 0.03565 | -2.76 | 8109 | 0.005791 | -0.1985 | 0.001673 |
fixed | NA | sibling_count5 | -0.04989 | 0.04188 | -1.191 | 7489 | 0.2335 | -0.1674 | 0.06766 |
fixed | NA | sibling_count>5 | -0.1826 | 0.04255 | -4.29 | 8265 | 0.00001806 | -0.302 | -0.06311 |
fixed | NA | birth_order_nonlinear2 | 0.01111 | 0.02393 | 0.4642 | 9512 | 0.6425 | -0.05606 | 0.07827 |
fixed | NA | birth_order_nonlinear3 | 0.06162 | 0.03008 | 2.048 | 10195 | 0.04056 | -0.02283 | 0.1461 |
fixed | NA | birth_order_nonlinear4 | -0.02853 | 0.03724 | -0.7662 | 10438 | 0.4436 | -0.1331 | 0.07599 |
fixed | NA | birth_order_nonlinear5 | -0.008226 | 0.04369 | -0.1883 | 10754 | 0.8507 | -0.1309 | 0.1144 |
fixed | NA | birth_order_nonlinear>5 | -0.03737 | 0.04097 | -0.912 | 11786 | 0.3618 | -0.1524 | 0.07764 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4416 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8566 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.495 | 0.1239 | -20.13 | 11707 | 1.24e-88 | -2.843 | -2.147 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4073 | 0.02263 | 18 | 11731 | 1.786e-71 | 0.3438 | 0.4709 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01828 | 0.001306 | -13.99 | 11800 | 3.917e-44 | -0.02194 | -0.01461 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002531 | 0.00002392 | 10.58 | 11817 | 4.758e-26 | 0.000186 | 0.0003202 |
fixed | NA | male | -0.1617 | 0.01738 | -9.306 | 11410 | 1.575e-20 | -0.2105 | -0.1129 |
fixed | NA | count_birth_order2/2 | 0.0442 | 0.0389 | 1.136 | 9894 | 0.256 | -0.06501 | 0.1534 |
fixed | NA | count_birth_order1/3 | 0.003874 | 0.03882 | 0.09977 | 11677 | 0.9205 | -0.1051 | 0.1129 |
fixed | NA | count_birth_order2/3 | 0.01011 | 0.03964 | 0.2552 | 11737 | 0.7986 | -0.1012 | 0.1214 |
fixed | NA | count_birth_order3/3 | 0.02486 | 0.04499 | 0.5525 | 11805 | 0.5806 | -0.1014 | 0.1512 |
fixed | NA | count_birth_order1/4 | -0.09987 | 0.05334 | -1.872 | 11816 | 0.06118 | -0.2496 | 0.04986 |
fixed | NA | count_birth_order2/4 | -0.08891 | 0.05068 | -1.754 | 11817 | 0.07938 | -0.2312 | 0.05334 |
fixed | NA | count_birth_order3/4 | -0.031 | 0.04767 | -0.6502 | 11803 | 0.5156 | -0.1648 | 0.1028 |
fixed | NA | count_birth_order4/4 | -0.0841 | 0.05214 | -1.613 | 11816 | 0.1067 | -0.2305 | 0.06225 |
fixed | NA | count_birth_order1/5 | -0.03411 | 0.07281 | -0.4685 | 11659 | 0.6394 | -0.2385 | 0.1703 |
fixed | NA | count_birth_order2/5 | -0.04574 | 0.06923 | -0.6606 | 11708 | 0.5089 | -0.2401 | 0.1486 |
fixed | NA | count_birth_order3/5 | 0.04814 | 0.06259 | 0.7691 | 11784 | 0.4418 | -0.1276 | 0.2238 |
fixed | NA | count_birth_order4/5 | -0.1116 | 0.05873 | -1.9 | 11814 | 0.05743 | -0.2765 | 0.05326 |
fixed | NA | count_birth_order5/5 | -0.01722 | 0.05821 | -0.2958 | 11817 | 0.7674 | -0.1806 | 0.1462 |
fixed | NA | count_birth_order1/>5 | -0.1167 | 0.07317 | -1.595 | 11436 | 0.1107 | -0.3221 | 0.08866 |
fixed | NA | count_birth_order2/>5 | -0.2274 | 0.06847 | -3.322 | 11490 | 0.0008975 | -0.4196 | -0.03524 |
fixed | NA | count_birth_order3/>5 | -0.06418 | 0.06079 | -1.056 | 11658 | 0.2911 | -0.2348 | 0.1065 |
fixed | NA | count_birth_order4/>5 | -0.1983 | 0.05525 | -3.589 | 11720 | 0.0003331 | -0.3534 | -0.04321 |
fixed | NA | count_birth_order5/>5 | -0.1984 | 0.04952 | -4.007 | 11794 | 0.00006199 | -0.3374 | -0.0594 |
fixed | NA | count_birth_order>5/>5 | -0.209 | 0.03399 | -6.149 | 10554 | 0.0000000008089 | -0.3044 | -0.1136 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4408 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8571 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 32480 | 32561 | -16229 | 32458 | NA | NA | NA |
12 | 32480 | 32569 | -16228 | 32456 | 1.564 | 1 | 0.2111 |
16 | 32480 | 32598 | -16224 | 32448 | 7.826 | 4 | 0.09815 |
26 | 32494 | 32686 | -16221 | 32442 | 6.537 | 10 | 0.7683 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.104 | 0.1915 | -16.21 | 7417 | 4.273e-58 | -3.642 | -2.567 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5371 | 0.03932 | 13.66 | 7380 | 5.565e-42 | 0.4268 | 0.6475 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02639 | 0.002491 | -10.59 | 7396 | 4.852e-26 | -0.03339 | -0.0194 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004132 | 0.00004907 | 8.422 | 7408 | 4.397e-17 | 0.0002755 | 0.000551 |
fixed | NA | male | -0.1782 | 0.0206 | -8.647 | 8178 | 6.295e-18 | -0.236 | -0.1203 |
fixed | NA | sibling_count3 | -0.004614 | 0.02826 | -0.1633 | 5422 | 0.8703 | -0.08395 | 0.07472 |
fixed | NA | sibling_count4 | -0.0559 | 0.03451 | -1.62 | 4621 | 0.1054 | -0.1528 | 0.04097 |
fixed | NA | sibling_count5 | -0.1578 | 0.04412 | -3.575 | 4100 | 0.0003541 | -0.2816 | -0.03389 |
fixed | NA | sibling_count>5 | -0.2106 | 0.04109 | -5.126 | 4237 | 0.0000003098 | -0.3259 | -0.09526 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4467 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8555 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.11 | 0.1937 | -16.06 | 7596 | 4.176e-57 | -3.654 | -2.567 |
fixed | NA | birth_order | 0.001986 | 0.009122 | 0.2177 | 8089 | 0.8276 | -0.02362 | 0.02759 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5377 | 0.03941 | 13.64 | 7423 | 6.926e-42 | 0.4271 | 0.6483 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02642 | 0.002495 | -10.59 | 7414 | 5.039e-26 | -0.03343 | -0.01942 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004138 | 0.00004912 | 8.423 | 7423 | 4.379e-17 | 0.0002759 | 0.0005517 |
fixed | NA | male | -0.1782 | 0.0206 | -8.647 | 8177 | 6.298e-18 | -0.236 | -0.1203 |
fixed | NA | sibling_count3 | -0.005917 | 0.02889 | -0.2048 | 5377 | 0.8377 | -0.08702 | 0.07518 |
fixed | NA | sibling_count4 | -0.05879 | 0.03699 | -1.589 | 4607 | 0.112 | -0.1626 | 0.04504 |
fixed | NA | sibling_count5 | -0.1626 | 0.04936 | -3.293 | 4248 | 0.0009976 | -0.3011 | -0.02401 |
fixed | NA | sibling_count>5 | -0.22 | 0.05974 | -3.683 | 4985 | 0.000233 | -0.3877 | -0.05233 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4468 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8555 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.126 | 0.1933 | -16.18 | 7553 | 6.955e-58 | -3.669 | -2.584 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5394 | 0.03943 | 13.68 | 7421 | 4.39e-42 | 0.4287 | 0.65 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02653 | 0.002495 | -10.63 | 7407 | 3.295e-26 | -0.03353 | -0.01952 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004159 | 0.00004913 | 8.465 | 7420 | 3.048e-17 | 0.000278 | 0.0005538 |
fixed | NA | male | -0.1786 | 0.02061 | -8.664 | 8175 | 5.425e-18 | -0.2364 | -0.1207 |
fixed | NA | sibling_count3 | -0.00646 | 0.03024 | -0.2136 | 5876 | 0.8309 | -0.09135 | 0.07843 |
fixed | NA | sibling_count4 | -0.05353 | 0.04007 | -1.336 | 5368 | 0.1816 | -0.166 | 0.05895 |
fixed | NA | sibling_count5 | -0.1354 | 0.05447 | -2.485 | 5132 | 0.01299 | -0.2882 | 0.01755 |
fixed | NA | sibling_count>5 | -0.2334 | 0.06479 | -3.603 | 5696 | 0.0003171 | -0.4153 | -0.05158 |
fixed | NA | birth_order_nonlinear2 | 0.02891 | 0.02498 | 1.157 | 6415 | 0.2472 | -0.04121 | 0.09903 |
fixed | NA | birth_order_nonlinear3 | 0.004704 | 0.03478 | 0.1352 | 7295 | 0.8924 | -0.09294 | 0.1023 |
fixed | NA | birth_order_nonlinear4 | -0.002522 | 0.04752 | -0.05308 | 7690 | 0.9577 | -0.1359 | 0.1309 |
fixed | NA | birth_order_nonlinear5 | -0.04888 | 0.06391 | -0.7648 | 7734 | 0.4444 | -0.2283 | 0.1305 |
fixed | NA | birth_order_nonlinear>5 | 0.07078 | 0.07314 | 0.9677 | 8425 | 0.3332 | -0.1345 | 0.2761 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.447 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8554 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.134 | 0.1942 | -16.14 | 7569 | 1.232e-57 | -3.679 | -2.589 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5388 | 0.03953 | 13.63 | 7426 | 8.181e-42 | 0.4279 | 0.6498 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0265 | 0.002502 | -10.59 | 7408 | 5.046e-26 | -0.03352 | -0.01947 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004153 | 0.00004926 | 8.43 | 7417 | 4.116e-17 | 0.000277 | 0.0005536 |
fixed | NA | male | -0.1777 | 0.02062 | -8.619 | 8162 | 8.038e-18 | -0.2356 | -0.1199 |
fixed | NA | count_birth_order2/2 | 0.05606 | 0.03495 | 1.604 | 6889 | 0.1088 | -0.04205 | 0.1542 |
fixed | NA | count_birth_order1/3 | 0.03115 | 0.04032 | 0.7725 | 8415 | 0.4398 | -0.08204 | 0.1443 |
fixed | NA | count_birth_order2/3 | 0.02824 | 0.0388 | 0.7279 | 8425 | 0.4667 | -0.08067 | 0.1372 |
fixed | NA | count_birth_order3/3 | -0.01949 | 0.04253 | -0.4582 | 8444 | 0.6468 | -0.1389 | 0.09989 |
fixed | NA | count_birth_order1/4 | -0.082 | 0.06396 | -1.282 | 8381 | 0.1999 | -0.2615 | 0.09755 |
fixed | NA | count_birth_order2/4 | -0.06803 | 0.05601 | -1.215 | 8439 | 0.2245 | -0.2252 | 0.08919 |
fixed | NA | count_birth_order3/4 | -0.009767 | 0.05347 | -0.1827 | 8438 | 0.8551 | -0.1599 | 0.1403 |
fixed | NA | count_birth_order4/4 | -0.007113 | 0.05289 | -0.1345 | 8447 | 0.893 | -0.1556 | 0.1414 |
fixed | NA | count_birth_order1/5 | -0.079 | 0.1123 | -0.7037 | 7786 | 0.4816 | -0.3941 | 0.2361 |
fixed | NA | count_birth_order2/5 | -0.0711 | 0.09979 | -0.7125 | 8036 | 0.4762 | -0.3512 | 0.209 |
fixed | NA | count_birth_order3/5 | -0.07822 | 0.08421 | -0.9289 | 8281 | 0.353 | -0.3146 | 0.1582 |
fixed | NA | count_birth_order4/5 | -0.1583 | 0.0694 | -2.281 | 8440 | 0.02256 | -0.3531 | 0.03648 |
fixed | NA | count_birth_order5/5 | -0.192 | 0.06727 | -2.855 | 8447 | 0.00432 | -0.3808 | -0.003196 |
fixed | NA | count_birth_order1/>5 | -0.1892 | 0.1439 | -1.315 | 7433 | 0.1886 | -0.593 | 0.2147 |
fixed | NA | count_birth_order2/>5 | -0.1647 | 0.1316 | -1.252 | 7474 | 0.2105 | -0.5341 | 0.2046 |
fixed | NA | count_birth_order3/>5 | -0.2041 | 0.1084 | -1.883 | 7920 | 0.05978 | -0.5083 | 0.1002 |
fixed | NA | count_birth_order4/>5 | -0.3053 | 0.09716 | -3.142 | 8039 | 0.001684 | -0.578 | -0.03255 |
fixed | NA | count_birth_order5/>5 | -0.2496 | 0.07779 | -3.208 | 8316 | 0.001341 | -0.4679 | -0.03121 |
fixed | NA | count_birth_order>5/>5 | -0.1526 | 0.05088 | -2.999 | 7313 | 0.00272 | -0.2954 | -0.009756 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.446 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8561 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 23286 | 23364 | -11632 | 23264 | NA | NA | NA |
12 | 23288 | 23373 | -11632 | 23264 | 0.04718 | 1 | 0.828 |
16 | 23292 | 23405 | -11630 | 23260 | 4.367 | 4 | 0.3586 |
26 | 23305 | 23489 | -11627 | 23253 | 6.595 | 10 | 0.7631 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.094 | 0.1905 | -16.24 | 7523 | 2.541e-58 | -3.628 | -2.559 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5341 | 0.03912 | 13.65 | 7470 | 6.124e-42 | 0.4243 | 0.6439 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02625 | 0.00248 | -10.58 | 7484 | 5.384e-26 | -0.03321 | -0.01929 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004103 | 0.00004886 | 8.398 | 7495 | 5.374e-17 | 0.0002732 | 0.0005474 |
fixed | NA | male | -0.1813 | 0.02048 | -8.849 | 8275 | 1.062e-18 | -0.2388 | -0.1238 |
fixed | NA | sibling_count3 | 0.01962 | 0.02964 | 0.6619 | 5744 | 0.5081 | -0.06358 | 0.1028 |
fixed | NA | sibling_count4 | -0.04539 | 0.03474 | -1.307 | 5116 | 0.1914 | -0.1429 | 0.05212 |
fixed | NA | sibling_count5 | -0.05441 | 0.0406 | -1.34 | 4649 | 0.1803 | -0.1684 | 0.05956 |
fixed | NA | sibling_count>5 | -0.1553 | 0.03618 | -4.292 | 4658 | 0.00001809 | -0.2569 | -0.05372 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4484 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8547 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.063 | 0.1921 | -15.94 | 7656 | 2.648e-56 | -3.602 | -2.523 |
fixed | NA | birth_order | -0.009473 | 0.007631 | -1.241 | 8058 | 0.2145 | -0.03089 | 0.01195 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5313 | 0.03919 | 13.56 | 7501 | 2.249e-41 | 0.4213 | 0.6413 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02611 | 0.002483 | -10.52 | 7496 | 1.084e-25 | -0.03308 | -0.01914 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004079 | 0.0000489 | 8.342 | 7505 | 8.62e-17 | 0.0002706 | 0.0005452 |
fixed | NA | male | -0.181 | 0.02048 | -8.835 | 8275 | 1.203e-18 | -0.2385 | -0.1235 |
fixed | NA | sibling_count3 | 0.02553 | 0.03001 | 0.8508 | 5719 | 0.3949 | -0.05871 | 0.1098 |
fixed | NA | sibling_count4 | -0.0321 | 0.03634 | -0.8832 | 5090 | 0.3772 | -0.1341 | 0.06992 |
fixed | NA | sibling_count5 | -0.03351 | 0.04394 | -0.7625 | 4701 | 0.4458 | -0.1569 | 0.08985 |
fixed | NA | sibling_count>5 | -0.1126 | 0.04991 | -2.256 | 5220 | 0.02408 | -0.2527 | 0.02748 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4477 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.855 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.096 | 0.192 | -16.12 | 7629 | 1.584e-57 | -3.635 | -2.557 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5334 | 0.03921 | 13.61 | 7495 | 1.165e-41 | 0.4234 | 0.6435 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02621 | 0.002483 | -10.56 | 7485 | 7.226e-26 | -0.03318 | -0.01924 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004093 | 0.00004889 | 8.372 | 7495 | 6.712e-17 | 0.0002721 | 0.0005466 |
fixed | NA | male | -0.1816 | 0.02048 | -8.865 | 8270 | 9.264e-19 | -0.2391 | -0.1241 |
fixed | NA | sibling_count3 | 0.008918 | 0.03129 | 0.2851 | 6162 | 0.7756 | -0.0789 | 0.09674 |
fixed | NA | sibling_count4 | -0.04393 | 0.03939 | -1.115 | 5828 | 0.2647 | -0.1545 | 0.06662 |
fixed | NA | sibling_count5 | -0.02658 | 0.04819 | -0.5516 | 5560 | 0.5812 | -0.1619 | 0.1087 |
fixed | NA | sibling_count>5 | -0.1216 | 0.05324 | -2.285 | 6031 | 0.02237 | -0.2711 | 0.02781 |
fixed | NA | birth_order_nonlinear2 | 0.01922 | 0.02567 | 0.7485 | 6552 | 0.4542 | -0.05285 | 0.09128 |
fixed | NA | birth_order_nonlinear3 | 0.03887 | 0.03402 | 1.143 | 7520 | 0.2532 | -0.05662 | 0.1344 |
fixed | NA | birth_order_nonlinear4 | -0.03314 | 0.04453 | -0.7443 | 7873 | 0.4567 | -0.1581 | 0.09186 |
fixed | NA | birth_order_nonlinear5 | -0.07932 | 0.05598 | -1.417 | 7851 | 0.1565 | -0.2365 | 0.07781 |
fixed | NA | birth_order_nonlinear>5 | -0.02667 | 0.06012 | -0.4437 | 8550 | 0.6573 | -0.1954 | 0.1421 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.449 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8544 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.101 | 0.193 | -16.06 | 7645 | 3.947e-57 | -3.642 | -2.559 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5322 | 0.03927 | 13.55 | 7501 | 2.367e-41 | 0.422 | 0.6424 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02612 | 0.002487 | -10.51 | 7484 | 1.232e-25 | -0.0331 | -0.01914 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004076 | 0.00004897 | 8.324 | 7489 | 1.005e-16 | 0.0002701 | 0.0005451 |
fixed | NA | male | -0.1814 | 0.02049 | -8.852 | 8258 | 1.036e-18 | -0.2389 | -0.1239 |
fixed | NA | count_birth_order2/2 | 0.04505 | 0.03813 | 1.182 | 6967 | 0.2373 | -0.06196 | 0.1521 |
fixed | NA | count_birth_order1/3 | 0.05846 | 0.0417 | 1.402 | 8520 | 0.161 | -0.0586 | 0.1755 |
fixed | NA | count_birth_order2/3 | 0.03561 | 0.0408 | 0.8727 | 8530 | 0.3828 | -0.07892 | 0.1501 |
fixed | NA | count_birth_order3/3 | 0.009352 | 0.04477 | 0.2089 | 8544 | 0.8345 | -0.1163 | 0.135 |
fixed | NA | count_birth_order1/4 | -0.1275 | 0.0624 | -2.043 | 8513 | 0.04111 | -0.3026 | 0.04769 |
fixed | NA | count_birth_order2/4 | -0.05352 | 0.05596 | -0.9563 | 8537 | 0.3389 | -0.2106 | 0.1036 |
fixed | NA | count_birth_order3/4 | 0.04619 | 0.05355 | 0.8626 | 8542 | 0.3884 | -0.1041 | 0.1965 |
fixed | NA | count_birth_order4/4 | -0.01379 | 0.05409 | -0.2549 | 8549 | 0.7988 | -0.1656 | 0.138 |
fixed | NA | count_birth_order1/5 | 0.04611 | 0.09122 | 0.5055 | 8195 | 0.6132 | -0.21 | 0.3022 |
fixed | NA | count_birth_order2/5 | -0.02527 | 0.08146 | -0.3102 | 8369 | 0.7564 | -0.2539 | 0.2034 |
fixed | NA | count_birth_order3/5 | 0.07466 | 0.07305 | 1.022 | 8450 | 0.3068 | -0.1304 | 0.2797 |
fixed | NA | count_birth_order4/5 | -0.09296 | 0.06719 | -1.384 | 8507 | 0.1665 | -0.2816 | 0.09564 |
fixed | NA | count_birth_order5/5 | -0.108 | 0.06459 | -1.672 | 8547 | 0.09456 | -0.2893 | 0.07331 |
fixed | NA | count_birth_order1/>5 | -0.1115 | 0.09781 | -1.14 | 8043 | 0.2542 | -0.3861 | 0.163 |
fixed | NA | count_birth_order2/>5 | -0.04052 | 0.109 | -0.3718 | 7682 | 0.7101 | -0.3465 | 0.2655 |
fixed | NA | count_birth_order3/>5 | -0.05131 | 0.08401 | -0.6108 | 8194 | 0.5413 | -0.2871 | 0.1845 |
fixed | NA | count_birth_order4/>5 | -0.2026 | 0.07702 | -2.63 | 8284 | 0.008547 | -0.4188 | 0.01361 |
fixed | NA | count_birth_order5/>5 | -0.1804 | 0.06692 | -2.697 | 8418 | 0.007021 | -0.3683 | 0.007396 |
fixed | NA | count_birth_order>5/>5 | -0.139 | 0.04611 | -3.015 | 7713 | 0.002581 | -0.2685 | -0.009577 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4485 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8545 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 23568 | 23646 | -11773 | 23546 | NA | NA | NA |
12 | 23568 | 23653 | -11772 | 23544 | 1.543 | 1 | 0.2141 |
16 | 23572 | 23685 | -11770 | 23540 | 4.59 | 4 | 0.332 |
26 | 23580 | 23763 | -11764 | 23528 | 12.22 | 10 | 0.2709 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.076 | 0.1931 | -15.93 | 7213 | 3.423e-56 | -3.619 | -2.534 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5318 | 0.03963 | 13.42 | 7180 | 1.442e-40 | 0.4206 | 0.6431 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02602 | 0.00251 | -10.37 | 7198 | 5.199e-25 | -0.03307 | -0.01898 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004051 | 0.0000494 | 8.201 | 7210 | 2.792e-16 | 0.0002665 | 0.0005438 |
fixed | NA | male | -0.1757 | 0.02083 | -8.438 | 7953 | 3.797e-17 | -0.2342 | -0.1173 |
fixed | NA | sibling_count3 | -0.01308 | 0.02837 | -0.461 | 5265 | 0.6448 | -0.09271 | 0.06655 |
fixed | NA | sibling_count4 | -0.05899 | 0.03492 | -1.689 | 4471 | 0.09122 | -0.157 | 0.03903 |
fixed | NA | sibling_count5 | -0.1589 | 0.04606 | -3.449 | 3979 | 0.0005685 | -0.2882 | -0.02957 |
fixed | NA | sibling_count>5 | -0.2128 | 0.04257 | -4.998 | 4119 | 0.0000006033 | -0.3322 | -0.09326 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4509 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8514 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.092 | 0.1955 | -15.81 | 7393 | 2.017e-55 | -3.64 | -2.543 |
fixed | NA | birth_order | 0.00463 | 0.009373 | 0.494 | 8010 | 0.6213 | -0.02168 | 0.03094 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5333 | 0.03974 | 13.42 | 7227 | 1.437e-40 | 0.4217 | 0.6448 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02609 | 0.002514 | -10.38 | 7218 | 4.644e-25 | -0.03315 | -0.01904 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004064 | 0.00004947 | 8.216 | 7226 | 2.476e-16 | 0.0002676 | 0.0005453 |
fixed | NA | male | -0.1758 | 0.02083 | -8.439 | 7952 | 3.774e-17 | -0.2342 | -0.1173 |
fixed | NA | sibling_count3 | -0.01609 | 0.02902 | -0.5545 | 5232 | 0.5793 | -0.09754 | 0.06536 |
fixed | NA | sibling_count4 | -0.0657 | 0.03747 | -1.753 | 4494 | 0.07961 | -0.1709 | 0.03949 |
fixed | NA | sibling_count5 | -0.1699 | 0.05117 | -3.32 | 4154 | 0.0009083 | -0.3135 | -0.02624 |
fixed | NA | sibling_count>5 | -0.2345 | 0.06122 | -3.83 | 4925 | 0.0001297 | -0.4063 | -0.06263 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.451 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8514 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.104 | 0.195 | -15.92 | 7354 | 4.046e-56 | -3.652 | -2.557 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.535 | 0.03977 | 13.45 | 7229 | 9.088e-41 | 0.4234 | 0.6467 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0262 | 0.002515 | -10.42 | 7218 | 3.192e-25 | -0.03326 | -0.01914 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004084 | 0.00004949 | 8.251 | 7233 | 1.85e-16 | 0.0002694 | 0.0005473 |
fixed | NA | male | -0.1762 | 0.02083 | -8.455 | 7950 | 3.277e-17 | -0.2346 | -0.1177 |
fixed | NA | sibling_count3 | -0.01488 | 0.03034 | -0.4904 | 5716 | 0.6239 | -0.1001 | 0.07029 |
fixed | NA | sibling_count4 | -0.06779 | 0.04052 | -1.673 | 5244 | 0.09435 | -0.1815 | 0.04594 |
fixed | NA | sibling_count5 | -0.1548 | 0.05619 | -2.754 | 4945 | 0.005902 | -0.3125 | 0.002959 |
fixed | NA | sibling_count>5 | -0.2456 | 0.06644 | -3.696 | 5579 | 0.0002211 | -0.4321 | -0.05907 |
fixed | NA | birth_order_nonlinear2 | 0.02627 | 0.02496 | 1.052 | 6231 | 0.2926 | -0.0438 | 0.09634 |
fixed | NA | birth_order_nonlinear3 | 0.003957 | 0.03499 | 0.1131 | 7046 | 0.91 | -0.09427 | 0.1022 |
fixed | NA | birth_order_nonlinear4 | 0.03323 | 0.04852 | 0.6848 | 7395 | 0.4935 | -0.103 | 0.1694 |
fixed | NA | birth_order_nonlinear5 | -0.02669 | 0.06674 | -0.3999 | 7529 | 0.6892 | -0.214 | 0.1607 |
fixed | NA | birth_order_nonlinear>5 | 0.07335 | 0.07557 | 0.9707 | 8221 | 0.3317 | -0.1388 | 0.2855 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4505 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8517 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.108 | 0.1959 | -15.87 | 7368 | 8.98e-56 | -3.658 | -2.558 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.5337 | 0.03987 | 13.39 | 7233 | 2.135e-40 | 0.4218 | 0.6456 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02612 | 0.002521 | -10.36 | 7218 | 5.6e-25 | -0.0332 | -0.01905 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0004071 | 0.00004962 | 8.205 | 7228 | 2.71e-16 | 0.0002678 | 0.0005464 |
fixed | NA | male | -0.1755 | 0.02085 | -8.42 | 7940 | 4.413e-17 | -0.234 | -0.117 |
fixed | NA | count_birth_order2/2 | 0.05598 | 0.0346 | 1.618 | 6647 | 0.1057 | -0.04113 | 0.1531 |
fixed | NA | count_birth_order1/3 | 0.0261 | 0.04051 | 0.6443 | 8194 | 0.5194 | -0.08761 | 0.1398 |
fixed | NA | count_birth_order2/3 | 0.01806 | 0.03892 | 0.464 | 8202 | 0.6427 | -0.09119 | 0.1273 |
fixed | NA | count_birth_order3/3 | -0.02986 | 0.04272 | -0.6989 | 8222 | 0.4846 | -0.1498 | 0.09006 |
fixed | NA | count_birth_order1/4 | -0.09554 | 0.06434 | -1.485 | 8164 | 0.1376 | -0.2761 | 0.08506 |
fixed | NA | count_birth_order2/4 | -0.0866 | 0.05675 | -1.526 | 8214 | 0.1271 | -0.2459 | 0.0727 |
fixed | NA | count_birth_order3/4 | -0.0142 | 0.05387 | -0.2637 | 8215 | 0.792 | -0.1654 | 0.137 |
fixed | NA | count_birth_order4/4 | 0.009754 | 0.05365 | 0.1818 | 8224 | 0.8557 | -0.1408 | 0.1604 |
fixed | NA | count_birth_order1/5 | -0.05029 | 0.1121 | -0.4487 | 7670 | 0.6537 | -0.3649 | 0.2643 |
fixed | NA | count_birth_order2/5 | -0.1172 | 0.1071 | -1.094 | 7742 | 0.2739 | -0.418 | 0.1835 |
fixed | NA | count_birth_order3/5 | -0.1053 | 0.08641 | -1.218 | 8091 | 0.2231 | -0.3479 | 0.1373 |
fixed | NA | count_birth_order4/5 | -0.123 | 0.07302 | -1.685 | 8215 | 0.0921 | -0.328 | 0.08196 |
fixed | NA | count_birth_order5/5 | -0.2081 | 0.0713 | -2.919 | 8224 | 0.003519 | -0.4083 | -0.007998 |
fixed | NA | count_birth_order1/>5 | -0.2608 | 0.145 | -1.799 | 7182 | 0.07205 | -0.6678 | 0.1461 |
fixed | NA | count_birth_order2/>5 | -0.1588 | 0.1336 | -1.188 | 7341 | 0.2347 | -0.5339 | 0.2163 |
fixed | NA | count_birth_order3/>5 | -0.2241 | 0.1089 | -2.058 | 7773 | 0.03964 | -0.5298 | 0.08158 |
fixed | NA | count_birth_order4/>5 | -0.3077 | 0.1033 | -2.979 | 7755 | 0.002905 | -0.5977 | -0.01772 |
fixed | NA | count_birth_order5/>5 | -0.2128 | 0.08176 | -2.602 | 8076 | 0.00928 | -0.4423 | 0.01675 |
fixed | NA | count_birth_order>5/>5 | -0.1609 | 0.05288 | -3.043 | 7148 | 0.002353 | -0.3094 | -0.01246 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4492 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8523 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 22637 | 22714 | -11307 | 22615 | NA | NA | NA |
12 | 22638 | 22723 | -11307 | 22614 | 0.2439 | 1 | 0.6214 |
16 | 22643 | 22756 | -11306 | 22611 | 3.053 | 4 | 0.549 |
26 | 22655 | 22837 | -11302 | 22603 | 8.409 | 10 | 0.5889 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = count_backwards)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5158 | 0.1653 | -3.12 | 13453 | 0.001811 | -0.9798 | -0.05176 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.06972 | 0.01599 | 4.359 | 13347 | 0.00001318 | 0.02482 | 0.1146 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002356 | 0.0004765 | -4.944 | 13137 | 0.0000007756 | -0.003693 | -0.001018 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002179 | 0.000004446 | 4.9 | 12884 | 0.0000009705 | 0.000009305 | 0.00003427 |
fixed | NA | male | 0.04321 | 0.01663 | 2.599 | 13172 | 0.009371 | -0.003466 | 0.08989 |
fixed | NA | sibling_count3 | 0.002307 | 0.03444 | 0.06697 | 9806 | 0.9466 | -0.09438 | 0.09899 |
fixed | NA | sibling_count4 | 0.03135 | 0.03566 | 0.8792 | 9020 | 0.3793 | -0.06874 | 0.1314 |
fixed | NA | sibling_count5 | 0.0143 | 0.03708 | 0.3855 | 8214 | 0.6999 | -0.0898 | 0.1184 |
fixed | NA | sibling_count>5 | -0.1004 | 0.0291 | -3.449 | 9139 | 0.0005653 | -0.1821 | -0.01868 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4186 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8969 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.521 | 0.1653 | -3.152 | 13453 | 0.001623 | -0.985 | -0.05707 |
fixed | NA | birth_order | -0.007541 | 0.003559 | -2.119 | 13003 | 0.0341 | -0.01753 | 0.002448 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07236 | 0.01604 | 4.511 | 13322 | 0.000006498 | 0.02734 | 0.1174 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002453 | 0.0004786 | -5.125 | 13056 | 0.0000003019 | -0.003796 | -0.001109 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000227 | 0.000004466 | 5.083 | 12770 | 0.0000003776 | 0.00001016 | 0.00003523 |
fixed | NA | male | 0.04349 | 0.01663 | 2.615 | 13175 | 0.00893 | -0.003192 | 0.09016 |
fixed | NA | sibling_count3 | 0.00394 | 0.03443 | 0.1144 | 9820 | 0.9089 | -0.09272 | 0.1006 |
fixed | NA | sibling_count4 | 0.03655 | 0.03572 | 1.023 | 9082 | 0.3062 | -0.06372 | 0.1368 |
fixed | NA | sibling_count5 | 0.0234 | 0.03731 | 0.6272 | 8326 | 0.5305 | -0.08132 | 0.1281 |
fixed | NA | sibling_count>5 | -0.07194 | 0.03204 | -2.246 | 10244 | 0.02475 | -0.1619 | 0.01799 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4172 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8973 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5287 | 0.1657 | -3.19 | 13447 | 0.001427 | -0.994 | -0.06345 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07327 | 0.01604 | 4.567 | 13329 | 0.000004985 | 0.02824 | 0.1183 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002467 | 0.0004786 | -5.154 | 13064 | 0.0000002584 | -0.003811 | -0.001123 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002265 | 0.000004468 | 5.069 | 12764 | 0.0000004065 | 0.0000101 | 0.00003519 |
fixed | NA | male | 0.04386 | 0.01662 | 2.638 | 13164 | 0.008342 | -0.002805 | 0.09052 |
fixed | NA | sibling_count3 | 0.0181 | 0.03489 | 0.5187 | 10123 | 0.604 | -0.07984 | 0.116 |
fixed | NA | sibling_count4 | 0.05936 | 0.03668 | 1.618 | 9717 | 0.1056 | -0.0436 | 0.1623 |
fixed | NA | sibling_count5 | 0.05141 | 0.03865 | 1.33 | 9147 | 0.1835 | -0.05708 | 0.1599 |
fixed | NA | sibling_count>5 | -0.04218 | 0.03354 | -1.258 | 11185 | 0.2086 | -0.1363 | 0.05197 |
fixed | NA | birth_order_nonlinear2 | -0.03426 | 0.02401 | -1.427 | 12248 | 0.1537 | -0.1017 | 0.03314 |
fixed | NA | birth_order_nonlinear3 | -0.08943 | 0.02829 | -3.162 | 11909 | 0.001573 | -0.1688 | -0.01003 |
fixed | NA | birth_order_nonlinear4 | -0.08064 | 0.03218 | -2.506 | 11938 | 0.01223 | -0.171 | 0.009694 |
fixed | NA | birth_order_nonlinear5 | -0.08633 | 0.03661 | -2.358 | 11926 | 0.01837 | -0.1891 | 0.01642 |
fixed | NA | birth_order_nonlinear>5 | -0.09508 | 0.03072 | -3.095 | 13503 | 0.001974 | -0.1813 | -0.008838 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4188 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8965 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5266 | 0.1665 | -3.163 | 13433 | 0.001562 | -0.9939 | -0.05933 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07317 | 0.01605 | 4.56 | 13313 | 0.000005162 | 0.02813 | 0.1182 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002458 | 0.0004789 | -5.132 | 13037 | 0.00000029 | -0.003802 | -0.001114 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002251 | 0.000004471 | 5.034 | 12723 | 0.0000004873 | 0.000009957 | 0.00003506 |
fixed | NA | male | 0.04425 | 0.01663 | 2.661 | 13153 | 0.007799 | -0.002427 | 0.09092 |
fixed | NA | count_birth_order2/2 | -0.04338 | 0.04687 | -0.9254 | 12433 | 0.3548 | -0.175 | 0.0882 |
fixed | NA | count_birth_order1/3 | 0.03772 | 0.04498 | 0.8386 | 13309 | 0.4017 | -0.08854 | 0.164 |
fixed | NA | count_birth_order2/3 | -0.0197 | 0.05012 | -0.393 | 13454 | 0.6943 | -0.1604 | 0.121 |
fixed | NA | count_birth_order3/3 | -0.1232 | 0.05612 | -2.195 | 13559 | 0.02821 | -0.2807 | 0.03437 |
fixed | NA | count_birth_order1/4 | 0.0815 | 0.05147 | 1.583 | 13460 | 0.1134 | -0.06298 | 0.226 |
fixed | NA | count_birth_order2/4 | 0.005026 | 0.05402 | 0.09305 | 13510 | 0.9259 | -0.1466 | 0.1567 |
fixed | NA | count_birth_order3/4 | -0.06449 | 0.05836 | -1.105 | 13578 | 0.2692 | -0.2283 | 0.09933 |
fixed | NA | count_birth_order4/4 | -0.009001 | 0.06157 | -0.1462 | 13598 | 0.8838 | -0.1818 | 0.1638 |
fixed | NA | count_birth_order1/5 | -0.0384 | 0.05782 | -0.6642 | 13554 | 0.5066 | -0.2007 | 0.1239 |
fixed | NA | count_birth_order2/5 | 0.06285 | 0.06083 | 1.033 | 13587 | 0.3015 | -0.1079 | 0.2336 |
fixed | NA | count_birth_order3/5 | 0.03161 | 0.06263 | 0.5048 | 13600 | 0.6137 | -0.1442 | 0.2074 |
fixed | NA | count_birth_order4/5 | -0.05632 | 0.06619 | -0.851 | 13605 | 0.3948 | -0.2421 | 0.1295 |
fixed | NA | count_birth_order5/5 | -0.03531 | 0.06734 | -0.5243 | 13602 | 0.6001 | -0.2243 | 0.1537 |
fixed | NA | count_birth_order1/>5 | -0.05063 | 0.04693 | -1.079 | 13601 | 0.2807 | -0.1824 | 0.08112 |
fixed | NA | count_birth_order2/>5 | -0.08895 | 0.04831 | -1.841 | 13605 | 0.06562 | -0.2246 | 0.04666 |
fixed | NA | count_birth_order3/>5 | -0.1235 | 0.04744 | -2.604 | 13604 | 0.00923 | -0.2567 | 0.009641 |
fixed | NA | count_birth_order4/>5 | -0.1254 | 0.04636 | -2.705 | 13605 | 0.006841 | -0.2556 | 0.004736 |
fixed | NA | count_birth_order5/>5 | -0.1327 | 0.0467 | -2.842 | 13604 | 0.004491 | -0.2638 | -0.001628 |
fixed | NA | count_birth_order>5/>5 | -0.1408 | 0.03701 | -3.804 | 12216 | 0.0001434 | -0.2447 | -0.03688 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4189 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8965 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 38110 | 38193 | -19044 | 38088 | NA | NA | NA |
12 | 38108 | 38198 | -19042 | 38084 | 4.489 | 1 | 0.03411 |
16 | 38105 | 38225 | -19037 | 38073 | 10.57 | 4 | 0.03183 |
26 | 38116 | 38311 | -19032 | 38064 | 9.266 | 10 | 0.507 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.742 | 0.4065 | -4.284 | 5752 | 0.00001864 | -2.883 | -0.6005 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2094 | 0.04611 | 4.543 | 5754 | 0.000005671 | 0.08002 | 0.3389 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006882 | 0.001645 | -4.185 | 5757 | 0.00002899 | -0.0115 | -0.002266 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007036 | 0.00001862 | 3.779 | 5763 | 0.000159 | 0.0000181 | 0.0001226 |
fixed | NA | male | -0.002035 | 0.02375 | -0.08571 | 5664 | 0.9317 | -0.06869 | 0.06462 |
fixed | NA | sibling_count3 | -0.00724 | 0.0379 | -0.191 | 4223 | 0.8485 | -0.1136 | 0.09914 |
fixed | NA | sibling_count4 | -0.0264 | 0.04103 | -0.6435 | 3750 | 0.52 | -0.1416 | 0.08876 |
fixed | NA | sibling_count5 | -0.07347 | 0.04681 | -1.569 | 3408 | 0.1166 | -0.2049 | 0.05794 |
fixed | NA | sibling_count>5 | -0.1963 | 0.04127 | -4.756 | 3243 | 0.00000206 | -0.3121 | -0.08044 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3845 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8347 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.734 | 0.4066 | -4.266 | 5752 | 0.00002025 | -2.876 | -0.593 |
fixed | NA | birth_order | -0.008164 | 0.00792 | -1.031 | 5827 | 0.3027 | -0.0304 | 0.01407 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2098 | 0.04611 | 4.55 | 5754 | 0.000005469 | 0.08038 | 0.3392 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006883 | 0.001645 | -4.185 | 5757 | 0.00002896 | -0.0115 | -0.002266 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007005 | 0.00001862 | 3.762 | 5761 | 0.0001706 | 0.00001777 | 0.0001223 |
fixed | NA | male | -0.001657 | 0.02375 | -0.06975 | 5664 | 0.9444 | -0.06833 | 0.06501 |
fixed | NA | sibling_count3 | -0.003215 | 0.03809 | -0.08441 | 4230 | 0.9327 | -0.1101 | 0.1037 |
fixed | NA | sibling_count4 | -0.01684 | 0.04205 | -0.4004 | 3768 | 0.6889 | -0.1349 | 0.1012 |
fixed | NA | sibling_count5 | -0.05794 | 0.04916 | -1.179 | 3509 | 0.2387 | -0.1959 | 0.08006 |
fixed | NA | sibling_count>5 | -0.1653 | 0.05105 | -3.238 | 3789 | 0.001215 | -0.3086 | -0.02199 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3836 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.835 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.751 | 0.4073 | -4.3 | 5759 | 0.00001736 | -2.894 | -0.608 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2103 | 0.04614 | 4.558 | 5755 | 0.000005264 | 0.08081 | 0.3399 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006901 | 0.001646 | -4.193 | 5756 | 0.00002796 | -0.01152 | -0.002281 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007025 | 0.00001864 | 3.769 | 5760 | 0.0001655 | 0.00001793 | 0.0001226 |
fixed | NA | male | -0.001182 | 0.02375 | -0.04974 | 5657 | 0.9603 | -0.06786 | 0.0655 |
fixed | NA | sibling_count3 | 0.007384 | 0.03885 | 0.1901 | 4413 | 0.8493 | -0.1017 | 0.1164 |
fixed | NA | sibling_count4 | -0.003047 | 0.04364 | -0.06983 | 4087 | 0.9443 | -0.1256 | 0.1195 |
fixed | NA | sibling_count5 | -0.04944 | 0.05155 | -0.9591 | 3926 | 0.3376 | -0.1941 | 0.09526 |
fixed | NA | sibling_count>5 | -0.1575 | 0.05246 | -3.002 | 4038 | 0.002694 | -0.3048 | -0.01025 |
fixed | NA | birth_order_nonlinear2 | 0.003951 | 0.03053 | 0.1294 | 4749 | 0.897 | -0.08174 | 0.08965 |
fixed | NA | birth_order_nonlinear3 | -0.06261 | 0.03762 | -1.664 | 4959 | 0.09608 | -0.1682 | 0.04298 |
fixed | NA | birth_order_nonlinear4 | -0.03636 | 0.0466 | -0.7802 | 5103 | 0.4353 | -0.1672 | 0.09444 |
fixed | NA | birth_order_nonlinear5 | -0.007188 | 0.05817 | -0.1236 | 4949 | 0.9017 | -0.1705 | 0.1561 |
fixed | NA | birth_order_nonlinear>5 | -0.05932 | 0.05891 | -1.007 | 5758 | 0.3141 | -0.2247 | 0.1061 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3846 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8348 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.724 | 0.408 | -4.227 | 5751 | 0.00002407 | -2.87 | -0.5792 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.205 | 0.04622 | 4.435 | 5744 | 0.000009364 | 0.07526 | 0.3347 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0067 | 0.001649 | -4.063 | 5746 | 0.00004908 | -0.01133 | -0.002071 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00006785 | 0.00001868 | 3.633 | 5750 | 0.0002826 | 0.00001543 | 0.0001203 |
fixed | NA | male | -0.003637 | 0.02376 | -0.1531 | 5644 | 0.8783 | -0.07034 | 0.06306 |
fixed | NA | count_birth_order2/2 | 0.06035 | 0.0554 | 1.089 | 5061 | 0.276 | -0.09516 | 0.2159 |
fixed | NA | count_birth_order1/3 | 0.04137 | 0.04935 | 0.8382 | 5765 | 0.4019 | -0.09717 | 0.1799 |
fixed | NA | count_birth_order2/3 | 0.006316 | 0.05378 | 0.1175 | 5808 | 0.9065 | -0.1446 | 0.1573 |
fixed | NA | count_birth_order3/3 | -0.03376 | 0.05998 | -0.5628 | 5820 | 0.5736 | -0.2021 | 0.1346 |
fixed | NA | count_birth_order1/4 | -0.03262 | 0.06047 | -0.5395 | 5802 | 0.5896 | -0.2024 | 0.1371 |
fixed | NA | count_birth_order2/4 | 0.0837 | 0.06257 | 1.338 | 5820 | 0.181 | -0.09192 | 0.2593 |
fixed | NA | count_birth_order3/4 | -0.07312 | 0.06565 | -1.114 | 5813 | 0.2654 | -0.2574 | 0.1112 |
fixed | NA | count_birth_order4/4 | -0.002899 | 0.06845 | -0.04236 | 5808 | 0.9662 | -0.195 | 0.1892 |
fixed | NA | count_birth_order1/5 | 0.01161 | 0.08139 | 0.1427 | 5818 | 0.8866 | -0.2168 | 0.2401 |
fixed | NA | count_birth_order2/5 | -0.07328 | 0.08756 | -0.837 | 5783 | 0.4027 | -0.3191 | 0.1725 |
fixed | NA | count_birth_order3/5 | -0.1484 | 0.0822 | -1.806 | 5785 | 0.071 | -0.3792 | 0.0823 |
fixed | NA | count_birth_order4/5 | -0.03242 | 0.07917 | -0.4095 | 5801 | 0.6822 | -0.2547 | 0.1898 |
fixed | NA | count_birth_order5/5 | -0.02795 | 0.08174 | -0.342 | 5788 | 0.7324 | -0.2574 | 0.2015 |
fixed | NA | count_birth_order1/>5 | -0.05036 | 0.0809 | -0.6225 | 5798 | 0.5336 | -0.2774 | 0.1767 |
fixed | NA | count_birth_order2/>5 | -0.2429 | 0.0813 | -2.987 | 5776 | 0.002828 | -0.4711 | -0.01464 |
fixed | NA | count_birth_order3/>5 | -0.1141 | 0.08049 | -1.418 | 5749 | 0.1563 | -0.3401 | 0.1118 |
fixed | NA | count_birth_order4/>5 | -0.227 | 0.07547 | -3.008 | 5749 | 0.00264 | -0.4389 | -0.01518 |
fixed | NA | count_birth_order5/>5 | -0.1526 | 0.07184 | -2.124 | 5749 | 0.03375 | -0.3542 | 0.04909 |
fixed | NA | count_birth_order>5/>5 | -0.1988 | 0.05463 | -3.639 | 5402 | 0.0002762 | -0.3521 | -0.04545 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.385 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8344 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15526 | 15600 | -7752 | 15504 | NA | NA | NA |
12 | 15527 | 15607 | -7752 | 15503 | 1.066 | 1 | 0.3018 |
16 | 15532 | 15639 | -7750 | 15500 | 3.189 | 4 | 0.5268 |
26 | 15540 | 15713 | -7744 | 15488 | 12.37 | 10 | 0.2613 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.735 | 0.4053 | -4.282 | 5803 | 0.00001886 | -2.873 | -0.5976 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2105 | 0.04599 | 4.578 | 5803 | 0.0000048 | 0.08143 | 0.3396 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006937 | 0.001641 | -4.228 | 5806 | 0.00002394 | -0.01154 | -0.002331 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007079 | 0.00001858 | 3.81 | 5813 | 0.0001403 | 0.00001864 | 0.0001229 |
fixed | NA | male | -0.001301 | 0.02365 | -0.05501 | 5711 | 0.9561 | -0.0677 | 0.06509 |
fixed | NA | sibling_count3 | -0.03781 | 0.04097 | -0.923 | 4375 | 0.356 | -0.1528 | 0.07718 |
fixed | NA | sibling_count4 | -0.007388 | 0.04336 | -0.1704 | 4006 | 0.8647 | -0.1291 | 0.1143 |
fixed | NA | sibling_count5 | -0.06853 | 0.04634 | -1.479 | 3649 | 0.1393 | -0.1986 | 0.06155 |
fixed | NA | sibling_count>5 | -0.1464 | 0.04069 | -3.598 | 3779 | 0.0003249 | -0.2606 | -0.03218 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3853 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8346 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.721 | 0.4053 | -4.247 | 5803 | 0.00002201 | -2.859 | -0.5836 |
fixed | NA | birth_order | -0.01171 | 0.006915 | -1.694 | 5782 | 0.09032 | -0.03113 | 0.007697 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2106 | 0.04598 | 4.58 | 5804 | 0.000004737 | 0.08154 | 0.3397 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006923 | 0.001641 | -4.22 | 5806 | 0.00002485 | -0.01153 | -0.002317 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007016 | 0.00001858 | 3.776 | 5812 | 0.000161 | 0.000018 | 0.0001223 |
fixed | NA | male | -0.0008451 | 0.02365 | -0.03573 | 5713 | 0.9715 | -0.06724 | 0.06555 |
fixed | NA | sibling_count3 | -0.03205 | 0.04109 | -0.7799 | 4376 | 0.4355 | -0.1474 | 0.0833 |
fixed | NA | sibling_count4 | 0.005742 | 0.04403 | 0.1304 | 4001 | 0.8962 | -0.1178 | 0.1293 |
fixed | NA | sibling_count5 | -0.04796 | 0.04788 | -1.002 | 3677 | 0.3165 | -0.1823 | 0.08643 |
fixed | NA | sibling_count>5 | -0.1033 | 0.04796 | -2.154 | 4106 | 0.03134 | -0.2379 | 0.03134 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.384 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8349 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.737 | 0.4058 | -4.28 | 5809 | 0.00001901 | -2.876 | -0.5976 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2108 | 0.046 | 4.584 | 5804 | 0.000004666 | 0.08172 | 0.3399 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006929 | 0.001641 | -4.222 | 5806 | 0.00002462 | -0.01154 | -0.002322 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007018 | 0.00001859 | 3.775 | 5810 | 0.0001615 | 0.000018 | 0.0001224 |
fixed | NA | male | 0.0001426 | 0.02365 | 0.006028 | 5706 | 0.9952 | -0.06625 | 0.06653 |
fixed | NA | sibling_count3 | -0.02208 | 0.04182 | -0.5281 | 4533 | 0.5975 | -0.1395 | 0.0953 |
fixed | NA | sibling_count4 | 0.0252 | 0.04553 | 0.5535 | 4287 | 0.58 | -0.1026 | 0.153 |
fixed | NA | sibling_count5 | -0.04036 | 0.05006 | -0.8061 | 4062 | 0.4202 | -0.1809 | 0.1002 |
fixed | NA | sibling_count>5 | -0.08923 | 0.04936 | -1.808 | 4370 | 0.07069 | -0.2278 | 0.04931 |
fixed | NA | birth_order_nonlinear2 | -0.007419 | 0.03111 | -0.2385 | 4896 | 0.8115 | -0.09474 | 0.0799 |
fixed | NA | birth_order_nonlinear3 | -0.06747 | 0.03749 | -1.8 | 5088 | 0.07198 | -0.1727 | 0.03777 |
fixed | NA | birth_order_nonlinear4 | -0.08405 | 0.04525 | -1.857 | 5239 | 0.06331 | -0.2111 | 0.04297 |
fixed | NA | birth_order_nonlinear5 | 0.01327 | 0.05537 | 0.2397 | 5169 | 0.8105 | -0.1421 | 0.1687 |
fixed | NA | birth_order_nonlinear>5 | -0.1017 | 0.05263 | -1.933 | 5872 | 0.05324 | -0.2495 | 0.04598 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3854 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8342 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.753 | 0.4063 | -4.315 | 5800 | 0.00001622 | -2.894 | -0.6127 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2086 | 0.04603 | 4.531 | 5791 | 0.000005994 | 0.07934 | 0.3378 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006848 | 0.001643 | -4.168 | 5793 | 0.00003112 | -0.01146 | -0.002236 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00006923 | 0.00001861 | 3.72 | 5798 | 0.0002011 | 0.00001699 | 0.0001215 |
fixed | NA | male | -0.0008112 | 0.02365 | -0.03431 | 5689 | 0.9726 | -0.06718 | 0.06556 |
fixed | NA | count_birth_order2/2 | 0.1046 | 0.0606 | 1.727 | 5189 | 0.08424 | -0.06545 | 0.2747 |
fixed | NA | count_birth_order1/3 | 0.04638 | 0.05345 | 0.8677 | 5815 | 0.3856 | -0.1037 | 0.1964 |
fixed | NA | count_birth_order2/3 | -0.03838 | 0.05776 | -0.6645 | 5856 | 0.5064 | -0.2005 | 0.1238 |
fixed | NA | count_birth_order3/3 | -0.04669 | 0.06486 | -0.7199 | 5871 | 0.4716 | -0.2288 | 0.1354 |
fixed | NA | count_birth_order1/4 | 0.08308 | 0.06328 | 1.313 | 5851 | 0.1893 | -0.09456 | 0.2607 |
fixed | NA | count_birth_order2/4 | 0.1233 | 0.06453 | 1.91 | 5869 | 0.05612 | -0.05786 | 0.3044 |
fixed | NA | count_birth_order3/4 | -0.09541 | 0.07025 | -1.358 | 5864 | 0.1745 | -0.2926 | 0.1018 |
fixed | NA | count_birth_order4/4 | -0.0516 | 0.07268 | -0.71 | 5862 | 0.4778 | -0.2556 | 0.1524 |
fixed | NA | count_birth_order1/5 | -0.01385 | 0.07452 | -0.1859 | 5870 | 0.8526 | -0.223 | 0.1953 |
fixed | NA | count_birth_order2/5 | -0.068 | 0.08025 | -0.8473 | 5853 | 0.3968 | -0.2933 | 0.1573 |
fixed | NA | count_birth_order3/5 | -0.08213 | 0.078 | -1.053 | 5851 | 0.2924 | -0.3011 | 0.1368 |
fixed | NA | count_birth_order4/5 | -0.01231 | 0.08102 | -0.1519 | 5834 | 0.8792 | -0.2397 | 0.2151 |
fixed | NA | count_birth_order5/5 | 0.02339 | 0.08067 | 0.29 | 5838 | 0.7718 | -0.203 | 0.2498 |
fixed | NA | count_birth_order1/>5 | -0.04074 | 0.07093 | -0.5743 | 5871 | 0.5658 | -0.2398 | 0.1584 |
fixed | NA | count_birth_order2/>5 | -0.1348 | 0.0748 | -1.802 | 5843 | 0.07154 | -0.3448 | 0.07515 |
fixed | NA | count_birth_order3/>5 | -0.02254 | 0.07276 | -0.3097 | 5831 | 0.7568 | -0.2268 | 0.1817 |
fixed | NA | count_birth_order4/>5 | -0.1605 | 0.07 | -2.292 | 5832 | 0.02192 | -0.357 | 0.03603 |
fixed | NA | count_birth_order5/>5 | -0.04646 | 0.07191 | -0.6462 | 5790 | 0.5182 | -0.2483 | 0.1554 |
fixed | NA | count_birth_order>5/>5 | -0.1536 | 0.05342 | -2.876 | 5498 | 0.004038 | -0.3036 | -0.003707 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3886 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8324 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15665 | 15738 | -7821 | 15643 | NA | NA | NA |
12 | 15664 | 15744 | -7820 | 15640 | 2.876 | 1 | 0.08993 |
16 | 15665 | 15772 | -7817 | 15633 | 6.217 | 4 | 0.1835 |
26 | 15669 | 15843 | -7809 | 15617 | 16.19 | 10 | 0.09423 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.758 | 0.4107 | -4.281 | 5640 | 0.00001893 | -2.911 | -0.6052 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2094 | 0.0466 | 4.494 | 5641 | 0.00000714 | 0.07859 | 0.3402 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006886 | 0.001663 | -4.142 | 5644 | 0.000035 | -0.01155 | -0.002219 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007041 | 0.00001883 | 3.738 | 5649 | 0.0001871 | 0.00001754 | 0.0001233 |
fixed | NA | male | -0.001767 | 0.02395 | -0.07378 | 5556 | 0.9412 | -0.06901 | 0.06547 |
fixed | NA | sibling_count3 | 0.02318 | 0.03734 | 0.6207 | 4163 | 0.5348 | -0.08164 | 0.128 |
fixed | NA | sibling_count4 | -0.01709 | 0.04066 | -0.4203 | 3726 | 0.6743 | -0.1312 | 0.09704 |
fixed | NA | sibling_count5 | -0.03092 | 0.04791 | -0.6453 | 3290 | 0.5188 | -0.1654 | 0.1036 |
fixed | NA | sibling_count>5 | -0.1816 | 0.04168 | -4.358 | 3134 | 0.00001356 | -0.2986 | -0.06464 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3835 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8335 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.751 | 0.4107 | -4.263 | 5639 | 0.00002046 | -2.904 | -0.5982 |
fixed | NA | birth_order | -0.009102 | 0.00815 | -1.117 | 5717 | 0.2641 | -0.03198 | 0.01378 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2099 | 0.0466 | 4.505 | 5642 | 0.000006786 | 0.0791 | 0.3407 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006889 | 0.001663 | -4.144 | 5643 | 0.0000347 | -0.01156 | -0.002222 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00007008 | 0.00001884 | 3.72 | 5648 | 0.0002008 | 0.00001721 | 0.000123 |
fixed | NA | male | -0.001512 | 0.02396 | -0.06313 | 5556 | 0.9497 | -0.06876 | 0.06573 |
fixed | NA | sibling_count3 | 0.02767 | 0.03755 | 0.737 | 4170 | 0.4612 | -0.07773 | 0.1331 |
fixed | NA | sibling_count4 | -0.006581 | 0.04173 | -0.1577 | 3757 | 0.8747 | -0.1237 | 0.1105 |
fixed | NA | sibling_count5 | -0.01437 | 0.05014 | -0.2867 | 3385 | 0.7744 | -0.1551 | 0.1264 |
fixed | NA | sibling_count>5 | -0.1474 | 0.05172 | -2.85 | 3768 | 0.0044 | -0.2926 | -0.002208 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3829 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8337 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.75 | 0.4113 | -4.255 | 5646 | 0.00002129 | -2.905 | -0.5954 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2089 | 0.04663 | 4.48 | 5642 | 0.000007605 | 0.07801 | 0.3398 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006853 | 0.001664 | -4.119 | 5642 | 0.00003861 | -0.01152 | -0.002183 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00006965 | 0.00001885 | 3.695 | 5645 | 0.0002217 | 0.00001674 | 0.0001226 |
fixed | NA | male | -0.001605 | 0.02396 | -0.06699 | 5549 | 0.9466 | -0.06886 | 0.06565 |
fixed | NA | sibling_count3 | 0.03932 | 0.03833 | 1.026 | 4350 | 0.3051 | -0.06828 | 0.1469 |
fixed | NA | sibling_count4 | 0.006506 | 0.04337 | 0.15 | 4071 | 0.8808 | -0.1152 | 0.1283 |
fixed | NA | sibling_count5 | -0.001042 | 0.05236 | -0.01989 | 3752 | 0.9841 | -0.148 | 0.1459 |
fixed | NA | sibling_count>5 | -0.1381 | 0.05322 | -2.595 | 4031 | 0.009494 | -0.2875 | 0.01128 |
fixed | NA | birth_order_nonlinear2 | -0.01308 | 0.03042 | -0.4302 | 4660 | 0.6671 | -0.09846 | 0.07229 |
fixed | NA | birth_order_nonlinear3 | -0.06863 | 0.03759 | -1.826 | 4850 | 0.06794 | -0.1741 | 0.03688 |
fixed | NA | birth_order_nonlinear4 | -0.03461 | 0.04784 | -0.7235 | 4985 | 0.4694 | -0.1689 | 0.09968 |
fixed | NA | birth_order_nonlinear5 | -0.0511 | 0.06064 | -0.8426 | 4862 | 0.3995 | -0.2213 | 0.1191 |
fixed | NA | birth_order_nonlinear>5 | -0.06211 | 0.06069 | -1.023 | 5609 | 0.3062 | -0.2325 | 0.1082 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.384 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8334 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.72 | 0.4121 | -4.173 | 5638 | 0.00003048 | -2.877 | -0.563 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2027 | 0.04671 | 4.339 | 5632 | 0.00001455 | 0.07157 | 0.3338 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006614 | 0.001667 | -3.968 | 5633 | 0.00007349 | -0.01129 | -0.001935 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00006677 | 0.00001889 | 3.535 | 5637 | 0.0004113 | 0.00001375 | 0.0001198 |
fixed | NA | male | -0.004393 | 0.02396 | -0.1833 | 5534 | 0.8545 | -0.07166 | 0.06287 |
fixed | NA | count_birth_order2/2 | 0.05125 | 0.0538 | 0.9527 | 4914 | 0.3408 | -0.09976 | 0.2023 |
fixed | NA | count_birth_order1/3 | 0.06193 | 0.04865 | 1.273 | 5651 | 0.203 | -0.07463 | 0.1985 |
fixed | NA | count_birth_order2/3 | 0.0383 | 0.05364 | 0.7141 | 5697 | 0.4752 | -0.1123 | 0.1889 |
fixed | NA | count_birth_order3/3 | 0.00373 | 0.05886 | 0.06337 | 5704 | 0.9495 | -0.1615 | 0.169 |
fixed | NA | count_birth_order1/4 | 0.008194 | 0.06064 | 0.1351 | 5694 | 0.8925 | -0.162 | 0.1784 |
fixed | NA | count_birth_order2/4 | 0.05461 | 0.06234 | 0.8759 | 5704 | 0.3811 | -0.1204 | 0.2296 |
fixed | NA | count_birth_order3/4 | -0.07707 | 0.06483 | -1.189 | 5694 | 0.2346 | -0.2591 | 0.1049 |
fixed | NA | count_birth_order4/4 | 0.01361 | 0.06861 | 0.1983 | 5684 | 0.8428 | -0.179 | 0.2062 |
fixed | NA | count_birth_order1/5 | 0.06726 | 0.08109 | 0.8294 | 5704 | 0.4069 | -0.1604 | 0.2949 |
fixed | NA | count_birth_order2/5 | -0.03652 | 0.09006 | -0.4055 | 5659 | 0.6851 | -0.2893 | 0.2163 |
fixed | NA | count_birth_order3/5 | -0.1304 | 0.0861 | -1.515 | 5660 | 0.1299 | -0.3721 | 0.1113 |
fixed | NA | count_birth_order4/5 | 0.03388 | 0.0827 | 0.4096 | 5680 | 0.6821 | -0.1983 | 0.266 |
fixed | NA | count_birth_order5/5 | -0.01935 | 0.08732 | -0.2216 | 5665 | 0.8246 | -0.2645 | 0.2258 |
fixed | NA | count_birth_order1/>5 | -0.01061 | 0.08265 | -0.1284 | 5675 | 0.8979 | -0.2426 | 0.2214 |
fixed | NA | count_birth_order2/>5 | -0.2631 | 0.08334 | -3.158 | 5653 | 0.001599 | -0.4971 | -0.02921 |
fixed | NA | count_birth_order3/>5 | -0.07723 | 0.0815 | -0.9476 | 5629 | 0.3434 | -0.306 | 0.1515 |
fixed | NA | count_birth_order4/>5 | -0.2221 | 0.07927 | -2.802 | 5599 | 0.005092 | -0.4446 | 0.0003803 |
fixed | NA | count_birth_order5/>5 | -0.174 | 0.07346 | -2.368 | 5623 | 0.0179 | -0.3802 | 0.03223 |
fixed | NA | count_birth_order>5/>5 | -0.1797 | 0.05555 | -3.235 | 5279 | 0.001225 | -0.3356 | -0.02376 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3852 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8326 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15200 | 15273 | -7589 | 15178 | NA | NA | NA |
12 | 15200 | 15280 | -7588 | 15176 | 1.251 | 1 | 0.2634 |
16 | 15206 | 15312 | -7587 | 15174 | 2.534 | 4 | 0.6385 |
26 | 15211 | 15384 | -7580 | 15159 | 14.26 | 10 | 0.1615 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = words_immediate)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3533 | 0.1522 | 2.322 | 13861 | 0.02026 | -0.07384 | 0.7804 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.006171 | 0.01459 | 0.4228 | 13811 | 0.6724 | -0.0348 | 0.04714 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004583 | 0.0004298 | -1.066 | 13691 | 0.2864 | -0.001665 | 0.0007483 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006377 | 0.000003962 | 0.161 | 13541 | 0.8721 | -0.00001048 | 0.00001176 |
fixed | NA | male | -0.1026 | 0.01588 | -6.461 | 13510 | 0.0000000001074 | -0.1472 | -0.05803 |
fixed | NA | sibling_count3 | 0.02844 | 0.03284 | 0.8661 | 9962 | 0.3865 | -0.06374 | 0.1206 |
fixed | NA | sibling_count4 | 0.0288 | 0.03393 | 0.8488 | 9172 | 0.396 | -0.06644 | 0.124 |
fixed | NA | sibling_count5 | -0.005082 | 0.03538 | -0.1436 | 8311 | 0.8858 | -0.1044 | 0.09423 |
fixed | NA | sibling_count>5 | -0.1109 | 0.02768 | -4.006 | 9265 | 0.00006234 | -0.1886 | -0.03318 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3956 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8692 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3527 | 0.1522 | 2.318 | 13861 | 0.02046 | -0.07442 | 0.7799 |
fixed | NA | birth_order | -0.002253 | 0.003393 | -0.6641 | 13247 | 0.5066 | -0.01178 | 0.00727 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.006857 | 0.01463 | 0.4687 | 13801 | 0.6393 | -0.03421 | 0.04793 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004838 | 0.0004315 | -1.121 | 13642 | 0.2622 | -0.001695 | 0.0007275 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000008756 | 0.000003978 | 0.2201 | 13467 | 0.8258 | -0.00001029 | 0.00001204 |
fixed | NA | male | -0.1025 | 0.01588 | -6.457 | 13510 | 0.0000000001105 | -0.1471 | -0.05796 |
fixed | NA | sibling_count3 | 0.02891 | 0.03285 | 0.8802 | 9978 | 0.3788 | -0.06329 | 0.1211 |
fixed | NA | sibling_count4 | 0.03031 | 0.034 | 0.8913 | 9240 | 0.3728 | -0.06514 | 0.1257 |
fixed | NA | sibling_count5 | -0.002406 | 0.03561 | -0.06757 | 8434 | 0.9461 | -0.1024 | 0.09755 |
fixed | NA | sibling_count>5 | -0.1024 | 0.03047 | -3.361 | 10417 | 0.0007793 | -0.188 | -0.01688 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3954 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8693 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3551 | 0.1526 | 2.327 | 13859 | 0.01998 | -0.07323 | 0.7834 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007002 | 0.01463 | 0.4784 | 13804 | 0.6324 | -0.03408 | 0.04808 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004887 | 0.0004316 | -1.132 | 13647 | 0.2575 | -0.0017 | 0.0007229 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000009008 | 0.00000398 | 0.2264 | 13462 | 0.8209 | -0.00001027 | 0.00001207 |
fixed | NA | male | -0.1025 | 0.01588 | -6.451 | 13505 | 0.0000000001149 | -0.147 | -0.05788 |
fixed | NA | sibling_count3 | 0.02886 | 0.03328 | 0.8672 | 10301 | 0.3859 | -0.06455 | 0.1223 |
fixed | NA | sibling_count4 | 0.02953 | 0.0349 | 0.8461 | 9895 | 0.3975 | -0.06843 | 0.1275 |
fixed | NA | sibling_count5 | -0.00005737 | 0.03689 | -0.001555 | 9291 | 0.9988 | -0.1036 | 0.1035 |
fixed | NA | sibling_count>5 | -0.09666 | 0.03193 | -3.027 | 11404 | 0.002472 | -0.1863 | -0.007037 |
fixed | NA | birth_order_nonlinear2 | -0.01544 | 0.02294 | -0.6729 | 12530 | 0.501 | -0.07983 | 0.04896 |
fixed | NA | birth_order_nonlinear3 | -0.008737 | 0.02705 | -0.323 | 12226 | 0.7467 | -0.08467 | 0.06719 |
fixed | NA | birth_order_nonlinear4 | -0.005941 | 0.03082 | -0.1928 | 12252 | 0.8471 | -0.09245 | 0.08057 |
fixed | NA | birth_order_nonlinear5 | -0.03387 | 0.03506 | -0.9661 | 12247 | 0.334 | -0.1323 | 0.06455 |
fixed | NA | birth_order_nonlinear>5 | -0.03147 | 0.02934 | -1.073 | 13837 | 0.2834 | -0.1138 | 0.05088 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3954 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8694 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3423 | 0.1532 | 2.234 | 13851 | 0.02551 | -0.08784 | 0.7725 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007367 | 0.01464 | 0.5033 | 13793 | 0.6148 | -0.03372 | 0.04846 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005014 | 0.0004317 | -1.161 | 13630 | 0.2455 | -0.001713 | 0.0007105 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001029 | 0.000003981 | 0.2583 | 13437 | 0.7962 | -0.00001015 | 0.0000122 |
fixed | NA | male | -0.1027 | 0.01589 | -6.463 | 13496 | 0.000000000106 | -0.1473 | -0.05809 |
fixed | NA | count_birth_order2/2 | 0.01152 | 0.04462 | 0.2582 | 12658 | 0.7963 | -0.1137 | 0.1368 |
fixed | NA | count_birth_order1/3 | 0.03433 | 0.04294 | 0.7994 | 13632 | 0.4241 | -0.08621 | 0.1549 |
fixed | NA | count_birth_order2/3 | 0.03836 | 0.04795 | 0.8002 | 13776 | 0.4236 | -0.09622 | 0.173 |
fixed | NA | count_birth_order3/3 | 0.01806 | 0.05364 | 0.3367 | 13878 | 0.7364 | -0.1325 | 0.1686 |
fixed | NA | count_birth_order1/4 | 0.009683 | 0.04898 | 0.1977 | 13779 | 0.8433 | -0.1278 | 0.1472 |
fixed | NA | count_birth_order2/4 | 0.06327 | 0.05141 | 1.231 | 13827 | 0.2185 | -0.08104 | 0.2076 |
fixed | NA | count_birth_order3/4 | 0.0178 | 0.0558 | 0.3189 | 13896 | 0.7498 | -0.1388 | 0.1744 |
fixed | NA | count_birth_order4/4 | 0.04206 | 0.05908 | 0.7118 | 13918 | 0.4766 | -0.1238 | 0.2079 |
fixed | NA | count_birth_order1/5 | 0.06302 | 0.05549 | 1.136 | 13874 | 0.2561 | -0.09274 | 0.2188 |
fixed | NA | count_birth_order2/5 | -0.05377 | 0.05819 | -0.9241 | 13906 | 0.3554 | -0.2171 | 0.1096 |
fixed | NA | count_birth_order3/5 | -0.02803 | 0.05982 | -0.4686 | 13919 | 0.6394 | -0.196 | 0.1399 |
fixed | NA | count_birth_order4/5 | -0.007194 | 0.06332 | -0.1136 | 13926 | 0.9095 | -0.1849 | 0.1705 |
fixed | NA | count_birth_order5/5 | 0.007012 | 0.06469 | 0.1084 | 13924 | 0.9137 | -0.1746 | 0.1886 |
fixed | NA | count_birth_order1/>5 | -0.07213 | 0.0447 | -1.614 | 13923 | 0.1066 | -0.1976 | 0.05333 |
fixed | NA | count_birth_order2/>5 | -0.135 | 0.04606 | -2.931 | 13926 | 0.003388 | -0.2643 | -0.005695 |
fixed | NA | count_birth_order3/>5 | -0.06838 | 0.04515 | -1.514 | 13925 | 0.13 | -0.1951 | 0.05837 |
fixed | NA | count_birth_order4/>5 | -0.09254 | 0.04425 | -2.091 | 13926 | 0.03652 | -0.2168 | 0.03167 |
fixed | NA | count_birth_order5/>5 | -0.1312 | 0.04458 | -2.943 | 13925 | 0.003258 | -0.2563 | -0.006053 |
fixed | NA | count_birth_order>5/>5 | -0.1183 | 0.03526 | -3.355 | 12476 | 0.0007951 | -0.2173 | -0.01934 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3952 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8695 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 38025 | 38108 | -19002 | 38003 | NA | NA | NA |
12 | 38027 | 38117 | -19001 | 38003 | 0.4421 | 1 | 0.5061 |
16 | 38034 | 38154 | -19001 | 38002 | 1.325 | 4 | 0.8572 |
26 | 38046 | 38242 | -18997 | 37994 | 7.138 | 10 | 0.7124 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2703 | 0.4011 | 0.6739 | 5871 | 0.5004 | -0.8556 | 1.396 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0125 | 0.04552 | 0.2745 | 5875 | 0.7837 | -0.1153 | 0.1403 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003482 | 0.001625 | -0.2144 | 5880 | 0.8303 | -0.004909 | 0.004212 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000000429 | 0.0000184 | 0.02331 | 5886 | 0.9814 | -0.00005122 | 0.00005208 |
fixed | NA | male | -0.1315 | 0.02342 | -5.616 | 5806 | 0.00000002042 | -0.1973 | -0.06579 |
fixed | NA | sibling_count3 | 0.03636 | 0.03708 | 0.9806 | 4374 | 0.3269 | -0.06773 | 0.1405 |
fixed | NA | sibling_count4 | -0.08697 | 0.03999 | -2.175 | 3878 | 0.02971 | -0.1992 | 0.02528 |
fixed | NA | sibling_count5 | -0.1077 | 0.04571 | -2.357 | 3490 | 0.01849 | -0.236 | 0.02058 |
fixed | NA | sibling_count>5 | -0.1732 | 0.04014 | -4.315 | 3295 | 0.00001642 | -0.2859 | -0.06054 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3506 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8393 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2706 | 0.4012 | 0.6746 | 5870 | 0.4999 | -0.8555 | 1.397 |
fixed | NA | birth_order | -0.0004093 | 0.007764 | -0.05271 | 5876 | 0.958 | -0.0222 | 0.02139 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01252 | 0.04552 | 0.2749 | 5874 | 0.7834 | -0.1153 | 0.1403 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003483 | 0.001625 | -0.2144 | 5879 | 0.8303 | -0.004909 | 0.004212 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000004136 | 0.0000184 | 0.02247 | 5884 | 0.9821 | -0.00005125 | 0.00005208 |
fixed | NA | male | -0.1315 | 0.02342 | -5.614 | 5805 | 0.00000002065 | -0.1973 | -0.06576 |
fixed | NA | sibling_count3 | 0.03656 | 0.03728 | 0.9808 | 4381 | 0.3268 | -0.06808 | 0.1412 |
fixed | NA | sibling_count4 | -0.08649 | 0.04099 | -2.11 | 3892 | 0.0349 | -0.2015 | 0.02856 |
fixed | NA | sibling_count5 | -0.107 | 0.04802 | -2.227 | 3582 | 0.02599 | -0.2417 | 0.02784 |
fixed | NA | sibling_count>5 | -0.1717 | 0.04976 | -3.45 | 3832 | 0.0005666 | -0.3114 | -0.032 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3506 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8393 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3012 | 0.4018 | 0.7496 | 5874 | 0.4535 | -0.8266 | 1.429 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01015 | 0.04555 | 0.2228 | 5874 | 0.8237 | -0.1177 | 0.138 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002567 | 0.001626 | -0.1579 | 5877 | 0.8745 | -0.00482 | 0.004307 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000007896 | 0.00001842 | -0.04287 | 5882 | 0.9658 | -0.00005249 | 0.00005091 |
fixed | NA | male | -0.1317 | 0.02342 | -5.625 | 5799 | 0.0000000194 | -0.1975 | -0.066 |
fixed | NA | sibling_count3 | 0.03149 | 0.03803 | 0.8279 | 4565 | 0.4077 | -0.07527 | 0.1382 |
fixed | NA | sibling_count4 | -0.08309 | 0.04257 | -1.952 | 4220 | 0.05101 | -0.2026 | 0.0364 |
fixed | NA | sibling_count5 | -0.08576 | 0.05042 | -1.701 | 4018 | 0.08907 | -0.2273 | 0.05578 |
fixed | NA | sibling_count>5 | -0.1567 | 0.05121 | -3.06 | 4096 | 0.00223 | -0.3005 | -0.01294 |
fixed | NA | birth_order_nonlinear2 | -0.03205 | 0.03018 | -1.062 | 4910 | 0.2882 | -0.1168 | 0.05265 |
fixed | NA | birth_order_nonlinear3 | 0.02066 | 0.03726 | 0.5544 | 5133 | 0.5793 | -0.08393 | 0.1252 |
fixed | NA | birth_order_nonlinear4 | -0.04889 | 0.04612 | -1.06 | 5285 | 0.2891 | -0.1783 | 0.08056 |
fixed | NA | birth_order_nonlinear5 | -0.09808 | 0.05756 | -1.704 | 5140 | 0.08844 | -0.2597 | 0.06349 |
fixed | NA | birth_order_nonlinear>5 | -0.00781 | 0.05794 | -0.1348 | 5888 | 0.8928 | -0.1704 | 0.1548 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3513 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8389 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.326 | 0.4027 | 0.8094 | 5866 | 0.4183 | -0.8044 | 1.456 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007183 | 0.04565 | 0.1573 | 5864 | 0.875 | -0.121 | 0.1353 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001525 | 0.00163 | -0.09357 | 5868 | 0.9255 | -0.004727 | 0.004422 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000193 | 0.00001846 | -0.1045 | 5873 | 0.9167 | -0.00005376 | 0.0000499 |
fixed | NA | male | -0.1314 | 0.02344 | -5.606 | 5788 | 0.00000002162 | -0.1972 | -0.06562 |
fixed | NA | count_birth_order2/2 | -0.02869 | 0.05464 | -0.5251 | 5190 | 0.5995 | -0.1821 | 0.1247 |
fixed | NA | count_birth_order1/3 | 0.03888 | 0.04861 | 0.7998 | 5867 | 0.4239 | -0.09758 | 0.1753 |
fixed | NA | count_birth_order2/3 | 0.0252 | 0.05306 | 0.475 | 5899 | 0.6348 | -0.1238 | 0.1742 |
fixed | NA | count_birth_order3/3 | 0.006071 | 0.05925 | 0.1025 | 5908 | 0.9184 | -0.1603 | 0.1724 |
fixed | NA | count_birth_order1/4 | -0.09194 | 0.05943 | -1.547 | 5893 | 0.1219 | -0.2588 | 0.07489 |
fixed | NA | count_birth_order2/4 | -0.1157 | 0.0614 | -1.883 | 5908 | 0.05968 | -0.288 | 0.05671 |
fixed | NA | count_birth_order3/4 | -0.0483 | 0.06482 | -0.7451 | 5902 | 0.4562 | -0.2303 | 0.1337 |
fixed | NA | count_birth_order4/4 | -0.1287 | 0.06748 | -1.907 | 5900 | 0.05655 | -0.3181 | 0.06072 |
fixed | NA | count_birth_order1/5 | -0.1045 | 0.08064 | -1.296 | 5907 | 0.1951 | -0.3308 | 0.1219 |
fixed | NA | count_birth_order2/5 | -0.07683 | 0.08625 | -0.8907 | 5883 | 0.3731 | -0.3189 | 0.1653 |
fixed | NA | count_birth_order3/5 | -0.06136 | 0.08085 | -0.7589 | 5884 | 0.4479 | -0.2883 | 0.1656 |
fixed | NA | count_birth_order4/5 | -0.1804 | 0.0779 | -2.316 | 5895 | 0.02059 | -0.3991 | 0.03825 |
fixed | NA | count_birth_order5/5 | -0.1471 | 0.08104 | -1.816 | 5882 | 0.06946 | -0.3746 | 0.08034 |
fixed | NA | count_birth_order1/>5 | -0.1353 | 0.07997 | -1.692 | 5896 | 0.09067 | -0.3598 | 0.08916 |
fixed | NA | count_birth_order2/>5 | -0.2916 | 0.07915 | -3.684 | 5884 | 0.0002313 | -0.5138 | -0.06944 |
fixed | NA | count_birth_order3/>5 | -0.06251 | 0.07924 | -0.7889 | 5857 | 0.4302 | -0.2849 | 0.1599 |
fixed | NA | count_birth_order4/>5 | -0.1658 | 0.07465 | -2.221 | 5854 | 0.02637 | -0.3754 | 0.04373 |
fixed | NA | count_birth_order5/>5 | -0.2781 | 0.07055 | -3.942 | 5858 | 0.00008161 | -0.4762 | -0.0801 |
fixed | NA | count_birth_order>5/>5 | -0.1635 | 0.05347 | -3.058 | 5448 | 0.002235 | -0.3136 | -0.01344 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3506 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8395 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15660 | 15733 | -7819 | 15638 | NA | NA | NA |
12 | 15662 | 15742 | -7819 | 15638 | 0.002809 | 1 | 0.9577 |
16 | 15664 | 15771 | -7816 | 15632 | 6.129 | 4 | 0.1897 |
26 | 15677 | 15851 | -7813 | 15625 | 6.632 | 10 | 0.7597 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3023 | 0.4002 | 0.7553 | 5922 | 0.4501 | -0.8211 | 1.426 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00985 | 0.04544 | 0.2168 | 5925 | 0.8284 | -0.1177 | 0.1374 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002896 | 0.001622 | -0.1786 | 5930 | 0.8583 | -0.004843 | 0.004264 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000002249 | 0.00001838 | -0.01224 | 5936 | 0.9902 | -0.00005181 | 0.00005136 |
fixed | NA | male | -0.1318 | 0.02335 | -5.645 | 5854 | 0.00000001732 | -0.1973 | -0.06625 |
fixed | NA | sibling_count3 | 0.03106 | 0.04014 | 0.7739 | 4530 | 0.439 | -0.08161 | 0.1437 |
fixed | NA | sibling_count4 | -0.06748 | 0.04232 | -1.595 | 4143 | 0.1109 | -0.1863 | 0.05131 |
fixed | NA | sibling_count5 | -0.05013 | 0.04535 | -1.105 | 3744 | 0.269 | -0.1774 | 0.07717 |
fixed | NA | sibling_count>5 | -0.1294 | 0.03973 | -3.257 | 3867 | 0.001135 | -0.2409 | -0.01788 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3519 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8397 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3119 | 0.4003 | 0.7792 | 5921 | 0.4359 | -0.8116 | 1.435 |
fixed | NA | birth_order | -0.008494 | 0.00679 | -1.251 | 5774 | 0.211 | -0.02755 | 0.01057 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009959 | 0.04544 | 0.2192 | 5924 | 0.8265 | -0.1176 | 0.1375 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002798 | 0.001622 | -0.1725 | 5928 | 0.8631 | -0.004833 | 0.004273 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006759 | 0.00001838 | -0.03678 | 5935 | 0.9707 | -0.00005226 | 0.00005091 |
fixed | NA | male | -0.1315 | 0.02335 | -5.631 | 5853 | 0.00000001873 | -0.197 | -0.06594 |
fixed | NA | sibling_count3 | 0.03519 | 0.04027 | 0.8737 | 4530 | 0.3823 | -0.07786 | 0.1482 |
fixed | NA | sibling_count4 | -0.05807 | 0.04298 | -1.351 | 4137 | 0.1767 | -0.1787 | 0.06257 |
fixed | NA | sibling_count5 | -0.03529 | 0.04687 | -0.7529 | 3767 | 0.4515 | -0.1669 | 0.09628 |
fixed | NA | sibling_count>5 | -0.09817 | 0.04692 | -2.092 | 4181 | 0.03648 | -0.2299 | 0.03354 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3517 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8398 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3142 | 0.4008 | 0.7839 | 5924 | 0.4331 | -0.8108 | 1.439 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009226 | 0.04545 | 0.203 | 5923 | 0.8392 | -0.1184 | 0.1368 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002426 | 0.001623 | -0.1495 | 5927 | 0.8812 | -0.004798 | 0.004313 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001365 | 0.00001839 | -0.07425 | 5932 | 0.9408 | -0.00005298 | 0.00005025 |
fixed | NA | male | -0.1316 | 0.02335 | -5.636 | 5847 | 0.00000001818 | -0.1971 | -0.06606 |
fixed | NA | sibling_count3 | 0.03017 | 0.04099 | 0.7361 | 4682 | 0.4617 | -0.0849 | 0.1452 |
fixed | NA | sibling_count4 | -0.05283 | 0.04447 | -1.188 | 4420 | 0.235 | -0.1777 | 0.07201 |
fixed | NA | sibling_count5 | -0.02045 | 0.04908 | -0.4166 | 4158 | 0.677 | -0.1582 | 0.1173 |
fixed | NA | sibling_count>5 | -0.07574 | 0.04836 | -1.566 | 4456 | 0.1174 | -0.2115 | 0.06 |
fixed | NA | birth_order_nonlinear2 | -0.02291 | 0.03076 | -0.7446 | 5045 | 0.4566 | -0.1093 | 0.06345 |
fixed | NA | birth_order_nonlinear3 | 0.00622 | 0.03718 | 0.1673 | 5257 | 0.8671 | -0.09814 | 0.1106 |
fixed | NA | birth_order_nonlinear4 | -0.07617 | 0.04479 | -1.701 | 5413 | 0.08908 | -0.2019 | 0.04956 |
fixed | NA | birth_order_nonlinear5 | -0.09325 | 0.05494 | -1.697 | 5348 | 0.08968 | -0.2475 | 0.06096 |
fixed | NA | birth_order_nonlinear>5 | -0.09131 | 0.05184 | -1.761 | 5969 | 0.07821 | -0.2368 | 0.0542 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.353 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8392 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3186 | 0.4016 | 0.7935 | 5918 | 0.4275 | -0.8086 | 1.446 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00678 | 0.04552 | 0.1489 | 5915 | 0.8816 | -0.121 | 0.1346 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001478 | 0.001626 | -0.09093 | 5920 | 0.9275 | -0.004711 | 0.004415 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002497 | 0.00001842 | -0.1355 | 5925 | 0.8922 | -0.00005421 | 0.00004922 |
fixed | NA | male | -0.1314 | 0.02337 | -5.623 | 5839 | 0.00000001967 | -0.197 | -0.06579 |
fixed | NA | count_birth_order2/2 | 0.02163 | 0.05991 | 0.361 | 5313 | 0.7181 | -0.1465 | 0.1898 |
fixed | NA | count_birth_order1/3 | 0.05145 | 0.05267 | 0.9768 | 5919 | 0.3287 | -0.09639 | 0.1993 |
fixed | NA | count_birth_order2/3 | 0.03833 | 0.05711 | 0.6712 | 5948 | 0.5021 | -0.122 | 0.1986 |
fixed | NA | count_birth_order3/3 | 0.01506 | 0.06423 | 0.2345 | 5959 | 0.8146 | -0.1652 | 0.1953 |
fixed | NA | count_birth_order1/4 | -0.06686 | 0.06228 | -1.073 | 5944 | 0.2831 | -0.2417 | 0.108 |
fixed | NA | count_birth_order2/4 | -0.05847 | 0.06323 | -0.9247 | 5957 | 0.3552 | -0.236 | 0.119 |
fixed | NA | count_birth_order3/4 | -0.03496 | 0.06945 | -0.5034 | 5954 | 0.6147 | -0.2299 | 0.16 |
fixed | NA | count_birth_order4/4 | -0.06921 | 0.07172 | -0.965 | 5953 | 0.3346 | -0.2705 | 0.1321 |
fixed | NA | count_birth_order1/5 | 0.02871 | 0.07388 | 0.3886 | 5958 | 0.6976 | -0.1787 | 0.2361 |
fixed | NA | count_birth_order2/5 | 0.0003236 | 0.07927 | 0.004082 | 5948 | 0.9967 | -0.2222 | 0.2228 |
fixed | NA | count_birth_order3/5 | -0.009014 | 0.07708 | -0.1169 | 5946 | 0.9069 | -0.2254 | 0.2074 |
fixed | NA | count_birth_order4/5 | -0.09693 | 0.07987 | -1.214 | 5934 | 0.225 | -0.3211 | 0.1273 |
fixed | NA | count_birth_order5/5 | -0.1483 | 0.08009 | -1.851 | 5934 | 0.06419 | -0.3731 | 0.07655 |
fixed | NA | count_birth_order1/>5 | -0.02559 | 0.07021 | -0.3644 | 5959 | 0.7156 | -0.2227 | 0.1715 |
fixed | NA | count_birth_order2/>5 | -0.1887 | 0.07328 | -2.575 | 5944 | 0.01004 | -0.3944 | 0.01698 |
fixed | NA | count_birth_order3/>5 | 0.00315 | 0.07175 | 0.04391 | 5932 | 0.965 | -0.1983 | 0.2046 |
fixed | NA | count_birth_order4/>5 | -0.1667 | 0.06916 | -2.41 | 5931 | 0.01597 | -0.3609 | 0.02744 |
fixed | NA | count_birth_order5/>5 | -0.1191 | 0.07104 | -1.676 | 5900 | 0.09374 | -0.3185 | 0.08032 |
fixed | NA | count_birth_order>5/>5 | -0.1524 | 0.0524 | -2.909 | 5556 | 0.003643 | -0.2995 | -0.00533 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3507 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8402 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15806 | 15880 | -7892 | 15784 | NA | NA | NA |
12 | 15807 | 15887 | -7891 | 15783 | 1.568 | 1 | 0.2105 |
16 | 15810 | 15917 | -7889 | 15778 | 5.324 | 4 | 0.2556 |
26 | 15821 | 15996 | -7885 | 15769 | 8.136 | 10 | 0.6156 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2817 | 0.4058 | 0.6942 | 5753 | 0.4876 | -0.8573 | 1.421 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0102 | 0.04607 | 0.2214 | 5757 | 0.8248 | -0.1191 | 0.1395 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002244 | 0.001645 | -0.1364 | 5761 | 0.8915 | -0.004841 | 0.004392 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001458 | 0.00001864 | -0.0782 | 5767 | 0.9377 | -0.00005378 | 0.00005086 |
fixed | NA | male | -0.127 | 0.02366 | -5.368 | 5688 | 0.00000008287 | -0.1934 | -0.06058 |
fixed | NA | sibling_count3 | 0.01622 | 0.03661 | 0.443 | 4282 | 0.6578 | -0.08655 | 0.119 |
fixed | NA | sibling_count4 | -0.08336 | 0.03974 | -2.098 | 3812 | 0.03597 | -0.1949 | 0.02818 |
fixed | NA | sibling_count5 | -0.1066 | 0.04688 | -2.274 | 3333 | 0.02303 | -0.2382 | 0.02499 |
fixed | NA | sibling_count>5 | -0.1814 | 0.04062 | -4.467 | 3144 | 0.000008212 | -0.2955 | -0.06742 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3519 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8386 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2826 | 0.4058 | 0.6965 | 5752 | 0.4862 | -0.8566 | 1.422 |
fixed | NA | birth_order | -0.001434 | 0.007998 | -0.1793 | 5778 | 0.8577 | -0.02388 | 0.02102 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01029 | 0.04608 | 0.2234 | 5756 | 0.8232 | -0.119 | 0.1396 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002252 | 0.001645 | -0.1369 | 5760 | 0.8911 | -0.004842 | 0.004392 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001507 | 0.00001864 | -0.08082 | 5765 | 0.9356 | -0.00005384 | 0.00005082 |
fixed | NA | male | -0.127 | 0.02366 | -5.365 | 5687 | 0.00000008392 | -0.1934 | -0.06054 |
fixed | NA | sibling_count3 | 0.01692 | 0.03683 | 0.4595 | 4287 | 0.6459 | -0.08645 | 0.1203 |
fixed | NA | sibling_count4 | -0.08173 | 0.04077 | -2.005 | 3838 | 0.04508 | -0.1962 | 0.03272 |
fixed | NA | sibling_count5 | -0.104 | 0.04907 | -2.12 | 3420 | 0.03411 | -0.2417 | 0.03373 |
fixed | NA | sibling_count>5 | -0.1761 | 0.05051 | -3.486 | 3773 | 0.0004965 | -0.3178 | -0.03428 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3519 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8387 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3087 | 0.4063 | 0.7598 | 5755 | 0.4474 | -0.8318 | 1.449 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.008334 | 0.04608 | 0.1809 | 5754 | 0.8565 | -0.121 | 0.1377 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001465 | 0.001645 | -0.08904 | 5757 | 0.9291 | -0.004765 | 0.004472 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002585 | 0.00001865 | -0.1386 | 5761 | 0.8898 | -0.00005493 | 0.00004976 |
fixed | NA | male | -0.1268 | 0.02365 | -5.361 | 5678 | 0.00000008592 | -0.1932 | -0.06042 |
fixed | NA | sibling_count3 | 0.007929 | 0.03761 | 0.2108 | 4468 | 0.833 | -0.09764 | 0.1135 |
fixed | NA | sibling_count4 | -0.08449 | 0.04241 | -1.992 | 4162 | 0.04639 | -0.2035 | 0.03455 |
fixed | NA | sibling_count5 | -0.08849 | 0.05131 | -1.724 | 3804 | 0.08471 | -0.2325 | 0.05555 |
fixed | NA | sibling_count>5 | -0.1624 | 0.05206 | -3.12 | 4052 | 0.001822 | -0.3085 | -0.01628 |
fixed | NA | birth_order_nonlinear2 | -0.03418 | 0.03009 | -1.136 | 4792 | 0.2561 | -0.1186 | 0.05029 |
fixed | NA | birth_order_nonlinear3 | 0.03246 | 0.03725 | 0.8714 | 4995 | 0.3836 | -0.0721 | 0.137 |
fixed | NA | birth_order_nonlinear4 | -0.04026 | 0.04743 | -0.8487 | 5143 | 0.3961 | -0.1734 | 0.09289 |
fixed | NA | birth_order_nonlinear5 | -0.1089 | 0.06002 | -1.814 | 5024 | 0.06979 | -0.2774 | 0.05963 |
fixed | NA | birth_order_nonlinear>5 | -0.01919 | 0.05976 | -0.3212 | 5744 | 0.7481 | -0.1869 | 0.1485 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3542 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8375 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3267 | 0.4074 | 0.8019 | 5748 | 0.4226 | -0.8169 | 1.47 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.006268 | 0.04621 | 0.1357 | 5746 | 0.8921 | -0.1234 | 0.136 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007614 | 0.00165 | -0.04615 | 5749 | 0.9632 | -0.004707 | 0.004555 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003334 | 0.0000187 | -0.1783 | 5754 | 0.8585 | -0.00005584 | 0.00004917 |
fixed | NA | male | -0.1272 | 0.02368 | -5.373 | 5667 | 0.00000008065 | -0.1937 | -0.06076 |
fixed | NA | count_birth_order2/2 | -0.03157 | 0.05319 | -0.5935 | 5032 | 0.5529 | -0.1809 | 0.1177 |
fixed | NA | count_birth_order1/3 | 0.00815 | 0.04803 | 0.1697 | 5748 | 0.8653 | -0.1267 | 0.143 |
fixed | NA | count_birth_order2/3 | -0.003243 | 0.05303 | -0.06115 | 5784 | 0.9512 | -0.1521 | 0.1456 |
fixed | NA | count_birth_order3/3 | 0.01332 | 0.0582 | 0.2289 | 5789 | 0.8189 | -0.15 | 0.1767 |
fixed | NA | count_birth_order1/4 | -0.07328 | 0.05972 | -1.227 | 5780 | 0.2198 | -0.2409 | 0.09435 |
fixed | NA | count_birth_order2/4 | -0.1149 | 0.0613 | -1.874 | 5789 | 0.06101 | -0.287 | 0.05721 |
fixed | NA | count_birth_order3/4 | -0.05864 | 0.06415 | -0.9141 | 5781 | 0.3607 | -0.2387 | 0.1214 |
fixed | NA | count_birth_order4/4 | -0.1343 | 0.06788 | -1.978 | 5774 | 0.04795 | -0.3248 | 0.05626 |
fixed | NA | count_birth_order1/5 | -0.112 | 0.08048 | -1.391 | 5789 | 0.1642 | -0.3379 | 0.1139 |
fixed | NA | count_birth_order2/5 | -0.09691 | 0.08883 | -1.091 | 5757 | 0.2753 | -0.3463 | 0.1524 |
fixed | NA | count_birth_order3/5 | -0.05437 | 0.08475 | -0.6416 | 5757 | 0.5212 | -0.2923 | 0.1835 |
fixed | NA | count_birth_order4/5 | -0.1419 | 0.08168 | -1.738 | 5771 | 0.08234 | -0.3712 | 0.08735 |
fixed | NA | count_birth_order5/5 | -0.174 | 0.08675 | -2.006 | 5757 | 0.04491 | -0.4175 | 0.06949 |
fixed | NA | count_birth_order1/>5 | -0.1511 | 0.08185 | -1.846 | 5771 | 0.065 | -0.3808 | 0.07869 |
fixed | NA | count_birth_order2/>5 | -0.2914 | 0.08114 | -3.591 | 5759 | 0.0003317 | -0.5192 | -0.06364 |
fixed | NA | count_birth_order3/>5 | -0.05562 | 0.08034 | -0.6923 | 5731 | 0.4888 | -0.2812 | 0.1699 |
fixed | NA | count_birth_order4/>5 | -0.1748 | 0.07855 | -2.226 | 5705 | 0.02606 | -0.3953 | 0.04565 |
fixed | NA | count_birth_order5/>5 | -0.2837 | 0.07222 | -3.929 | 5730 | 0.00008646 | -0.4864 | -0.08099 |
fixed | NA | count_birth_order>5/>5 | -0.1808 | 0.05448 | -3.319 | 5307 | 0.0009102 | -0.3337 | -0.02788 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3538 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8382 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15343 | 15417 | -7661 | 15321 | NA | NA | NA |
12 | 15345 | 15425 | -7661 | 15321 | 0.03222 | 1 | 0.8575 |
16 | 15346 | 15453 | -7657 | 15314 | 7.259 | 4 | 0.1228 |
26 | 15362 | 15535 | -7655 | 15310 | 4.273 | 10 | 0.9342 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = words_delayed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.309 | 0.1522 | 2.03 | 13839 | 0.04237 | -0.1183 | 0.7362 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01178 | 0.0146 | 0.8074 | 13779 | 0.4194 | -0.02919 | 0.05275 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0006651 | 0.0004297 | -1.548 | 13646 | 0.1217 | -0.001871 | 0.0005411 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001695 | 0.00000396 | 0.4279 | 13487 | 0.6687 | -0.00000942 | 0.00001281 |
fixed | NA | male | -0.07984 | 0.01592 | -5.015 | 13572 | 0.0000005358 | -0.1245 | -0.03515 |
fixed | NA | sibling_count3 | 0.05182 | 0.03269 | 1.585 | 10021 | 0.113 | -0.03996 | 0.1436 |
fixed | NA | sibling_count4 | 0.03874 | 0.03375 | 1.148 | 9202 | 0.2511 | -0.056 | 0.1335 |
fixed | NA | sibling_count5 | 0.007162 | 0.03517 | 0.2037 | 8305 | 0.8386 | -0.09155 | 0.1059 |
fixed | NA | sibling_count>5 | -0.06697 | 0.02754 | -2.432 | 9296 | 0.01505 | -0.1443 | 0.01034 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3767 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8767 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3084 | 0.1522 | 2.026 | 13839 | 0.04274 | -0.1188 | 0.7357 |
fixed | NA | birth_order | -0.001883 | 0.003389 | -0.5557 | 13060 | 0.5784 | -0.0114 | 0.007629 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01235 | 0.01463 | 0.8444 | 13767 | 0.3985 | -0.02872 | 0.05343 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0006861 | 0.0004314 | -1.591 | 13594 | 0.1117 | -0.001897 | 0.0005248 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000189 | 0.000003975 | 0.4754 | 13410 | 0.6345 | -0.000009269 | 0.00001305 |
fixed | NA | male | -0.07979 | 0.01592 | -5.012 | 13571 | 0.0000005458 | -0.1245 | -0.0351 |
fixed | NA | sibling_count3 | 0.05222 | 0.0327 | 1.597 | 10038 | 0.1103 | -0.03958 | 0.144 |
fixed | NA | sibling_count4 | 0.04001 | 0.03383 | 1.183 | 9270 | 0.2369 | -0.05495 | 0.135 |
fixed | NA | sibling_count5 | 0.00941 | 0.0354 | 0.2658 | 8426 | 0.7904 | -0.08995 | 0.1088 |
fixed | NA | sibling_count>5 | -0.05988 | 0.03035 | -1.973 | 10433 | 0.04853 | -0.1451 | 0.02532 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3766 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8767 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3002 | 0.1526 | 1.967 | 13838 | 0.04921 | -0.1282 | 0.7285 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01267 | 0.01463 | 0.8656 | 13771 | 0.3867 | -0.02841 | 0.05375 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007038 | 0.0004314 | -1.631 | 13599 | 0.1029 | -0.001915 | 0.0005073 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002105 | 0.000003976 | 0.5294 | 13405 | 0.5966 | -0.000009057 | 0.00001327 |
fixed | NA | male | -0.07975 | 0.01592 | -5.009 | 13568 | 0.0000005541 | -0.1244 | -0.03506 |
fixed | NA | sibling_count3 | 0.054 | 0.03314 | 1.63 | 10368 | 0.1032 | -0.03901 | 0.147 |
fixed | NA | sibling_count4 | 0.03784 | 0.03474 | 1.089 | 9942 | 0.276 | -0.05967 | 0.1353 |
fixed | NA | sibling_count5 | 0.00649 | 0.03669 | 0.1769 | 9307 | 0.8596 | -0.09651 | 0.1095 |
fixed | NA | sibling_count>5 | -0.05398 | 0.03183 | -1.696 | 11448 | 0.08992 | -0.1433 | 0.03536 |
fixed | NA | birth_order_nonlinear2 | 0.01565 | 0.02303 | 0.6794 | 12559 | 0.4969 | -0.04899 | 0.08029 |
fixed | NA | birth_order_nonlinear3 | -0.008068 | 0.02716 | -0.2971 | 12278 | 0.7664 | -0.08431 | 0.06817 |
fixed | NA | birth_order_nonlinear4 | 0.01986 | 0.03094 | 0.6418 | 12316 | 0.521 | -0.067 | 0.1067 |
fixed | NA | birth_order_nonlinear5 | 0.005391 | 0.0352 | 0.1531 | 12321 | 0.8783 | -0.09343 | 0.1042 |
fixed | NA | birth_order_nonlinear>5 | -0.02652 | 0.02938 | -0.9024 | 13865 | 0.3668 | -0.109 | 0.05596 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3763 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8769 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2999 | 0.1533 | 1.957 | 13832 | 0.0504 | -0.1303 | 0.7302 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0129 | 0.01464 | 0.8813 | 13762 | 0.3782 | -0.02819 | 0.05399 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007085 | 0.0004316 | -1.642 | 13584 | 0.1007 | -0.00192 | 0.0005029 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002131 | 0.000003979 | 0.5357 | 13382 | 0.5922 | -0.000009037 | 0.0000133 |
fixed | NA | male | -0.07974 | 0.01593 | -5.007 | 13556 | 0.0000005593 | -0.1244 | -0.03504 |
fixed | NA | count_birth_order2/2 | 0.008045 | 0.04478 | 0.1796 | 12640 | 0.8574 | -0.1177 | 0.1338 |
fixed | NA | count_birth_order1/3 | 0.06475 | 0.04293 | 1.508 | 13673 | 0.1315 | -0.05575 | 0.1853 |
fixed | NA | count_birth_order2/3 | 0.05148 | 0.04795 | 1.074 | 13795 | 0.283 | -0.08311 | 0.1861 |
fixed | NA | count_birth_order3/3 | 0.03626 | 0.05366 | 0.6757 | 13884 | 0.4992 | -0.1144 | 0.1869 |
fixed | NA | count_birth_order1/4 | 0.006214 | 0.04899 | 0.1268 | 13799 | 0.8991 | -0.1313 | 0.1437 |
fixed | NA | count_birth_order2/4 | 0.1041 | 0.05142 | 2.024 | 13840 | 0.04303 | -0.04029 | 0.2484 |
fixed | NA | count_birth_order3/4 | 0.02208 | 0.05583 | 0.3954 | 13899 | 0.6925 | -0.1346 | 0.1788 |
fixed | NA | count_birth_order4/4 | 0.03046 | 0.05912 | 0.5152 | 13919 | 0.6064 | -0.1355 | 0.1964 |
fixed | NA | count_birth_order1/5 | -0.04227 | 0.05551 | -0.7614 | 13882 | 0.4464 | -0.1981 | 0.1136 |
fixed | NA | count_birth_order2/5 | 0.02579 | 0.05822 | 0.4429 | 13909 | 0.6578 | -0.1376 | 0.1892 |
fixed | NA | count_birth_order3/5 | -0.005886 | 0.05987 | -0.09831 | 13920 | 0.9217 | -0.1739 | 0.1622 |
fixed | NA | count_birth_order4/5 | 0.03416 | 0.06337 | 0.539 | 13926 | 0.5899 | -0.1437 | 0.212 |
fixed | NA | count_birth_order5/5 | 0.06224 | 0.06476 | 0.9611 | 13924 | 0.3365 | -0.1195 | 0.244 |
fixed | NA | count_birth_order1/>5 | -0.03199 | 0.04473 | -0.7153 | 13923 | 0.4745 | -0.1576 | 0.09356 |
fixed | NA | count_birth_order2/>5 | -0.06433 | 0.0461 | -1.395 | 13926 | 0.1629 | -0.1937 | 0.06508 |
fixed | NA | count_birth_order3/>5 | -0.058 | 0.0452 | -1.283 | 13925 | 0.1995 | -0.1849 | 0.06888 |
fixed | NA | count_birth_order4/>5 | -0.03051 | 0.04429 | -0.6888 | 13926 | 0.491 | -0.1548 | 0.09382 |
fixed | NA | count_birth_order5/>5 | -0.06936 | 0.04462 | -1.554 | 13925 | 0.1201 | -0.1946 | 0.05589 |
fixed | NA | count_birth_order>5/>5 | -0.08347 | 0.0352 | -2.372 | 12499 | 0.01773 | -0.1823 | 0.01533 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3767 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8769 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 38051 | 38134 | -19015 | 38029 | NA | NA | NA |
12 | 38053 | 38143 | -19014 | 38029 | 0.3095 | 1 | 0.578 |
16 | 38058 | 38179 | -19013 | 38026 | 2.904 | 4 | 0.574 |
26 | 38072 | 38268 | -19010 | 38020 | 6.247 | 10 | 0.7941 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5229 | 0.4116 | 1.27 | 5873 | 0.204 | -0.6325 | 1.678 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01788 | 0.04671 | -0.3827 | 5877 | 0.7019 | -0.149 | 0.1132 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007731 | 0.001667 | 0.4637 | 5882 | 0.6429 | -0.003907 | 0.005453 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001439 | 0.00001888 | -0.762 | 5888 | 0.4461 | -0.00006739 | 0.00003862 |
fixed | NA | male | -0.115 | 0.02403 | -4.784 | 5811 | 0.000001765 | -0.1824 | -0.04751 |
fixed | NA | sibling_count3 | 0.0267 | 0.03804 | 0.7019 | 4409 | 0.4828 | -0.08008 | 0.1335 |
fixed | NA | sibling_count4 | -0.04166 | 0.04102 | -1.016 | 3917 | 0.3098 | -0.1568 | 0.07348 |
fixed | NA | sibling_count5 | -0.06095 | 0.04688 | -1.3 | 3531 | 0.1937 | -0.1926 | 0.07066 |
fixed | NA | sibling_count>5 | -0.09835 | 0.04118 | -2.388 | 3335 | 0.01698 | -0.2139 | 0.01724 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3583 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8618 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5171 | 0.4117 | 1.256 | 5872 | 0.2091 | -0.6385 | 1.673 |
fixed | NA | birth_order | 0.007062 | 0.007967 | 0.8865 | 5876 | 0.3754 | -0.0153 | 0.02943 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01823 | 0.04672 | -0.3902 | 5877 | 0.6964 | -0.1494 | 0.1129 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007744 | 0.001667 | 0.4645 | 5881 | 0.6423 | -0.003906 | 0.005455 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001412 | 0.00001889 | -0.7477 | 5886 | 0.4547 | -0.00006714 | 0.00003889 |
fixed | NA | male | -0.1153 | 0.02404 | -4.796 | 5810 | 0.000001657 | -0.1828 | -0.04782 |
fixed | NA | sibling_count3 | 0.02326 | 0.03824 | 0.6082 | 4415 | 0.5431 | -0.08409 | 0.1306 |
fixed | NA | sibling_count4 | -0.04983 | 0.04204 | -1.185 | 3930 | 0.236 | -0.1678 | 0.06819 |
fixed | NA | sibling_count5 | -0.07432 | 0.04925 | -1.509 | 3621 | 0.1314 | -0.2126 | 0.06393 |
fixed | NA | sibling_count>5 | -0.1251 | 0.05104 | -2.451 | 3868 | 0.0143 | -0.2684 | 0.01819 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3584 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8618 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.519 | 0.4125 | 1.258 | 5877 | 0.2084 | -0.639 | 1.677 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01781 | 0.04676 | -0.3809 | 5877 | 0.7033 | -0.1491 | 0.1135 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007623 | 0.001669 | 0.4567 | 5881 | 0.6479 | -0.003923 | 0.005448 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001408 | 0.00001891 | -0.7446 | 5885 | 0.4565 | -0.00006716 | 0.000039 |
fixed | NA | male | -0.115 | 0.02405 | -4.78 | 5806 | 0.000001797 | -0.1825 | -0.04745 |
fixed | NA | sibling_count3 | 0.02667 | 0.03902 | 0.6834 | 4598 | 0.4944 | -0.08286 | 0.1362 |
fixed | NA | sibling_count4 | -0.04087 | 0.04367 | -0.9359 | 4255 | 0.3494 | -0.1635 | 0.08171 |
fixed | NA | sibling_count5 | -0.05821 | 0.05172 | -1.125 | 4052 | 0.2605 | -0.2034 | 0.08698 |
fixed | NA | sibling_count>5 | -0.1119 | 0.05254 | -2.13 | 4127 | 0.03319 | -0.2594 | 0.03554 |
fixed | NA | birth_order_nonlinear2 | 0.01206 | 0.031 | 0.3889 | 4938 | 0.6973 | -0.07495 | 0.09907 |
fixed | NA | birth_order_nonlinear3 | 0.0001107 | 0.03827 | 0.002894 | 5157 | 0.9977 | -0.1073 | 0.1075 |
fixed | NA | birth_order_nonlinear4 | -0.003256 | 0.04736 | -0.06875 | 5306 | 0.9452 | -0.1362 | 0.1297 |
fixed | NA | birth_order_nonlinear5 | -0.004436 | 0.05912 | -0.07503 | 5167 | 0.9402 | -0.1704 | 0.1615 |
fixed | NA | birth_order_nonlinear>5 | 0.04355 | 0.05949 | 0.7321 | 5892 | 0.4641 | -0.1234 | 0.2105 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3573 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8625 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5809 | 0.4133 | 1.406 | 5869 | 0.1599 | -0.5792 | 1.741 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02288 | 0.04685 | -0.4885 | 5868 | 0.6252 | -0.1544 | 0.1086 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0009401 | 0.001672 | 0.5622 | 5872 | 0.574 | -0.003754 | 0.005634 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001602 | 0.00001895 | -0.8455 | 5877 | 0.3978 | -0.00006921 | 0.00003717 |
fixed | NA | male | -0.115 | 0.02406 | -4.778 | 5796 | 0.000001813 | -0.1825 | -0.04743 |
fixed | NA | count_birth_order2/2 | -0.03987 | 0.0561 | -0.7107 | 5209 | 0.4773 | -0.1973 | 0.1176 |
fixed | NA | count_birth_order1/3 | 0.01812 | 0.04988 | 0.3633 | 5870 | 0.7164 | -0.1219 | 0.1581 |
fixed | NA | count_birth_order2/3 | 0.03543 | 0.05445 | 0.6507 | 5900 | 0.5153 | -0.1174 | 0.1883 |
fixed | NA | count_birth_order3/3 | -0.0276 | 0.06081 | -0.4539 | 5908 | 0.6499 | -0.1983 | 0.1431 |
fixed | NA | count_birth_order1/4 | -0.09582 | 0.06099 | -1.571 | 5894 | 0.1162 | -0.267 | 0.07537 |
fixed | NA | count_birth_order2/4 | 0.009069 | 0.06301 | 0.1439 | 5908 | 0.8856 | -0.1678 | 0.1859 |
fixed | NA | count_birth_order3/4 | -0.06621 | 0.06652 | -0.9952 | 5903 | 0.3197 | -0.2529 | 0.1205 |
fixed | NA | count_birth_order4/4 | -0.06907 | 0.06925 | -0.9974 | 5900 | 0.3186 | -0.2635 | 0.1253 |
fixed | NA | count_birth_order1/5 | -0.1395 | 0.08275 | -1.686 | 5907 | 0.09183 | -0.3718 | 0.09276 |
fixed | NA | count_birth_order2/5 | -0.03975 | 0.08852 | -0.4491 | 5884 | 0.6534 | -0.2882 | 0.2087 |
fixed | NA | count_birth_order3/5 | -0.08459 | 0.08298 | -1.019 | 5885 | 0.308 | -0.3175 | 0.1483 |
fixed | NA | count_birth_order4/5 | -0.1223 | 0.07995 | -1.53 | 5895 | 0.1261 | -0.3467 | 0.1021 |
fixed | NA | count_birth_order5/5 | 0.02383 | 0.08317 | 0.2865 | 5884 | 0.7745 | -0.2096 | 0.2573 |
fixed | NA | count_birth_order1/>5 | -0.1065 | 0.08207 | -1.298 | 5897 | 0.1944 | -0.3369 | 0.1239 |
fixed | NA | count_birth_order2/>5 | -0.199 | 0.08123 | -2.45 | 5886 | 0.0143 | -0.427 | 0.02897 |
fixed | NA | count_birth_order3/>5 | -0.03194 | 0.08132 | -0.3928 | 5860 | 0.6945 | -0.2602 | 0.1963 |
fixed | NA | count_birth_order4/>5 | -0.08364 | 0.07662 | -1.092 | 5857 | 0.275 | -0.2987 | 0.1314 |
fixed | NA | count_birth_order5/>5 | -0.2049 | 0.0724 | -2.831 | 5861 | 0.004662 | -0.4082 | -0.001705 |
fixed | NA | count_birth_order>5/>5 | -0.08616 | 0.05485 | -1.571 | 5455 | 0.1163 | -0.2401 | 0.06781 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3559 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8628 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15967 | 16040 | -7972 | 15945 | NA | NA | NA |
12 | 15968 | 16048 | -7972 | 15944 | 0.7869 | 1 | 0.375 |
16 | 15976 | 16083 | -7972 | 15944 | 0.1261 | 4 | 0.9981 |
26 | 15984 | 16158 | -7966 | 15932 | 11.94 | 10 | 0.2889 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5618 | 0.4105 | 1.368 | 5925 | 0.1712 | -0.5906 | 1.714 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02052 | 0.04661 | -0.4403 | 5928 | 0.6597 | -0.1514 | 0.1103 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0008411 | 0.001664 | 0.5055 | 5933 | 0.6132 | -0.003829 | 0.005512 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000151 | 0.00001885 | -0.801 | 5939 | 0.4231 | -0.00006801 | 0.00003781 |
fixed | NA | male | -0.117 | 0.02395 | -4.887 | 5859 | 0.000001049 | -0.1843 | -0.04982 |
fixed | NA | sibling_count3 | 0.01493 | 0.04115 | 0.3629 | 4565 | 0.7167 | -0.1006 | 0.1305 |
fixed | NA | sibling_count4 | -0.04601 | 0.04339 | -1.061 | 4182 | 0.289 | -0.1678 | 0.07577 |
fixed | NA | sibling_count5 | -0.007199 | 0.04649 | -0.1548 | 3785 | 0.877 | -0.1377 | 0.1233 |
fixed | NA | sibling_count>5 | -0.08743 | 0.04073 | -2.147 | 3907 | 0.03189 | -0.2018 | 0.0269 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3588 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8621 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5616 | 0.4106 | 1.368 | 5924 | 0.1715 | -0.5911 | 1.714 |
fixed | NA | birth_order | 0.000166 | 0.006964 | 0.02383 | 5775 | 0.981 | -0.01938 | 0.01972 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02052 | 0.04661 | -0.4403 | 5927 | 0.6598 | -0.1514 | 0.1103 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0008408 | 0.001664 | 0.5053 | 5931 | 0.6134 | -0.00383 | 0.005512 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001509 | 0.00001885 | -0.8003 | 5937 | 0.4236 | -0.00006801 | 0.00003783 |
fixed | NA | male | -0.1171 | 0.02395 | -4.887 | 5859 | 0.000001052 | -0.1843 | -0.04982 |
fixed | NA | sibling_count3 | 0.01485 | 0.0413 | 0.3596 | 4565 | 0.7191 | -0.1011 | 0.1308 |
fixed | NA | sibling_count4 | -0.0462 | 0.04407 | -1.048 | 4175 | 0.2946 | -0.1699 | 0.07751 |
fixed | NA | sibling_count5 | -0.007488 | 0.04806 | -0.1558 | 3807 | 0.8762 | -0.1424 | 0.1274 |
fixed | NA | sibling_count>5 | -0.08804 | 0.04811 | -1.83 | 4216 | 0.06735 | -0.2231 | 0.04702 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3589 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8622 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5356 | 0.4112 | 1.302 | 5927 | 0.1928 | -0.6188 | 1.69 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01871 | 0.04664 | -0.4011 | 5927 | 0.6883 | -0.1496 | 0.1122 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007845 | 0.001665 | 0.4711 | 5930 | 0.6376 | -0.00389 | 0.005459 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001472 | 0.00001887 | -0.7799 | 5936 | 0.4355 | -0.00006769 | 0.00003825 |
fixed | NA | male | -0.1163 | 0.02396 | -4.853 | 5854 | 0.000001246 | -0.1835 | -0.04903 |
fixed | NA | sibling_count3 | 0.01644 | 0.04204 | 0.3912 | 4716 | 0.6957 | -0.1016 | 0.1344 |
fixed | NA | sibling_count4 | -0.03607 | 0.0456 | -0.7909 | 4457 | 0.4291 | -0.1641 | 0.09194 |
fixed | NA | sibling_count5 | 0.00655 | 0.05033 | 0.1302 | 4196 | 0.8965 | -0.1347 | 0.1478 |
fixed | NA | sibling_count>5 | -0.05999 | 0.04958 | -1.21 | 4489 | 0.2264 | -0.1992 | 0.07919 |
fixed | NA | birth_order_nonlinear2 | 0.03067 | 0.03158 | 0.9712 | 5073 | 0.3315 | -0.05798 | 0.1193 |
fixed | NA | birth_order_nonlinear3 | -0.00388 | 0.03816 | -0.1017 | 5281 | 0.919 | -0.111 | 0.1032 |
fixed | NA | birth_order_nonlinear4 | -0.03289 | 0.04598 | -0.7153 | 5434 | 0.4745 | -0.1619 | 0.09617 |
fixed | NA | birth_order_nonlinear5 | -0.004899 | 0.05639 | -0.08687 | 5371 | 0.9308 | -0.1632 | 0.1534 |
fixed | NA | birth_order_nonlinear>5 | -0.03593 | 0.05319 | -0.6756 | 5969 | 0.4993 | -0.1852 | 0.1134 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.359 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8622 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5631 | 0.4121 | 1.366 | 5921 | 0.1719 | -0.5938 | 1.72 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02195 | 0.04672 | -0.4699 | 5918 | 0.6384 | -0.1531 | 0.1092 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0009012 | 0.001668 | 0.5401 | 5922 | 0.5891 | -0.003782 | 0.005584 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001601 | 0.00001891 | -0.8466 | 5928 | 0.3972 | -0.00006909 | 0.00003707 |
fixed | NA | male | -0.1161 | 0.02398 | -4.841 | 5845 | 0.000001323 | -0.1834 | -0.04879 |
fixed | NA | count_birth_order2/2 | 0.031 | 0.06149 | 0.5042 | 5331 | 0.6142 | -0.1416 | 0.2036 |
fixed | NA | count_birth_order1/3 | 0.03858 | 0.05405 | 0.7138 | 5921 | 0.4754 | -0.1131 | 0.1903 |
fixed | NA | count_birth_order2/3 | 0.04624 | 0.05861 | 0.789 | 5949 | 0.4302 | -0.1183 | 0.2108 |
fixed | NA | count_birth_order3/3 | -0.03029 | 0.06591 | -0.4596 | 5959 | 0.6458 | -0.2153 | 0.1547 |
fixed | NA | count_birth_order1/4 | -0.09284 | 0.06392 | -1.452 | 5945 | 0.1464 | -0.2723 | 0.08658 |
fixed | NA | count_birth_order2/4 | 0.04085 | 0.06489 | 0.6295 | 5957 | 0.529 | -0.1413 | 0.223 |
fixed | NA | count_birth_order3/4 | -0.03359 | 0.07128 | -0.4712 | 5954 | 0.6375 | -0.2337 | 0.1665 |
fixed | NA | count_birth_order4/4 | -0.05443 | 0.0736 | -0.7396 | 5954 | 0.4596 | -0.261 | 0.1522 |
fixed | NA | count_birth_order1/5 | 0.01304 | 0.07582 | 0.172 | 5958 | 0.8635 | -0.1998 | 0.2259 |
fixed | NA | count_birth_order2/5 | 0.04794 | 0.08135 | 0.5893 | 5948 | 0.5557 | -0.1804 | 0.2763 |
fixed | NA | count_birth_order3/5 | -0.003747 | 0.07911 | -0.04736 | 5946 | 0.9622 | -0.2258 | 0.2183 |
fixed | NA | count_birth_order4/5 | -0.05214 | 0.08197 | -0.6361 | 5935 | 0.5248 | -0.2822 | 0.178 |
fixed | NA | count_birth_order5/5 | 0.01449 | 0.0822 | 0.1763 | 5935 | 0.86 | -0.2162 | 0.2452 |
fixed | NA | count_birth_order1/>5 | -0.04045 | 0.07206 | -0.5613 | 5959 | 0.5746 | -0.2427 | 0.1618 |
fixed | NA | count_birth_order2/>5 | -0.1055 | 0.07521 | -1.403 | 5945 | 0.1607 | -0.3166 | 0.1056 |
fixed | NA | count_birth_order3/>5 | -0.01007 | 0.07364 | -0.1367 | 5933 | 0.8913 | -0.2168 | 0.1966 |
fixed | NA | count_birth_order4/>5 | -0.08782 | 0.07098 | -1.237 | 5932 | 0.2161 | -0.2871 | 0.1114 |
fixed | NA | count_birth_order5/>5 | -0.07425 | 0.07291 | -1.018 | 5902 | 0.3085 | -0.2789 | 0.1304 |
fixed | NA | count_birth_order>5/>5 | -0.09624 | 0.05377 | -1.79 | 5566 | 0.07355 | -0.2472 | 0.0547 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8629 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16110 | 16184 | -8044 | 16088 | NA | NA | NA |
12 | 16112 | 16192 | -8044 | 16088 | 0.0005688 | 1 | 0.981 |
16 | 16117 | 16225 | -8043 | 16085 | 2.665 | 4 | 0.6153 |
26 | 16132 | 16306 | -8040 | 16080 | 5.799 | 10 | 0.8318 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4531 | 0.4156 | 1.09 | 5754 | 0.2757 | -0.7136 | 1.62 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01023 | 0.04719 | -0.2168 | 5757 | 0.8284 | -0.1427 | 0.1222 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0004686 | 0.001685 | 0.2781 | 5761 | 0.7809 | -0.004261 | 0.005198 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001034 | 0.00001909 | -0.5417 | 5767 | 0.588 | -0.00006394 | 0.00004325 |
fixed | NA | male | -0.1113 | 0.02423 | -4.593 | 5690 | 0.000004467 | -0.1793 | -0.04328 |
fixed | NA | sibling_count3 | 0.0278 | 0.03751 | 0.7411 | 4312 | 0.4587 | -0.0775 | 0.1331 |
fixed | NA | sibling_count4 | -0.03086 | 0.04071 | -0.7581 | 3848 | 0.4484 | -0.1451 | 0.08342 |
fixed | NA | sibling_count5 | -0.05099 | 0.04803 | -1.062 | 3372 | 0.2885 | -0.1858 | 0.08383 |
fixed | NA | sibling_count>5 | -0.1063 | 0.04162 | -2.554 | 3184 | 0.01071 | -0.2231 | 0.01055 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3613 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8587 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4481 | 0.4157 | 1.078 | 5753 | 0.2811 | -0.7188 | 1.615 |
fixed | NA | birth_order | 0.007437 | 0.008192 | 0.9078 | 5780 | 0.364 | -0.01556 | 0.03043 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01071 | 0.04719 | -0.2268 | 5757 | 0.8206 | -0.1432 | 0.1218 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0004727 | 0.001685 | 0.2806 | 5760 | 0.779 | -0.004257 | 0.005202 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001009 | 0.0000191 | -0.5283 | 5765 | 0.5973 | -0.00006369 | 0.00004351 |
fixed | NA | male | -0.1115 | 0.02424 | -4.601 | 5689 | 0.000004298 | -0.1795 | -0.04347 |
fixed | NA | sibling_count3 | 0.02415 | 0.03773 | 0.6402 | 4316 | 0.5221 | -0.08175 | 0.1301 |
fixed | NA | sibling_count4 | -0.03934 | 0.04177 | -0.9419 | 3873 | 0.3463 | -0.1566 | 0.07791 |
fixed | NA | sibling_count5 | -0.06446 | 0.05027 | -1.282 | 3458 | 0.1999 | -0.2056 | 0.07666 |
fixed | NA | sibling_count>5 | -0.1342 | 0.05175 | -2.593 | 3809 | 0.009545 | -0.2794 | 0.01106 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3613 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8587 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4518 | 0.4165 | 1.085 | 5758 | 0.278 | -0.7172 | 1.621 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01037 | 0.04723 | -0.2196 | 5758 | 0.8262 | -0.143 | 0.1222 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0004663 | 0.001686 | 0.2765 | 5760 | 0.7821 | -0.004267 | 0.0052 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001016 | 0.00001911 | -0.5316 | 5764 | 0.595 | -0.00006382 | 0.00004349 |
fixed | NA | male | -0.1112 | 0.02425 | -4.585 | 5685 | 0.000004632 | -0.1792 | -0.04311 |
fixed | NA | sibling_count3 | 0.02459 | 0.03852 | 0.6384 | 4500 | 0.5232 | -0.08354 | 0.1327 |
fixed | NA | sibling_count4 | -0.03243 | 0.04344 | -0.7466 | 4196 | 0.4553 | -0.1544 | 0.08949 |
fixed | NA | sibling_count5 | -0.04803 | 0.05255 | -0.9139 | 3839 | 0.3608 | -0.1955 | 0.09949 |
fixed | NA | sibling_count>5 | -0.119 | 0.05332 | -2.231 | 4083 | 0.02571 | -0.2686 | 0.03069 |
fixed | NA | birth_order_nonlinear2 | 0.009103 | 0.03086 | 0.295 | 4820 | 0.768 | -0.07751 | 0.09571 |
fixed | NA | birth_order_nonlinear3 | 0.01424 | 0.03819 | 0.3728 | 5019 | 0.7093 | -0.09296 | 0.1214 |
fixed | NA | birth_order_nonlinear4 | -0.008 | 0.04863 | -0.1645 | 5165 | 0.8693 | -0.1445 | 0.1285 |
fixed | NA | birth_order_nonlinear5 | -0.01714 | 0.06154 | -0.2786 | 5050 | 0.7806 | -0.1899 | 0.1556 |
fixed | NA | birth_order_nonlinear>5 | 0.04256 | 0.06125 | 0.6948 | 5748 | 0.4872 | -0.1294 | 0.2145 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3603 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8594 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4984 | 0.4175 | 1.194 | 5751 | 0.2326 | -0.6735 | 1.67 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01432 | 0.04735 | -0.3024 | 5749 | 0.7623 | -0.1472 | 0.1186 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0006025 | 0.001691 | 0.3564 | 5752 | 0.7216 | -0.004143 | 0.005348 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001163 | 0.00001917 | -0.6066 | 5757 | 0.5441 | -0.00006543 | 0.00004218 |
fixed | NA | male | -0.1119 | 0.02427 | -4.613 | 5674 | 0.000004065 | -0.1801 | -0.04382 |
fixed | NA | count_birth_order2/2 | -0.02321 | 0.05452 | -0.4258 | 5052 | 0.6703 | -0.1763 | 0.1298 |
fixed | NA | count_birth_order1/3 | 0.0164 | 0.0492 | 0.3334 | 5750 | 0.7389 | -0.1217 | 0.1545 |
fixed | NA | count_birth_order2/3 | 0.0359 | 0.05434 | 0.6607 | 5785 | 0.5089 | -0.1166 | 0.1884 |
fixed | NA | count_birth_order3/3 | 0.005022 | 0.05963 | 0.08422 | 5789 | 0.9329 | -0.1624 | 0.1724 |
fixed | NA | count_birth_order1/4 | -0.05444 | 0.06119 | -0.8898 | 5781 | 0.3736 | -0.2262 | 0.1173 |
fixed | NA | count_birth_order2/4 | 0.01122 | 0.06281 | 0.1786 | 5789 | 0.8583 | -0.1651 | 0.1875 |
fixed | NA | count_birth_order3/4 | -0.05586 | 0.06573 | -0.8499 | 5781 | 0.3954 | -0.2404 | 0.1286 |
fixed | NA | count_birth_order4/4 | -0.06476 | 0.06956 | -0.9311 | 5775 | 0.3519 | -0.26 | 0.1305 |
fixed | NA | count_birth_order1/5 | -0.1147 | 0.08246 | -1.39 | 5789 | 0.1645 | -0.3461 | 0.1168 |
fixed | NA | count_birth_order2/5 | -0.0301 | 0.09102 | -0.3307 | 5759 | 0.7409 | -0.2856 | 0.2254 |
fixed | NA | count_birth_order3/5 | -0.04437 | 0.08684 | -0.511 | 5759 | 0.6094 | -0.2881 | 0.1994 |
fixed | NA | count_birth_order4/5 | -0.08581 | 0.0837 | -1.025 | 5772 | 0.3053 | -0.3208 | 0.1491 |
fixed | NA | count_birth_order5/5 | -0.004708 | 0.08889 | -0.05296 | 5759 | 0.9578 | -0.2542 | 0.2448 |
fixed | NA | count_birth_order1/>5 | -0.1188 | 0.08387 | -1.416 | 5772 | 0.1568 | -0.3542 | 0.1167 |
fixed | NA | count_birth_order2/>5 | -0.2097 | 0.08314 | -2.522 | 5761 | 0.01169 | -0.4431 | 0.02369 |
fixed | NA | count_birth_order3/>5 | -0.02078 | 0.08233 | -0.2523 | 5735 | 0.8008 | -0.2519 | 0.2103 |
fixed | NA | count_birth_order4/>5 | -0.1022 | 0.0805 | -1.27 | 5709 | 0.2043 | -0.3281 | 0.1238 |
fixed | NA | count_birth_order5/>5 | -0.1908 | 0.07401 | -2.578 | 5733 | 0.009954 | -0.3985 | 0.01693 |
fixed | NA | count_birth_order>5/>5 | -0.08773 | 0.0558 | -1.572 | 5314 | 0.116 | -0.2444 | 0.06892 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3595 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8599 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15623 | 15696 | -7801 | 15601 | NA | NA | NA |
12 | 15624 | 15704 | -7800 | 15600 | 0.8254 | 1 | 0.3636 |
16 | 15632 | 15739 | -7800 | 15600 | 0.2888 | 4 | 0.9905 |
26 | 15645 | 15818 | -7796 | 15593 | 7.352 | 10 | 0.6918 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = adaptive_numbering)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3787 | 0.1518 | 2.495 | 13899 | 0.01262 | -0.04741 | 0.8049 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0186 | 0.01457 | -1.276 | 13882 | 0.2019 | -0.05949 | 0.0223 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00058 | 0.0004296 | 1.35 | 13811 | 0.177 | -0.0006259 | 0.001786 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001002 | 0.000003964 | -2.527 | 13702 | 0.01151 | -0.00002115 | 0.00000111 |
fixed | NA | male | 0.09485 | 0.01571 | 6.038 | 13201 | 0.000000001602 | 0.05075 | 0.1389 |
fixed | NA | sibling_count3 | 0.032 | 0.03342 | 0.9577 | 9639 | 0.3382 | -0.0618 | 0.1258 |
fixed | NA | sibling_count4 | -0.01255 | 0.03463 | -0.3623 | 8940 | 0.7171 | -0.1098 | 0.08466 |
fixed | NA | sibling_count5 | 0.0188 | 0.03622 | 0.519 | 8209 | 0.6037 | -0.08287 | 0.1205 |
fixed | NA | sibling_count>5 | -0.1474 | 0.02824 | -5.219 | 9034 | 0.0000001843 | -0.2266 | -0.06809 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4629 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8391 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3788 | 0.1518 | 2.495 | 13899 | 0.0126 | -0.04736 | 0.805 |
fixed | NA | birth_order | 0.0008488 | 0.003398 | 0.2498 | 13686 | 0.8028 | -0.008691 | 0.01039 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01886 | 0.01461 | -1.291 | 13876 | 0.1968 | -0.05986 | 0.02215 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00059 | 0.0004315 | 1.367 | 13776 | 0.1715 | -0.0006213 | 0.001801 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001011 | 0.000003983 | -2.539 | 13641 | 0.01113 | -0.00002129 | 0.000001068 |
fixed | NA | male | 0.09483 | 0.01571 | 6.036 | 13198 | 0.000000001619 | 0.05073 | 0.1389 |
fixed | NA | sibling_count3 | 0.03184 | 0.03343 | 0.9526 | 9643 | 0.3408 | -0.06199 | 0.1257 |
fixed | NA | sibling_count4 | -0.01309 | 0.0347 | -0.3773 | 8996 | 0.7059 | -0.1105 | 0.08431 |
fixed | NA | sibling_count5 | 0.0178 | 0.03644 | 0.4886 | 8323 | 0.6252 | -0.08448 | 0.1201 |
fixed | NA | sibling_count>5 | -0.1505 | 0.03095 | -4.863 | 10228 | 0.000001174 | -0.2374 | -0.06363 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4631 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.839 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3755 | 0.1522 | 2.467 | 13895 | 0.01363 | -0.05173 | 0.8028 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01884 | 0.01461 | -1.289 | 13875 | 0.1974 | -0.05985 | 0.02218 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000594 | 0.0004315 | 1.376 | 13777 | 0.1687 | -0.0006173 | 0.001805 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001017 | 0.000003984 | -2.554 | 13635 | 0.01067 | -0.00002136 | 0.000001009 |
fixed | NA | male | 0.0947 | 0.01571 | 6.028 | 13194 | 0.000000001706 | 0.0506 | 0.1388 |
fixed | NA | sibling_count3 | 0.03351 | 0.03383 | 0.9908 | 9953 | 0.3218 | -0.06144 | 0.1285 |
fixed | NA | sibling_count4 | -0.006042 | 0.03553 | -0.1701 | 9610 | 0.865 | -0.1058 | 0.09369 |
fixed | NA | sibling_count5 | 0.01888 | 0.03763 | 0.5017 | 9115 | 0.6159 | -0.08674 | 0.1245 |
fixed | NA | sibling_count>5 | -0.1519 | 0.03232 | -4.701 | 11144 | 0.000002616 | -0.2427 | -0.06122 |
fixed | NA | birth_order_nonlinear2 | 0.006312 | 0.02259 | 0.2794 | 12336 | 0.7799 | -0.0571 | 0.06972 |
fixed | NA | birth_order_nonlinear3 | -0.004016 | 0.02658 | -0.1511 | 11948 | 0.8799 | -0.07863 | 0.0706 |
fixed | NA | birth_order_nonlinear4 | -0.02674 | 0.03029 | -0.8829 | 11934 | 0.3773 | -0.1118 | 0.05828 |
fixed | NA | birth_order_nonlinear5 | 0.04054 | 0.03445 | 1.177 | 11911 | 0.2394 | -0.05617 | 0.1372 |
fixed | NA | birth_order_nonlinear>5 | 0.0124 | 0.02911 | 0.4258 | 13684 | 0.6702 | -0.06933 | 0.09412 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4633 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.839 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3813 | 0.1528 | 2.495 | 13885 | 0.01261 | -0.04771 | 0.8103 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01851 | 0.01461 | -1.267 | 13865 | 0.2053 | -0.05952 | 0.0225 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0005781 | 0.0004316 | 1.339 | 13762 | 0.1804 | -0.0006334 | 0.00179 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000009971 | 0.000003985 | -2.502 | 13612 | 0.01237 | -0.00002116 | 0.000001216 |
fixed | NA | male | 0.09384 | 0.01571 | 5.974 | 13182 | 0.000000002376 | 0.04975 | 0.1379 |
fixed | NA | count_birth_order2/2 | -0.01282 | 0.04393 | -0.2919 | 12643 | 0.7704 | -0.1361 | 0.1105 |
fixed | NA | count_birth_order1/3 | -0.01112 | 0.04301 | -0.2585 | 13409 | 0.796 | -0.1318 | 0.1096 |
fixed | NA | count_birth_order2/3 | 0.06464 | 0.04793 | 1.349 | 13659 | 0.1775 | -0.0699 | 0.1992 |
fixed | NA | count_birth_order3/3 | 0.0586 | 0.05349 | 1.095 | 13826 | 0.2733 | -0.09156 | 0.2088 |
fixed | NA | count_birth_order1/4 | -0.04414 | 0.04894 | -0.9019 | 13651 | 0.3671 | -0.1815 | 0.09324 |
fixed | NA | count_birth_order2/4 | -0.00802 | 0.05143 | -0.156 | 13743 | 0.8761 | -0.1524 | 0.1363 |
fixed | NA | count_birth_order3/4 | 0.01828 | 0.05567 | 0.3283 | 13860 | 0.7427 | -0.138 | 0.1746 |
fixed | NA | count_birth_order4/4 | -0.02113 | 0.05884 | -0.3592 | 13893 | 0.7195 | -0.1863 | 0.144 |
fixed | NA | count_birth_order1/5 | -0.0386 | 0.05535 | -0.6975 | 13811 | 0.4855 | -0.194 | 0.1168 |
fixed | NA | count_birth_order2/5 | 0.0696 | 0.05811 | 1.198 | 13868 | 0.231 | -0.09351 | 0.2327 |
fixed | NA | count_birth_order3/5 | -0.01428 | 0.05957 | -0.2397 | 13892 | 0.8106 | -0.1815 | 0.1529 |
fixed | NA | count_birth_order4/5 | 0.002029 | 0.06299 | 0.03221 | 13904 | 0.9743 | -0.1748 | 0.1788 |
fixed | NA | count_birth_order5/5 | 0.07302 | 0.06434 | 1.135 | 13901 | 0.2564 | -0.1076 | 0.2536 |
fixed | NA | count_birth_order1/>5 | -0.0773 | 0.04455 | -1.735 | 13896 | 0.08278 | -0.2024 | 0.04777 |
fixed | NA | count_birth_order2/>5 | -0.1907 | 0.04587 | -4.157 | 13904 | 0.00003243 | -0.3195 | -0.06193 |
fixed | NA | count_birth_order3/>5 | -0.1895 | 0.04493 | -4.217 | 13904 | 0.0000249 | -0.3156 | -0.06336 |
fixed | NA | count_birth_order4/>5 | -0.1979 | 0.04407 | -4.49 | 13902 | 0.000007175 | -0.3216 | -0.07418 |
fixed | NA | count_birth_order5/>5 | -0.1246 | 0.04435 | -2.81 | 13904 | 0.004968 | -0.2491 | -0.0001122 |
fixed | NA | count_birth_order>5/>5 | -0.1466 | 0.03553 | -4.125 | 12295 | 0.00003725 | -0.2463 | -0.04684 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4635 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8387 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 37830 | 37913 | -18904 | 37808 | NA | NA | NA |
12 | 37832 | 37922 | -18904 | 37808 | 0.0613 | 1 | 0.8045 |
16 | 37836 | 37957 | -18902 | 37804 | 3.594 | 4 | 0.4637 |
26 | 37840 | 38036 | -18894 | 37788 | 15.97 | 10 | 0.1004 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5739 | 0.3823 | -1.501 | 5774 | 0.1333 | -1.647 | 0.4992 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.102 | 0.04338 | 2.351 | 5769 | 0.01874 | -0.01977 | 0.2238 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003674 | 0.001548 | -2.373 | 5767 | 0.01768 | -0.00802 | 0.0006721 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004194 | 0.00001754 | 2.391 | 5770 | 0.01681 | -0.000007288 | 0.00009117 |
fixed | NA | male | 0.03722 | 0.02229 | 1.67 | 5660 | 0.09505 | -0.02535 | 0.09979 |
fixed | NA | sibling_count3 | -0.02318 | 0.03623 | -0.6397 | 4238 | 0.5224 | -0.1249 | 0.07853 |
fixed | NA | sibling_count4 | -0.07966 | 0.03922 | -2.031 | 3813 | 0.04233 | -0.1898 | 0.03044 |
fixed | NA | sibling_count5 | -0.09175 | 0.04495 | -2.041 | 3496 | 0.04132 | -0.2179 | 0.03444 |
fixed | NA | sibling_count>5 | -0.2292 | 0.03956 | -5.795 | 3364 | 0.000000007481 | -0.3403 | -0.1182 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4128 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7721 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.581 | 0.3823 | -1.52 | 5773 | 0.1286 | -1.654 | 0.4921 |
fixed | NA | birth_order | 0.009145 | 0.007438 | 1.229 | 5911 | 0.2189 | -0.01173 | 0.03002 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1014 | 0.04338 | 2.338 | 5769 | 0.01942 | -0.02035 | 0.2232 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003667 | 0.001548 | -2.368 | 5766 | 0.0179 | -0.008013 | 0.0006791 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004223 | 0.00001754 | 2.408 | 5767 | 0.01607 | -0.000006998 | 0.00009147 |
fixed | NA | male | 0.03681 | 0.02229 | 1.651 | 5659 | 0.09872 | -0.02576 | 0.09938 |
fixed | NA | sibling_count3 | -0.02771 | 0.03642 | -0.7608 | 4249 | 0.4468 | -0.1299 | 0.07452 |
fixed | NA | sibling_count4 | -0.09046 | 0.0402 | -2.251 | 3839 | 0.02447 | -0.2033 | 0.02237 |
fixed | NA | sibling_count5 | -0.1094 | 0.04718 | -2.318 | 3609 | 0.02052 | -0.2418 | 0.02309 |
fixed | NA | sibling_count>5 | -0.2643 | 0.04877 | -5.419 | 3923 | 0.00000006361 | -0.4012 | -0.1274 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4131 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7719 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5991 | 0.3831 | -1.564 | 5786 | 0.1179 | -1.674 | 0.4763 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.104 | 0.04342 | 2.395 | 5775 | 0.01665 | -0.01788 | 0.2259 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003757 | 0.00155 | -2.425 | 5770 | 0.01536 | -0.008108 | 0.0005927 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004323 | 0.00001756 | 2.462 | 5769 | 0.01384 | -0.000006057 | 0.00009251 |
fixed | NA | male | 0.03724 | 0.0223 | 1.67 | 5654 | 0.09492 | -0.02534 | 0.09982 |
fixed | NA | sibling_count3 | -0.03169 | 0.0371 | -0.8543 | 4426 | 0.393 | -0.1358 | 0.07245 |
fixed | NA | sibling_count4 | -0.09277 | 0.04163 | -2.228 | 4143 | 0.02591 | -0.2096 | 0.02409 |
fixed | NA | sibling_count5 | -0.1259 | 0.04936 | -2.55 | 4008 | 0.01081 | -0.2644 | 0.01268 |
fixed | NA | sibling_count>5 | -0.2684 | 0.05009 | -5.359 | 4152 | 0.00000008805 | -0.409 | -0.1278 |
fixed | NA | birth_order_nonlinear2 | 0.02271 | 0.02845 | 0.7982 | 4741 | 0.4248 | -0.05715 | 0.1026 |
fixed | NA | birth_order_nonlinear3 | 0.0366 | 0.03519 | 1.04 | 4938 | 0.2984 | -0.06219 | 0.1354 |
fixed | NA | birth_order_nonlinear4 | 0.02322 | 0.04359 | 0.5326 | 5098 | 0.5943 | -0.09914 | 0.1456 |
fixed | NA | birth_order_nonlinear5 | 0.1172 | 0.05437 | 2.156 | 4908 | 0.03115 | -0.0354 | 0.2698 |
fixed | NA | birth_order_nonlinear>5 | 0.04245 | 0.05526 | 0.7682 | 5770 | 0.4424 | -0.1127 | 0.1976 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.413 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.772 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5894 | 0.384 | -1.535 | 5781 | 0.1248 | -1.667 | 0.4884 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1022 | 0.04351 | 2.348 | 5765 | 0.01891 | -0.01997 | 0.2243 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003663 | 0.001553 | -2.358 | 5762 | 0.0184 | -0.008023 | 0.0006972 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004183 | 0.0000176 | 2.376 | 5762 | 0.01751 | -0.000007578 | 0.00009124 |
fixed | NA | male | 0.03646 | 0.02231 | 1.634 | 5641 | 0.1023 | -0.02617 | 0.09909 |
fixed | NA | count_birth_order2/2 | 0.02404 | 0.05166 | 0.4654 | 5112 | 0.6417 | -0.121 | 0.1691 |
fixed | NA | count_birth_order1/3 | -0.05451 | 0.04671 | -1.167 | 5813 | 0.2433 | -0.1856 | 0.07661 |
fixed | NA | count_birth_order2/3 | 0.01584 | 0.05088 | 0.3112 | 5880 | 0.7557 | -0.127 | 0.1587 |
fixed | NA | count_birth_order3/3 | 0.01729 | 0.05675 | 0.3047 | 5898 | 0.7606 | -0.142 | 0.1766 |
fixed | NA | count_birth_order1/4 | -0.1283 | 0.05698 | -2.251 | 5872 | 0.0244 | -0.2882 | 0.03166 |
fixed | NA | count_birth_order2/4 | -0.06935 | 0.05883 | -1.179 | 5897 | 0.2386 | -0.2345 | 0.0958 |
fixed | NA | count_birth_order3/4 | -0.03725 | 0.06203 | -0.6005 | 5888 | 0.5482 | -0.2114 | 0.1369 |
fixed | NA | count_birth_order4/4 | -0.03674 | 0.06447 | -0.5699 | 5886 | 0.5688 | -0.2177 | 0.1442 |
fixed | NA | count_birth_order1/5 | -0.03692 | 0.07709 | -0.4789 | 5894 | 0.632 | -0.2533 | 0.1795 |
fixed | NA | count_birth_order2/5 | -0.1199 | 0.0823 | -1.457 | 5843 | 0.1452 | -0.3509 | 0.1111 |
fixed | NA | count_birth_order3/5 | -0.154 | 0.07716 | -1.996 | 5852 | 0.04598 | -0.3706 | 0.06257 |
fixed | NA | count_birth_order4/5 | -0.1267 | 0.0744 | -1.704 | 5876 | 0.08851 | -0.3356 | 0.08209 |
fixed | NA | count_birth_order5/5 | 0.002534 | 0.07733 | 0.03277 | 5856 | 0.9739 | -0.2145 | 0.2196 |
fixed | NA | count_birth_order1/>5 | -0.1809 | 0.07635 | -2.37 | 5857 | 0.01783 | -0.3952 | 0.03338 |
fixed | NA | count_birth_order2/>5 | -0.3047 | 0.07551 | -4.035 | 5833 | 0.00005528 | -0.5166 | -0.09273 |
fixed | NA | count_birth_order3/>5 | -0.2237 | 0.07552 | -2.963 | 5789 | 0.003061 | -0.4357 | -0.01177 |
fixed | NA | count_birth_order4/>5 | -0.2646 | 0.07115 | -3.718 | 5793 | 0.0002025 | -0.4643 | -0.06484 |
fixed | NA | count_birth_order5/>5 | -0.1598 | 0.06737 | -2.372 | 5806 | 0.01771 | -0.3489 | 0.02929 |
fixed | NA | count_birth_order>5/>5 | -0.2265 | 0.05166 | -4.384 | 5516 | 0.00001186 | -0.3715 | -0.08147 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.413 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7722 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15107 | 15181 | -7543 | 15085 | NA | NA | NA |
12 | 15108 | 15188 | -7542 | 15084 | 1.512 | 1 | 0.2188 |
16 | 15112 | 15219 | -7540 | 15080 | 3.495 | 4 | 0.4787 |
26 | 15124 | 15298 | -7536 | 15072 | 7.814 | 10 | 0.647 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.547 | 0.381 | -1.436 | 5823 | 0.1511 | -1.617 | 0.5225 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09819 | 0.04326 | 2.27 | 5816 | 0.02324 | -0.02323 | 0.2196 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003581 | 0.001544 | -2.319 | 5813 | 0.02043 | -0.007916 | 0.0007537 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000409 | 0.0000175 | 2.338 | 5816 | 0.01943 | -0.000008209 | 0.00009001 |
fixed | NA | male | 0.03865 | 0.0222 | 1.741 | 5706 | 0.08169 | -0.02365 | 0.101 |
fixed | NA | sibling_count3 | -0.001308 | 0.03913 | -0.03344 | 4392 | 0.9733 | -0.1111 | 0.1085 |
fixed | NA | sibling_count4 | -0.05356 | 0.04142 | -1.293 | 4053 | 0.1961 | -0.1698 | 0.06272 |
fixed | NA | sibling_count5 | -0.04134 | 0.04448 | -0.9294 | 3723 | 0.3527 | -0.1662 | 0.08352 |
fixed | NA | sibling_count>5 | -0.1437 | 0.03893 | -3.692 | 3869 | 0.0002256 | -0.253 | -0.03445 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4147 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7712 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.548 | 0.3811 | -1.438 | 5822 | 0.1505 | -1.618 | 0.5218 |
fixed | NA | birth_order | 0.0009386 | 0.006519 | 0.144 | 5926 | 0.8855 | -0.01736 | 0.01924 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09817 | 0.04326 | 2.269 | 5815 | 0.02329 | -0.02326 | 0.2196 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003582 | 0.001544 | -2.319 | 5812 | 0.02042 | -0.007916 | 0.0007535 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004095 | 0.0000175 | 2.34 | 5814 | 0.01933 | -0.000008176 | 0.00009007 |
fixed | NA | male | 0.03861 | 0.0222 | 1.739 | 5705 | 0.082 | -0.0237 | 0.1009 |
fixed | NA | sibling_count3 | -0.001773 | 0.03926 | -0.04515 | 4393 | 0.964 | -0.112 | 0.1084 |
fixed | NA | sibling_count4 | -0.05462 | 0.04208 | -1.298 | 4053 | 0.1943 | -0.1727 | 0.06349 |
fixed | NA | sibling_count5 | -0.04301 | 0.04597 | -0.9356 | 3759 | 0.3495 | -0.1721 | 0.08603 |
fixed | NA | sibling_count>5 | -0.1472 | 0.04585 | -3.211 | 4213 | 0.001332 | -0.2759 | -0.01853 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4149 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7712 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5634 | 0.3817 | -1.476 | 5834 | 0.1399 | -1.635 | 0.5079 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09955 | 0.04328 | 2.3 | 5821 | 0.02147 | -0.02193 | 0.221 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003632 | 0.001545 | -2.35 | 5817 | 0.01878 | -0.007969 | 0.0007054 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004154 | 0.00001751 | 2.373 | 5816 | 0.0177 | -0.000007607 | 0.00009069 |
fixed | NA | male | 0.03953 | 0.0222 | 1.781 | 5701 | 0.07498 | -0.02278 | 0.1018 |
fixed | NA | sibling_count3 | 0.0002314 | 0.03989 | 0.005801 | 4546 | 0.9954 | -0.1118 | 0.1122 |
fixed | NA | sibling_count4 | -0.04784 | 0.04341 | -1.102 | 4325 | 0.2705 | -0.1697 | 0.07402 |
fixed | NA | sibling_count5 | -0.05674 | 0.04795 | -1.183 | 4125 | 0.2367 | -0.1913 | 0.07785 |
fixed | NA | sibling_count>5 | -0.1505 | 0.04712 | -3.194 | 4452 | 0.001413 | -0.2828 | -0.01824 |
fixed | NA | birth_order_nonlinear2 | 0.01206 | 0.02899 | 0.416 | 4884 | 0.6774 | -0.06931 | 0.09343 |
fixed | NA | birth_order_nonlinear3 | -0.007123 | 0.03509 | -0.203 | 5065 | 0.8391 | -0.1056 | 0.09137 |
fixed | NA | birth_order_nonlinear4 | -0.02017 | 0.04232 | -0.4766 | 5235 | 0.6337 | -0.139 | 0.09862 |
fixed | NA | birth_order_nonlinear5 | 0.119 | 0.05185 | 2.294 | 5125 | 0.0218 | -0.02658 | 0.2645 |
fixed | NA | birth_order_nonlinear>5 | -0.007059 | 0.04951 | -0.1426 | 5918 | 0.8866 | -0.146 | 0.1319 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4146 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.771 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5329 | 0.3822 | -1.394 | 5831 | 0.1633 | -1.606 | 0.54 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09492 | 0.04332 | 2.191 | 5813 | 0.02846 | -0.02667 | 0.2165 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00344 | 0.001547 | -2.224 | 5809 | 0.02617 | -0.007782 | 0.0009015 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003911 | 0.00001753 | 2.231 | 5810 | 0.02573 | -0.0000101 | 0.00008832 |
fixed | NA | male | 0.03859 | 0.0222 | 1.739 | 5690 | 0.08215 | -0.02371 | 0.1009 |
fixed | NA | count_birth_order2/2 | 0.02549 | 0.05653 | 0.4508 | 5251 | 0.6521 | -0.1332 | 0.1842 |
fixed | NA | count_birth_order1/3 | -0.01494 | 0.05051 | -0.2957 | 5865 | 0.7675 | -0.1567 | 0.1268 |
fixed | NA | count_birth_order2/3 | 0.0181 | 0.05465 | 0.3312 | 5927 | 0.7405 | -0.1353 | 0.1715 |
fixed | NA | count_birth_order3/3 | 0.03519 | 0.06135 | 0.5737 | 5949 | 0.5662 | -0.137 | 0.2074 |
fixed | NA | count_birth_order1/4 | -0.1124 | 0.05962 | -1.886 | 5920 | 0.05939 | -0.2798 | 0.05493 |
fixed | NA | count_birth_order2/4 | 0.02033 | 0.06071 | 0.3348 | 5945 | 0.7378 | -0.1501 | 0.1907 |
fixed | NA | count_birth_order3/4 | -0.01424 | 0.06636 | -0.2146 | 5938 | 0.8301 | -0.2005 | 0.172 |
fixed | NA | count_birth_order4/4 | -0.06868 | 0.06842 | -1.004 | 5940 | 0.3155 | -0.2607 | 0.1234 |
fixed | NA | count_birth_order1/5 | 0.01101 | 0.07059 | 0.1559 | 5948 | 0.8761 | -0.1871 | 0.2092 |
fixed | NA | count_birth_order2/5 | -0.05006 | 0.07557 | -0.6624 | 5923 | 0.5077 | -0.2622 | 0.1621 |
fixed | NA | count_birth_order3/5 | -0.1674 | 0.07348 | -2.278 | 5922 | 0.02277 | -0.3736 | 0.03889 |
fixed | NA | count_birth_order4/5 | -0.07244 | 0.07609 | -0.952 | 5904 | 0.3411 | -0.286 | 0.1411 |
fixed | NA | count_birth_order5/5 | 0.1097 | 0.0763 | 1.438 | 5906 | 0.1504 | -0.1044 | 0.3239 |
fixed | NA | count_birth_order1/>5 | -0.0476 | 0.06705 | -0.7099 | 5948 | 0.4778 | -0.2358 | 0.1406 |
fixed | NA | count_birth_order2/>5 | -0.2193 | 0.06985 | -3.139 | 5909 | 0.001703 | -0.4153 | -0.02319 |
fixed | NA | count_birth_order3/>5 | -0.1526 | 0.06844 | -2.229 | 5891 | 0.02584 | -0.3447 | 0.03955 |
fixed | NA | count_birth_order4/>5 | -0.1628 | 0.06588 | -2.471 | 5896 | 0.01352 | -0.3477 | 0.02217 |
fixed | NA | count_birth_order5/>5 | -0.06021 | 0.06758 | -0.891 | 5842 | 0.373 | -0.2499 | 0.1295 |
fixed | NA | count_birth_order>5/>5 | -0.1548 | 0.05053 | -3.063 | 5608 | 0.002199 | -0.2966 | -0.01295 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4146 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7706 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15237 | 15311 | -7608 | 15215 | NA | NA | NA |
12 | 15239 | 15319 | -7608 | 15215 | 0.02042 | 1 | 0.8864 |
16 | 15239 | 15346 | -7604 | 15207 | 7.892 | 4 | 0.09562 |
26 | 15244 | 15418 | -7596 | 15192 | 15.53 | 10 | 0.1138 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6109 | 0.3868 | -1.579 | 5647 | 0.1143 | -1.697 | 0.4749 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1055 | 0.04391 | 2.404 | 5640 | 0.01627 | -0.01772 | 0.2288 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003789 | 0.001568 | -2.417 | 5636 | 0.0157 | -0.008189 | 0.0006121 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004303 | 0.00001777 | 2.422 | 5637 | 0.01548 | -0.000006848 | 0.0000929 |
fixed | NA | male | 0.03418 | 0.02252 | 1.518 | 5529 | 0.1291 | -0.02903 | 0.09739 |
fixed | NA | sibling_count3 | -0.01054 | 0.03585 | -0.294 | 4150 | 0.7688 | -0.1112 | 0.0901 |
fixed | NA | sibling_count4 | -0.08272 | 0.03907 | -2.117 | 3755 | 0.03428 | -0.1924 | 0.02694 |
fixed | NA | sibling_count5 | -0.07539 | 0.04627 | -1.629 | 3360 | 0.1033 | -0.2053 | 0.05449 |
fixed | NA | sibling_count>5 | -0.2279 | 0.04017 | -5.672 | 3233 | 0.00000001533 | -0.3406 | -0.1151 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4197 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7695 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6191 | 0.3868 | -1.601 | 5646 | 0.1095 | -1.705 | 0.4665 |
fixed | NA | birth_order | 0.0126 | 0.007659 | 1.645 | 5784 | 0.09994 | -0.008897 | 0.0341 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1046 | 0.04391 | 2.383 | 5640 | 0.01723 | -0.01864 | 0.2279 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003775 | 0.001567 | -2.408 | 5635 | 0.01606 | -0.008175 | 0.0006249 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000434 | 0.00001777 | 2.443 | 5634 | 0.0146 | -0.00000647 | 0.00009327 |
fixed | NA | male | 0.03386 | 0.02252 | 1.504 | 5528 | 0.1327 | -0.02935 | 0.09706 |
fixed | NA | sibling_count3 | -0.01685 | 0.03605 | -0.4673 | 4161 | 0.6403 | -0.1181 | 0.08436 |
fixed | NA | sibling_count4 | -0.0974 | 0.04007 | -2.431 | 3795 | 0.01511 | -0.2099 | 0.01507 |
fixed | NA | sibling_count5 | -0.09864 | 0.04838 | -2.039 | 3465 | 0.04152 | -0.2344 | 0.03715 |
fixed | NA | sibling_count>5 | -0.2758 | 0.04961 | -5.559 | 3874 | 0.00000002902 | -0.4151 | -0.1365 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.42 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7693 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.638 | 0.3876 | -1.646 | 5661 | 0.09976 | -1.726 | 0.4499 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1074 | 0.04395 | 2.444 | 5648 | 0.01454 | -0.01594 | 0.2308 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003874 | 0.001569 | -2.469 | 5641 | 0.01356 | -0.008278 | 0.0005296 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004448 | 0.00001778 | 2.501 | 5638 | 0.0124 | -0.000005438 | 0.0000944 |
fixed | NA | male | 0.03404 | 0.02252 | 1.511 | 5524 | 0.1308 | -0.02918 | 0.09725 |
fixed | NA | sibling_count3 | -0.0171 | 0.03674 | -0.4653 | 4339 | 0.6417 | -0.1202 | 0.08604 |
fixed | NA | sibling_count4 | -0.09868 | 0.04153 | -2.376 | 4097 | 0.01754 | -0.2153 | 0.01789 |
fixed | NA | sibling_count5 | -0.1131 | 0.05037 | -2.245 | 3816 | 0.02482 | -0.2545 | 0.02831 |
fixed | NA | sibling_count>5 | -0.2769 | 0.05098 | -5.432 | 4118 | 0.00000005882 | -0.42 | -0.1338 |
fixed | NA | birth_order_nonlinear2 | 0.03343 | 0.02836 | 1.179 | 4610 | 0.2385 | -0.04617 | 0.113 |
fixed | NA | birth_order_nonlinear3 | 0.02907 | 0.03517 | 0.8265 | 4793 | 0.4085 | -0.06965 | 0.1278 |
fixed | NA | birth_order_nonlinear4 | 0.04795 | 0.04482 | 1.07 | 4936 | 0.2847 | -0.07785 | 0.1738 |
fixed | NA | birth_order_nonlinear5 | 0.1317 | 0.05668 | 2.324 | 4775 | 0.02016 | -0.02737 | 0.2909 |
fixed | NA | birth_order_nonlinear>5 | 0.06088 | 0.05697 | 1.069 | 5592 | 0.2853 | -0.09903 | 0.2208 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4191 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7697 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6225 | 0.3884 | -1.602 | 5657 | 0.1091 | -1.713 | 0.4679 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1047 | 0.04404 | 2.378 | 5640 | 0.01743 | -0.01889 | 0.2284 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003746 | 0.001573 | -2.382 | 5635 | 0.01726 | -0.00816 | 0.0006687 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004268 | 0.00001783 | 2.394 | 5634 | 0.01671 | -0.00000737 | 0.00009272 |
fixed | NA | male | 0.03277 | 0.02253 | 1.454 | 5510 | 0.146 | -0.03049 | 0.09602 |
fixed | NA | count_birth_order2/2 | 0.0373 | 0.05023 | 0.7426 | 4934 | 0.4578 | -0.1037 | 0.1783 |
fixed | NA | count_birth_order1/3 | -0.0397 | 0.04617 | -0.86 | 5695 | 0.3898 | -0.1693 | 0.08989 |
fixed | NA | count_birth_order2/3 | 0.04364 | 0.05085 | 0.8583 | 5769 | 0.3908 | -0.09909 | 0.1864 |
fixed | NA | count_birth_order3/3 | 0.02499 | 0.05573 | 0.4484 | 5779 | 0.6539 | -0.1315 | 0.1814 |
fixed | NA | count_birth_order1/4 | -0.1454 | 0.05724 | -2.54 | 5764 | 0.01112 | -0.306 | 0.0153 |
fixed | NA | count_birth_order2/4 | -0.06066 | 0.05873 | -1.033 | 5779 | 0.3017 | -0.2255 | 0.1042 |
fixed | NA | count_birth_order3/4 | -0.04567 | 0.06138 | -0.744 | 5765 | 0.4569 | -0.218 | 0.1266 |
fixed | NA | count_birth_order4/4 | -0.009882 | 0.06483 | -0.1524 | 5754 | 0.8788 | -0.1919 | 0.1721 |
fixed | NA | count_birth_order1/5 | -0.03364 | 0.07699 | -0.4369 | 5778 | 0.6622 | -0.2497 | 0.1825 |
fixed | NA | count_birth_order2/5 | -0.1226 | 0.08473 | -1.447 | 5710 | 0.1479 | -0.3604 | 0.1152 |
fixed | NA | count_birth_order3/5 | -0.1298 | 0.08084 | -1.606 | 5717 | 0.1083 | -0.3568 | 0.09709 |
fixed | NA | count_birth_order4/5 | -0.08387 | 0.07798 | -1.075 | 5747 | 0.2822 | -0.3028 | 0.135 |
fixed | NA | count_birth_order5/5 | 0.0319 | 0.08276 | 0.3854 | 5722 | 0.6999 | -0.2004 | 0.2642 |
fixed | NA | count_birth_order1/>5 | -0.1417 | 0.07812 | -1.814 | 5726 | 0.06966 | -0.361 | 0.07754 |
fixed | NA | count_birth_order2/>5 | -0.3013 | 0.07739 | -3.893 | 5700 | 0.0001002 | -0.5185 | -0.08403 |
fixed | NA | count_birth_order3/>5 | -0.2695 | 0.07655 | -3.521 | 5658 | 0.0004334 | -0.4844 | -0.05465 |
fixed | NA | count_birth_order4/>5 | -0.2658 | 0.07478 | -3.554 | 5615 | 0.0003827 | -0.4757 | -0.05585 |
fixed | NA | count_birth_order5/>5 | -0.1536 | 0.06895 | -2.227 | 5669 | 0.02596 | -0.3471 | 0.03996 |
fixed | NA | count_birth_order>5/>5 | -0.2161 | 0.05268 | -4.102 | 5393 | 0.0000416 | -0.364 | -0.06821 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.4191 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.7697 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14808 | 14882 | -7393 | 14786 | NA | NA | NA |
12 | 14808 | 14888 | -7392 | 14784 | 2.71 | 1 | 0.09974 |
16 | 14813 | 14919 | -7390 | 14781 | 3.147 | 4 | 0.5336 |
26 | 14822 | 14995 | -7385 | 14770 | 10.48 | 10 | 0.3993 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = big5_ext)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5858 | 0.1594 | 3.676 | 13656 | 0.0002379 | 0.1385 | 1.033 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0431 | 0.01526 | -2.824 | 13524 | 0.004743 | -0.08593 | -0.0002659 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001286 | 0.0004482 | 2.868 | 13337 | 0.004134 | 0.00002742 | 0.002544 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001265 | 0.000004122 | -3.068 | 13167 | 0.002158 | -0.00002422 | -0.000001077 |
fixed | NA | male | -0.2258 | 0.01689 | -13.37 | 13875 | 1.703e-40 | -0.2732 | -0.1784 |
fixed | NA | sibling_count3 | 0.009322 | 0.03332 | 0.2798 | 10744 | 0.7796 | -0.0842 | 0.1028 |
fixed | NA | sibling_count4 | -0.02026 | 0.03419 | -0.5925 | 9730 | 0.5535 | -0.1162 | 0.07572 |
fixed | NA | sibling_count5 | -0.02693 | 0.03538 | -0.7611 | 8569 | 0.4466 | -0.1262 | 0.07238 |
fixed | NA | sibling_count>5 | -0.01081 | 0.02791 | -0.3874 | 9811 | 0.6985 | -0.08917 | 0.06754 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2287 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9711 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5841 | 0.1594 | 3.665 | 13657 | 0.0002481 | 0.1368 | 1.032 |
fixed | NA | birth_order | -0.003173 | 0.003493 | -0.9085 | 10861 | 0.3636 | -0.01298 | 0.006632 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04216 | 0.01529 | -2.757 | 13506 | 0.005845 | -0.08509 | 0.0007685 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001253 | 0.0004497 | 2.786 | 13275 | 0.00534 | -0.000009359 | 0.002515 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001235 | 0.000004135 | -2.987 | 13084 | 0.002821 | -0.00002396 | -0.0000007446 |
fixed | NA | male | -0.2257 | 0.01689 | -13.36 | 13875 | 1.846e-40 | -0.2731 | -0.1783 |
fixed | NA | sibling_count3 | 0.01013 | 0.03333 | 0.304 | 10759 | 0.7611 | -0.08342 | 0.1037 |
fixed | NA | sibling_count4 | -0.01798 | 0.03428 | -0.5243 | 9787 | 0.6001 | -0.1142 | 0.07826 |
fixed | NA | sibling_count5 | -0.02301 | 0.03564 | -0.6457 | 8664 | 0.5185 | -0.123 | 0.07702 |
fixed | NA | sibling_count>5 | 0.001366 | 0.03097 | 0.0441 | 10715 | 0.9648 | -0.08556 | 0.08829 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2281 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9712 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5626 | 0.1598 | 3.521 | 13662 | 0.000432 | 0.114 | 1.011 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04263 | 0.0153 | -2.787 | 13519 | 0.005334 | -0.08558 | 0.0003127 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001264 | 0.0004498 | 2.809 | 13289 | 0.004972 | 0.000001024 | 0.002526 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001237 | 0.000004136 | -2.991 | 13086 | 0.00279 | -0.00002398 | -0.0000007589 |
fixed | NA | male | -0.2257 | 0.01689 | -13.36 | 13869 | 1.765e-40 | -0.2731 | -0.1783 |
fixed | NA | sibling_count3 | 0.01351 | 0.03385 | 0.3991 | 11096 | 0.6898 | -0.08151 | 0.1085 |
fixed | NA | sibling_count4 | -0.01763 | 0.03537 | -0.4984 | 10527 | 0.6182 | -0.1169 | 0.08165 |
fixed | NA | sibling_count5 | -0.02496 | 0.03719 | -0.6712 | 9678 | 0.5021 | -0.1294 | 0.07943 |
fixed | NA | sibling_count>5 | -0.005669 | 0.03271 | -0.1733 | 11890 | 0.8624 | -0.09749 | 0.08616 |
fixed | NA | birth_order_nonlinear2 | 0.05536 | 0.02472 | 2.239 | 12810 | 0.02515 | -0.01404 | 0.1248 |
fixed | NA | birth_order_nonlinear3 | -0.003555 | 0.02919 | -0.1218 | 12714 | 0.903 | -0.08548 | 0.07837 |
fixed | NA | birth_order_nonlinear4 | 0.02086 | 0.03323 | 0.6278 | 12831 | 0.5301 | -0.07242 | 0.1141 |
fixed | NA | birth_order_nonlinear5 | 0.02606 | 0.03779 | 0.6897 | 12919 | 0.4904 | -0.08001 | 0.1321 |
fixed | NA | birth_order_nonlinear>5 | 0.01193 | 0.031 | 0.3846 | 13899 | 0.7005 | -0.07511 | 0.09896 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.229 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9709 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5658 | 0.1605 | 3.525 | 13666 | 0.0004256 | 0.1152 | 1.016 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04235 | 0.0153 | -2.767 | 13511 | 0.005661 | -0.0853 | 0.0006092 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001259 | 0.0004499 | 2.799 | 13275 | 0.00514 | -0.000003788 | 0.002522 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001236 | 0.000004137 | -2.987 | 13066 | 0.002821 | -0.00002397 | -0.0000007454 |
fixed | NA | male | -0.2255 | 0.0169 | -13.35 | 13859 | 2.147e-40 | -0.273 | -0.1781 |
fixed | NA | count_birth_order2/2 | 0.03555 | 0.04808 | 0.7393 | 12561 | 0.4597 | -0.09941 | 0.1705 |
fixed | NA | count_birth_order1/3 | 0.006548 | 0.04502 | 0.1454 | 13872 | 0.8844 | -0.1198 | 0.1329 |
fixed | NA | count_birth_order2/3 | 0.0579 | 0.05035 | 1.15 | 13888 | 0.2502 | -0.08343 | 0.1992 |
fixed | NA | count_birth_order3/3 | 0.006575 | 0.05641 | 0.1166 | 13902 | 0.9072 | -0.1518 | 0.1649 |
fixed | NA | count_birth_order1/4 | -0.03226 | 0.05142 | -0.6274 | 13891 | 0.5304 | -0.1766 | 0.1121 |
fixed | NA | count_birth_order2/4 | 0.09717 | 0.05408 | 1.797 | 13895 | 0.07239 | -0.05463 | 0.249 |
fixed | NA | count_birth_order3/4 | -0.06283 | 0.05877 | -1.069 | 13902 | 0.285 | -0.2278 | 0.1021 |
fixed | NA | count_birth_order4/4 | -0.0513 | 0.06223 | -0.8244 | 13907 | 0.4097 | -0.226 | 0.1234 |
fixed | NA | count_birth_order1/5 | -0.04349 | 0.05836 | -0.7453 | 13903 | 0.4561 | -0.2073 | 0.1203 |
fixed | NA | count_birth_order2/5 | -0.01869 | 0.06139 | -0.3045 | 13907 | 0.7608 | -0.191 | 0.1536 |
fixed | NA | count_birth_order3/5 | -0.0007656 | 0.06302 | -0.01215 | 13908 | 0.9903 | -0.1777 | 0.1761 |
fixed | NA | count_birth_order4/5 | 0.04999 | 0.06676 | 0.7488 | 13910 | 0.454 | -0.1374 | 0.2374 |
fixed | NA | count_birth_order5/5 | -0.04369 | 0.06825 | -0.6402 | 13910 | 0.5221 | -0.2353 | 0.1479 |
fixed | NA | count_birth_order1/>5 | -0.01372 | 0.04714 | -0.2911 | 13908 | 0.771 | -0.146 | 0.1186 |
fixed | NA | count_birth_order2/>5 | 0.03022 | 0.04863 | 0.6215 | 13910 | 0.5343 | -0.1063 | 0.1667 |
fixed | NA | count_birth_order3/>5 | -0.01704 | 0.04765 | -0.3577 | 13910 | 0.7205 | -0.1508 | 0.1167 |
fixed | NA | count_birth_order4/>5 | 0.005439 | 0.04669 | 0.1165 | 13910 | 0.9073 | -0.1256 | 0.1365 |
fixed | NA | count_birth_order5/>5 | 0.02545 | 0.04704 | 0.5409 | 13910 | 0.5886 | -0.1066 | 0.1575 |
fixed | NA | count_birth_order>5/>5 | -0.001348 | 0.03641 | -0.03702 | 12691 | 0.9705 | -0.1036 | 0.1009 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2285 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9712 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 39460 | 39543 | -19719 | 39438 | NA | NA | NA |
12 | 39461 | 39552 | -19719 | 39437 | 0.8272 | 1 | 0.3631 |
16 | 39464 | 39585 | -19716 | 39432 | 5.522 | 4 | 0.2378 |
26 | 39477 | 39673 | -19713 | 39425 | 6.545 | 10 | 0.7676 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.152 | 0.4495 | 2.564 | 5915 | 0.01038 | -0.1093 | 2.414 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1016 | 0.05098 | -1.992 | 5912 | 0.04638 | -0.2447 | 0.04154 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003476 | 0.001819 | 1.912 | 5905 | 0.05597 | -0.001628 | 0.008581 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003723 | 0.00002058 | -1.809 | 5894 | 0.07052 | -0.00009501 | 0.00002054 |
fixed | NA | male | -0.2631 | 0.02631 | -10 | 5907 | 2.341e-23 | -0.337 | -0.1892 |
fixed | NA | sibling_count3 | -0.03372 | 0.04026 | -0.8374 | 4587 | 0.4024 | -0.1467 | 0.0793 |
fixed | NA | sibling_count4 | -0.08771 | 0.04309 | -2.036 | 3960 | 0.04186 | -0.2087 | 0.03324 |
fixed | NA | sibling_count5 | -0.08529 | 0.04889 | -1.744 | 3420 | 0.08116 | -0.2225 | 0.05195 |
fixed | NA | sibling_count>5 | -0.09583 | 0.04277 | -2.241 | 3060 | 0.02513 | -0.2159 | 0.02423 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1894 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9934 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.141 | 0.4495 | 2.539 | 5914 | 0.01115 | -0.1206 | 2.403 |
fixed | NA | birth_order | 0.01356 | 0.008594 | 1.578 | 5399 | 0.1147 | -0.01057 | 0.03768 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1021 | 0.05098 | -2.003 | 5911 | 0.04524 | -0.2452 | 0.041 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003471 | 0.001818 | 1.909 | 5905 | 0.05636 | -0.001634 | 0.008575 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003665 | 0.00002058 | -1.78 | 5894 | 0.07507 | -0.00009443 | 0.00002113 |
fixed | NA | male | -0.2636 | 0.02631 | -10.02 | 5906 | 1.892e-23 | -0.3375 | -0.1898 |
fixed | NA | sibling_count3 | -0.04022 | 0.04048 | -0.9935 | 4582 | 0.3205 | -0.1539 | 0.07341 |
fixed | NA | sibling_count4 | -0.103 | 0.04417 | -2.331 | 3945 | 0.01981 | -0.227 | 0.02103 |
fixed | NA | sibling_count5 | -0.1104 | 0.05143 | -2.146 | 3462 | 0.03195 | -0.2548 | 0.034 |
fixed | NA | sibling_count>5 | -0.1462 | 0.05344 | -2.736 | 3559 | 0.006244 | -0.2963 | 0.003781 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1924 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9927 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.11 | 0.4497 | 2.467 | 5909 | 0.01365 | -0.1529 | 2.372 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09789 | 0.05096 | -1.921 | 5906 | 0.05481 | -0.2409 | 0.04517 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003318 | 0.001818 | 1.825 | 5899 | 0.068 | -0.001785 | 0.008421 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003493 | 0.00002058 | -1.697 | 5887 | 0.08976 | -0.00009271 | 0.00002285 |
fixed | NA | male | -0.2635 | 0.02629 | -10.02 | 5902 | 1.924e-23 | -0.3373 | -0.1896 |
fixed | NA | sibling_count3 | -0.04151 | 0.04136 | -1.004 | 4779 | 0.3156 | -0.1576 | 0.07458 |
fixed | NA | sibling_count4 | -0.1168 | 0.04604 | -2.538 | 4319 | 0.01119 | -0.2461 | 0.0124 |
fixed | NA | sibling_count5 | -0.1589 | 0.0543 | -2.927 | 3964 | 0.003447 | -0.3113 | -0.006488 |
fixed | NA | sibling_count>5 | -0.1572 | 0.05516 | -2.85 | 3888 | 0.004398 | -0.312 | -0.002359 |
fixed | NA | birth_order_nonlinear2 | 0.03992 | 0.03448 | 1.158 | 5118 | 0.247 | -0.05687 | 0.1367 |
fixed | NA | birth_order_nonlinear3 | 0.03437 | 0.04242 | 0.8102 | 5378 | 0.4178 | -0.0847 | 0.1534 |
fixed | NA | birth_order_nonlinear4 | 0.1099 | 0.05233 | 2.101 | 5536 | 0.03571 | -0.03696 | 0.2568 |
fixed | NA | birth_order_nonlinear5 | 0.2364 | 0.06542 | 3.614 | 5478 | 0.0003043 | 0.05279 | 0.4201 |
fixed | NA | birth_order_nonlinear>5 | 0.03262 | 0.06472 | 0.504 | 5852 | 0.6143 | -0.149 | 0.2143 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1872 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9929 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.085 | 0.4508 | 2.407 | 5899 | 0.01613 | -0.1805 | 2.35 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09453 | 0.05108 | -1.851 | 5896 | 0.06429 | -0.2379 | 0.04886 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003205 | 0.001822 | 1.758 | 5889 | 0.07873 | -0.001911 | 0.00832 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003372 | 0.00002064 | -1.634 | 5878 | 0.1024 | -0.00009164 | 0.00002421 |
fixed | NA | male | -0.2623 | 0.02632 | -9.964 | 5892 | 3.326e-23 | -0.3361 | -0.1884 |
fixed | NA | count_birth_order2/2 | 0.02096 | 0.06225 | 0.3367 | 5228 | 0.7364 | -0.1538 | 0.1957 |
fixed | NA | count_birth_order1/3 | -0.08328 | 0.05417 | -1.537 | 5897 | 0.1243 | -0.2354 | 0.06878 |
fixed | NA | count_birth_order2/3 | 0.03793 | 0.05923 | 0.6403 | 5899 | 0.522 | -0.1283 | 0.2042 |
fixed | NA | count_birth_order3/3 | -0.01001 | 0.06626 | -0.151 | 5900 | 0.88 | -0.196 | 0.176 |
fixed | NA | count_birth_order1/4 | -0.06131 | 0.06625 | -0.9255 | 5896 | 0.3548 | -0.2473 | 0.1247 |
fixed | NA | count_birth_order2/4 | -0.1186 | 0.06863 | -1.728 | 5900 | 0.08396 | -0.3113 | 0.07402 |
fixed | NA | count_birth_order3/4 | -0.1046 | 0.07259 | -1.442 | 5899 | 0.1495 | -0.3084 | 0.09912 |
fixed | NA | count_birth_order4/4 | -0.04082 | 0.07548 | -0.5408 | 5898 | 0.5886 | -0.2527 | 0.171 |
fixed | NA | count_birth_order1/5 | -0.1233 | 0.09008 | -1.368 | 5900 | 0.1712 | -0.3761 | 0.1296 |
fixed | NA | count_birth_order2/5 | -0.163 | 0.09652 | -1.689 | 5899 | 0.09127 | -0.434 | 0.1079 |
fixed | NA | count_birth_order3/5 | -0.1296 | 0.0905 | -1.432 | 5898 | 0.1521 | -0.3836 | 0.1244 |
fixed | NA | count_birth_order4/5 | -0.05215 | 0.08716 | -0.5983 | 5898 | 0.5497 | -0.2968 | 0.1925 |
fixed | NA | count_birth_order5/5 | 0.05478 | 0.09073 | 0.6037 | 5895 | 0.5461 | -0.1999 | 0.3095 |
fixed | NA | count_birth_order1/>5 | -0.2236 | 0.08934 | -2.503 | 5891 | 0.01235 | -0.4744 | 0.02719 |
fixed | NA | count_birth_order2/>5 | -0.1293 | 0.0885 | -1.461 | 5896 | 0.144 | -0.3777 | 0.1191 |
fixed | NA | count_birth_order3/>5 | -0.1131 | 0.08873 | -1.275 | 5900 | 0.2025 | -0.3622 | 0.136 |
fixed | NA | count_birth_order4/>5 | -0.0233 | 0.08363 | -0.2786 | 5899 | 0.7806 | -0.258 | 0.2114 |
fixed | NA | count_birth_order5/>5 | 0.08399 | 0.07903 | 1.063 | 5898 | 0.2879 | -0.1379 | 0.3058 |
fixed | NA | count_birth_order>5/>5 | -0.1312 | 0.05874 | -2.234 | 5149 | 0.02554 | -0.2961 | 0.03367 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1883 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9931 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16954 | 17028 | -8466 | 16932 | NA | NA | NA |
12 | 16954 | 17034 | -8465 | 16930 | 2.483 | 1 | 0.1151 |
16 | 16948 | 17055 | -8458 | 16916 | 13.26 | 4 | 0.01007 |
26 | 16963 | 17137 | -8456 | 16911 | 5.148 | 10 | 0.8811 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.163 | 0.4489 | 2.591 | 5966 | 0.009594 | -0.09699 | 2.423 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1022 | 0.05094 | -2.007 | 5963 | 0.04481 | -0.2452 | 0.04076 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003524 | 0.001817 | 1.939 | 5956 | 0.05255 | -0.001577 | 0.008625 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003799 | 0.00002057 | -1.847 | 5944 | 0.06485 | -0.00009574 | 0.00001976 |
fixed | NA | male | -0.2654 | 0.02625 | -10.11 | 5957 | 7.751e-24 | -0.3391 | -0.1917 |
fixed | NA | sibling_count3 | -0.03632 | 0.04368 | -0.8315 | 4742 | 0.4057 | -0.1589 | 0.08629 |
fixed | NA | sibling_count4 | -0.07942 | 0.04582 | -1.733 | 4276 | 0.08311 | -0.208 | 0.0492 |
fixed | NA | sibling_count5 | -0.1033 | 0.04875 | -2.119 | 3745 | 0.03416 | -0.2401 | 0.03354 |
fixed | NA | sibling_count>5 | -0.1059 | 0.04277 | -2.477 | 3778 | 0.01329 | -0.226 | 0.01411 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1912 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9951 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.15 | 0.4489 | 2.561 | 5965 | 0.01046 | -0.1104 | 2.41 |
fixed | NA | birth_order | 0.01209 | 0.007482 | 1.616 | 5017 | 0.1061 | -0.008911 | 0.03309 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1023 | 0.05093 | -2.009 | 5962 | 0.04463 | -0.2453 | 0.04067 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003505 | 0.001817 | 1.929 | 5956 | 0.05384 | -0.001596 | 0.008605 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003732 | 0.00002058 | -1.813 | 5945 | 0.06981 | -0.00009508 | 0.00002044 |
fixed | NA | male | -0.2658 | 0.02625 | -10.13 | 5956 | 6.65e-24 | -0.3395 | -0.1921 |
fixed | NA | sibling_count3 | -0.04207 | 0.04384 | -0.9598 | 4733 | 0.3372 | -0.1651 | 0.08098 |
fixed | NA | sibling_count4 | -0.0925 | 0.04655 | -1.987 | 4245 | 0.04695 | -0.2232 | 0.03815 |
fixed | NA | sibling_count5 | -0.1239 | 0.05041 | -2.458 | 3726 | 0.01402 | -0.2654 | 0.0176 |
fixed | NA | sibling_count>5 | -0.1499 | 0.05073 | -2.954 | 4023 | 0.003152 | -0.2922 | -0.007471 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1956 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9941 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.141 | 0.4493 | 2.539 | 5960 | 0.01115 | -0.1206 | 2.402 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1002 | 0.05094 | -1.968 | 5957 | 0.04915 | -0.2432 | 0.04276 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003429 | 0.001818 | 1.887 | 5950 | 0.05926 | -0.001673 | 0.008532 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003645 | 0.00002059 | -1.771 | 5938 | 0.07669 | -0.00009423 | 0.00002134 |
fixed | NA | male | -0.2649 | 0.02625 | -10.09 | 5952 | 9.261e-24 | -0.3386 | -0.1913 |
fixed | NA | sibling_count3 | -0.04594 | 0.0447 | -1.028 | 4891 | 0.3041 | -0.1714 | 0.07953 |
fixed | NA | sibling_count4 | -0.09413 | 0.04833 | -1.948 | 4558 | 0.05151 | -0.2298 | 0.04153 |
fixed | NA | sibling_count5 | -0.1497 | 0.05306 | -2.821 | 4177 | 0.004811 | -0.2986 | -0.0007377 |
fixed | NA | sibling_count>5 | -0.1589 | 0.05247 | -3.027 | 4390 | 0.002481 | -0.3061 | -0.01156 |
fixed | NA | birth_order_nonlinear2 | 0.02093 | 0.03515 | 0.5955 | 5239 | 0.5515 | -0.07773 | 0.1196 |
fixed | NA | birth_order_nonlinear3 | 0.04145 | 0.04233 | 0.9792 | 5491 | 0.3275 | -0.07736 | 0.1603 |
fixed | NA | birth_order_nonlinear4 | 0.02811 | 0.05083 | 0.5529 | 5639 | 0.5803 | -0.1146 | 0.1708 |
fixed | NA | birth_order_nonlinear5 | 0.1845 | 0.06237 | 2.959 | 5642 | 0.003104 | 0.009447 | 0.3596 |
fixed | NA | birth_order_nonlinear>5 | 0.06251 | 0.0578 | 1.081 | 5821 | 0.2796 | -0.09974 | 0.2248 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1939 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9942 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.137 | 0.4502 | 2.525 | 5950 | 0.01159 | -0.1269 | 2.4 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09952 | 0.05102 | -1.95 | 5947 | 0.05116 | -0.2427 | 0.0437 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003409 | 0.001821 | 1.872 | 5940 | 0.06123 | -0.001702 | 0.008521 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003628 | 0.00002062 | -1.759 | 5927 | 0.07862 | -0.00009417 | 0.00002161 |
fixed | NA | male | -0.265 | 0.02627 | -10.08 | 5942 | 1.002e-23 | -0.3387 | -0.1912 |
fixed | NA | count_birth_order2/2 | 0.01043 | 0.06822 | 0.153 | 5332 | 0.8784 | -0.1811 | 0.2019 |
fixed | NA | count_birth_order1/3 | -0.08321 | 0.05879 | -1.415 | 5948 | 0.157 | -0.2483 | 0.08182 |
fixed | NA | count_birth_order2/3 | 0.01868 | 0.06381 | 0.2928 | 5950 | 0.7697 | -0.1604 | 0.1978 |
fixed | NA | count_birth_order3/3 | -0.0109 | 0.07186 | -0.1517 | 5951 | 0.8794 | -0.2126 | 0.1908 |
fixed | NA | count_birth_order1/4 | -0.05074 | 0.06955 | -0.7296 | 5948 | 0.4657 | -0.246 | 0.1445 |
fixed | NA | count_birth_order2/4 | -0.06652 | 0.07091 | -0.938 | 5951 | 0.3483 | -0.2656 | 0.1325 |
fixed | NA | count_birth_order3/4 | -0.06716 | 0.07791 | -0.862 | 5950 | 0.3887 | -0.2858 | 0.1515 |
fixed | NA | count_birth_order4/4 | -0.1452 | 0.08033 | -1.808 | 5950 | 0.07073 | -0.3707 | 0.08029 |
fixed | NA | count_birth_order1/5 | -0.1287 | 0.08259 | -1.559 | 5950 | 0.1191 | -0.3606 | 0.1031 |
fixed | NA | count_birth_order2/5 | -0.1947 | 0.08878 | -2.193 | 5951 | 0.02835 | -0.4439 | 0.05452 |
fixed | NA | count_birth_order3/5 | -0.1136 | 0.08636 | -1.316 | 5950 | 0.1883 | -0.3561 | 0.1288 |
fixed | NA | count_birth_order4/5 | -0.123 | 0.08956 | -1.373 | 5947 | 0.1698 | -0.3744 | 0.1284 |
fixed | NA | count_birth_order5/5 | 0.06422 | 0.08981 | 0.7151 | 5946 | 0.4746 | -0.1879 | 0.3163 |
fixed | NA | count_birth_order1/>5 | -0.1769 | 0.07848 | -2.255 | 5943 | 0.02418 | -0.3972 | 0.04334 |
fixed | NA | count_birth_order2/>5 | -0.1904 | 0.08206 | -2.32 | 5949 | 0.02038 | -0.4207 | 0.03998 |
fixed | NA | count_birth_order3/>5 | -0.1052 | 0.08055 | -1.306 | 5951 | 0.1916 | -0.3313 | 0.1209 |
fixed | NA | count_birth_order4/>5 | -0.07007 | 0.07755 | -0.9036 | 5950 | 0.3663 | -0.2878 | 0.1476 |
fixed | NA | count_birth_order5/>5 | -0.001767 | 0.07974 | -0.02216 | 5947 | 0.9823 | -0.2256 | 0.2221 |
fixed | NA | count_birth_order>5/>5 | -0.1002 | 0.05776 | -1.736 | 5338 | 0.08268 | -0.2624 | 0.06188 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1906 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9952 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 17123 | 17197 | -8551 | 17101 | NA | NA | NA |
12 | 17123 | 17203 | -8549 | 17099 | 2.6 | 1 | 0.1069 |
16 | 17124 | 17231 | -8546 | 17092 | 6.411 | 4 | 0.1705 |
26 | 17138 | 17312 | -8543 | 17086 | 6.211 | 10 | 0.7972 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.072 | 0.4545 | 2.359 | 5795 | 0.01835 | -0.2035 | 2.348 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0908 | 0.05157 | -1.761 | 5792 | 0.07833 | -0.2356 | 0.05395 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003071 | 0.00184 | 1.669 | 5785 | 0.09512 | -0.002094 | 0.008236 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003239 | 0.00002084 | -1.555 | 5772 | 0.1201 | -0.00009089 | 0.0000261 |
fixed | NA | male | -0.2616 | 0.02657 | -9.846 | 5789 | 1.075e-22 | -0.3362 | -0.187 |
fixed | NA | sibling_count3 | -0.04465 | 0.03971 | -1.124 | 4468 | 0.2609 | -0.1561 | 0.06682 |
fixed | NA | sibling_count4 | -0.08125 | 0.04277 | -1.899 | 3871 | 0.05759 | -0.2013 | 0.03882 |
fixed | NA | sibling_count5 | -0.115 | 0.05 | -2.3 | 3209 | 0.02154 | -0.2553 | 0.02538 |
fixed | NA | sibling_count>5 | -0.1278 | 0.04315 | -2.963 | 2877 | 0.003073 | -0.249 | -0.006722 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1898 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9926 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.06 | 0.4544 | 2.334 | 5795 | 0.01964 | -0.2151 | 2.336 |
fixed | NA | birth_order | 0.01785 | 0.008858 | 2.016 | 5372 | 0.0439 | -0.007011 | 0.04272 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09181 | 0.05156 | -1.781 | 5791 | 0.07501 | -0.2365 | 0.05291 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003073 | 0.00184 | 1.671 | 5784 | 0.09484 | -0.00209 | 0.008237 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003172 | 0.00002084 | -1.522 | 5773 | 0.128 | -0.00009021 | 0.00002677 |
fixed | NA | male | -0.262 | 0.02656 | -9.864 | 5787 | 9.017e-23 | -0.3366 | -0.1874 |
fixed | NA | sibling_count3 | -0.05323 | 0.03994 | -1.333 | 4462 | 0.1827 | -0.1653 | 0.05888 |
fixed | NA | sibling_count4 | -0.1011 | 0.0439 | -2.303 | 3868 | 0.02135 | -0.2243 | 0.02214 |
fixed | NA | sibling_count5 | -0.1465 | 0.0524 | -2.795 | 3260 | 0.005213 | -0.2936 | 0.0006075 |
fixed | NA | sibling_count>5 | -0.1938 | 0.05419 | -3.576 | 3483 | 0.0003539 | -0.3459 | -0.04166 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1929 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9917 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.044 | 0.4546 | 2.297 | 5790 | 0.02165 | -0.2319 | 2.32 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08873 | 0.05154 | -1.722 | 5786 | 0.0852 | -0.2334 | 0.05595 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002964 | 0.001839 | 1.612 | 5778 | 0.1071 | -0.002199 | 0.008127 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00003055 | 0.00002083 | -1.466 | 5766 | 0.1426 | -0.00008903 | 0.00002793 |
fixed | NA | male | -0.2626 | 0.02655 | -9.892 | 5783 | 6.841e-23 | -0.3371 | -0.1881 |
fixed | NA | sibling_count3 | -0.05612 | 0.04085 | -1.374 | 4661 | 0.1695 | -0.1708 | 0.05854 |
fixed | NA | sibling_count4 | -0.124 | 0.04582 | -2.706 | 4240 | 0.006837 | -0.2526 | 0.004629 |
fixed | NA | sibling_count5 | -0.1948 | 0.05506 | -3.537 | 3704 | 0.0004094 | -0.3493 | -0.0402 |
fixed | NA | sibling_count>5 | -0.2001 | 0.05603 | -3.572 | 3826 | 0.0003583 | -0.3574 | -0.04287 |
fixed | NA | birth_order_nonlinear2 | 0.04114 | 0.03439 | 1.196 | 5008 | 0.2317 | -0.0554 | 0.1377 |
fixed | NA | birth_order_nonlinear3 | 0.05162 | 0.04243 | 1.217 | 5240 | 0.2238 | -0.06748 | 0.1707 |
fixed | NA | birth_order_nonlinear4 | 0.1592 | 0.05384 | 2.957 | 5413 | 0.003124 | 0.00805 | 0.3103 |
fixed | NA | birth_order_nonlinear5 | 0.2166 | 0.06823 | 3.175 | 5373 | 0.001507 | 0.0251 | 0.4081 |
fixed | NA | birth_order_nonlinear>5 | 0.04953 | 0.06681 | 0.7413 | 5756 | 0.4585 | -0.138 | 0.2371 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1887 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9919 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.015 | 0.4558 | 2.227 | 5779 | 0.026 | -0.2645 | 2.294 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08443 | 0.05168 | -1.634 | 5776 | 0.1024 | -0.2295 | 0.06063 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002813 | 0.001844 | 1.525 | 5768 | 0.1273 | -0.002364 | 0.00799 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002887 | 0.0000209 | -1.382 | 5755 | 0.1672 | -0.00008752 | 0.00002978 |
fixed | NA | male | -0.2616 | 0.02658 | -9.842 | 5773 | 1.114e-22 | -0.3362 | -0.187 |
fixed | NA | count_birth_order2/2 | 0.01484 | 0.06064 | 0.2447 | 5095 | 0.8067 | -0.1554 | 0.1851 |
fixed | NA | count_birth_order1/3 | -0.09202 | 0.05348 | -1.721 | 5777 | 0.08537 | -0.2422 | 0.0581 |
fixed | NA | count_birth_order2/3 | 0.009075 | 0.05919 | 0.1533 | 5781 | 0.8781 | -0.1571 | 0.1752 |
fixed | NA | count_birth_order3/3 | -0.006927 | 0.06507 | -0.1065 | 5780 | 0.9152 | -0.1896 | 0.1757 |
fixed | NA | count_birth_order1/4 | -0.1042 | 0.06656 | -1.565 | 5778 | 0.1176 | -0.291 | 0.08268 |
fixed | NA | count_birth_order2/4 | -0.1136 | 0.06851 | -1.658 | 5781 | 0.09733 | -0.3059 | 0.0787 |
fixed | NA | count_birth_order3/4 | -0.08828 | 0.07183 | -1.229 | 5779 | 0.2191 | -0.2899 | 0.1133 |
fixed | NA | count_birth_order4/4 | 0.02013 | 0.07593 | 0.2651 | 5778 | 0.7909 | -0.193 | 0.2333 |
fixed | NA | count_birth_order1/5 | -0.1585 | 0.08983 | -1.765 | 5780 | 0.07762 | -0.4107 | 0.09361 |
fixed | NA | count_birth_order2/5 | -0.151 | 0.09939 | -1.519 | 5780 | 0.1287 | -0.43 | 0.128 |
fixed | NA | count_birth_order3/5 | -0.1459 | 0.09485 | -1.538 | 5779 | 0.124 | -0.4121 | 0.1203 |
fixed | NA | count_birth_order4/5 | -0.05101 | 0.09137 | -0.5583 | 5779 | 0.5767 | -0.3075 | 0.2055 |
fixed | NA | count_birth_order5/5 | -0.05376 | 0.09711 | -0.5536 | 5776 | 0.5799 | -0.3263 | 0.2188 |
fixed | NA | count_birth_order1/>5 | -0.2499 | 0.09145 | -2.732 | 5775 | 0.006309 | -0.5066 | 0.006836 |
fixed | NA | count_birth_order2/>5 | -0.1872 | 0.09072 | -2.063 | 5778 | 0.03912 | -0.4418 | 0.06746 |
fixed | NA | count_birth_order3/>5 | -0.1664 | 0.08997 | -1.85 | 5781 | 0.06437 | -0.419 | 0.0861 |
fixed | NA | count_birth_order4/>5 | -0.03704 | 0.08803 | -0.4208 | 5779 | 0.6739 | -0.2842 | 0.2101 |
fixed | NA | count_birth_order5/>5 | 0.04899 | 0.0809 | 0.6055 | 5778 | 0.5449 | -0.1781 | 0.2761 |
fixed | NA | count_birth_order>5/>5 | -0.1598 | 0.05974 | -2.675 | 4968 | 0.007497 | -0.3275 | 0.007886 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1888 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9924 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16605 | 16679 | -8292 | 16583 | NA | NA | NA |
12 | 16603 | 16683 | -8290 | 16579 | 4.058 | 1 | 0.04397 |
16 | 16600 | 16706 | -8284 | 16568 | 11.43 | 4 | 0.0221 |
26 | 16617 | 16790 | -8282 | 16565 | 3.206 | 10 | 0.9761 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = big5_neu)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5805 | 0.1576 | 3.684 | 13711 | 0.0002301 | 0.1382 | 1.023 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01912 | 0.01509 | -1.267 | 13603 | 0.2052 | -0.06149 | 0.02325 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009704 | 0.0004437 | 0.2187 | 13429 | 0.8269 | -0.001148 | 0.001342 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000001933 | 0.000004082 | 0.04736 | 13256 | 0.9622 | -0.00001127 | 0.00001165 |
fixed | NA | male | -0.2605 | 0.01664 | -15.66 | 13806 | 9.038e-55 | -0.3072 | -0.2138 |
fixed | NA | sibling_count3 | -0.009417 | 0.03319 | -0.2838 | 10517 | 0.7766 | -0.1026 | 0.08374 |
fixed | NA | sibling_count4 | -0.002559 | 0.03413 | -0.07498 | 9566 | 0.9402 | -0.09835 | 0.09323 |
fixed | NA | sibling_count5 | -0.03946 | 0.03539 | -1.115 | 8500 | 0.2649 | -0.1388 | 0.05989 |
fixed | NA | sibling_count>5 | 0.02614 | 0.02785 | 0.9384 | 9661 | 0.3481 | -0.05205 | 0.1043 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2846 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9435 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.58 | 0.1576 | 3.681 | 13713 | 0.0002335 | 0.1377 | 1.022 |
fixed | NA | birth_order | -0.001117 | 0.003475 | -0.3215 | 11756 | 0.7479 | -0.01087 | 0.008638 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01879 | 0.01513 | -1.242 | 13587 | 0.2143 | -0.06126 | 0.02368 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008512 | 0.0004452 | 0.1912 | 13370 | 0.8484 | -0.001165 | 0.001335 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000000302 | 0.000004096 | 0.07372 | 13174 | 0.9412 | -0.0000112 | 0.0000118 |
fixed | NA | male | -0.2604 | 0.01664 | -15.65 | 13804 | 9.417e-55 | -0.3071 | -0.2137 |
fixed | NA | sibling_count3 | -0.009148 | 0.0332 | -0.2755 | 10529 | 0.7829 | -0.1023 | 0.08405 |
fixed | NA | sibling_count4 | -0.001769 | 0.03422 | -0.05169 | 9624 | 0.9588 | -0.09782 | 0.09428 |
fixed | NA | sibling_count5 | -0.03809 | 0.03565 | -1.069 | 8603 | 0.2853 | -0.1382 | 0.06197 |
fixed | NA | sibling_count>5 | 0.0304 | 0.03085 | 0.9854 | 10648 | 0.3245 | -0.05619 | 0.117 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2849 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9435 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5764 | 0.158 | 3.648 | 13716 | 0.0002652 | 0.1329 | 1.02 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01814 | 0.01514 | -1.199 | 13597 | 0.2307 | -0.06063 | 0.02434 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00005994 | 0.0004453 | 0.1346 | 13381 | 0.8929 | -0.00119 | 0.00131 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000005424 | 0.000004098 | 0.1324 | 13174 | 0.8947 | -0.00001096 | 0.00001205 |
fixed | NA | male | -0.2604 | 0.01664 | -15.65 | 13799 | 1.021e-54 | -0.3071 | -0.2137 |
fixed | NA | sibling_count3 | -0.007709 | 0.0337 | -0.2287 | 10868 | 0.8191 | -0.1023 | 0.08689 |
fixed | NA | sibling_count4 | -0.001011 | 0.03525 | -0.02867 | 10345 | 0.9771 | -0.09996 | 0.09794 |
fixed | NA | sibling_count5 | -0.03826 | 0.03713 | -1.031 | 9574 | 0.3027 | -0.1425 | 0.06595 |
fixed | NA | sibling_count>5 | 0.04189 | 0.03251 | 1.288 | 11764 | 0.1976 | -0.04937 | 0.1332 |
fixed | NA | birth_order_nonlinear2 | -0.002359 | 0.02426 | -0.09724 | 12739 | 0.9225 | -0.07045 | 0.06573 |
fixed | NA | birth_order_nonlinear3 | -0.01075 | 0.02863 | -0.3755 | 12588 | 0.7073 | -0.09111 | 0.06961 |
fixed | NA | birth_order_nonlinear4 | -0.0006682 | 0.03261 | -0.02049 | 12677 | 0.9836 | -0.09219 | 0.09086 |
fixed | NA | birth_order_nonlinear5 | 0.0002819 | 0.03708 | 0.007603 | 12741 | 0.9939 | -0.1038 | 0.1044 |
fixed | NA | birth_order_nonlinear>5 | -0.03676 | 0.0306 | -1.202 | 13920 | 0.2295 | -0.1226 | 0.04912 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2852 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9434 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5674 | 0.1587 | 3.575 | 13715 | 0.0003515 | 0.1219 | 1.013 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01774 | 0.01514 | -1.172 | 13588 | 0.2414 | -0.06024 | 0.02476 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00004913 | 0.0004455 | 0.1103 | 13366 | 0.9122 | -0.001201 | 0.0013 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006254 | 0.000004099 | 0.1525 | 13152 | 0.8788 | -0.00001088 | 0.00001213 |
fixed | NA | male | -0.2604 | 0.01664 | -15.64 | 13789 | 1.073e-54 | -0.3071 | -0.2137 |
fixed | NA | count_birth_order2/2 | 0.01066 | 0.04715 | 0.2261 | 12596 | 0.8211 | -0.1217 | 0.143 |
fixed | NA | count_birth_order1/3 | 0.0004386 | 0.04446 | 0.009865 | 13825 | 0.9921 | -0.1244 | 0.1252 |
fixed | NA | count_birth_order2/3 | -0.00866 | 0.04971 | -0.1742 | 13864 | 0.8617 | -0.1482 | 0.1309 |
fixed | NA | count_birth_order3/3 | -0.01581 | 0.05567 | -0.2839 | 13894 | 0.7765 | -0.1721 | 0.1405 |
fixed | NA | count_birth_order1/4 | -0.02016 | 0.05076 | -0.3971 | 13867 | 0.6913 | -0.1627 | 0.1223 |
fixed | NA | count_birth_order2/4 | 0.02738 | 0.05339 | 0.5129 | 13879 | 0.608 | -0.1225 | 0.1772 |
fixed | NA | count_birth_order3/4 | 0.01082 | 0.058 | 0.1866 | 13897 | 0.852 | -0.152 | 0.1736 |
fixed | NA | count_birth_order4/4 | -0.01496 | 0.0614 | -0.2437 | 13906 | 0.8075 | -0.1873 | 0.1574 |
fixed | NA | count_birth_order1/5 | 0.01294 | 0.0576 | 0.2247 | 13895 | 0.8222 | -0.1487 | 0.1746 |
fixed | NA | count_birth_order2/5 | -0.0134 | 0.06058 | -0.2212 | 13905 | 0.8249 | -0.1835 | 0.1567 |
fixed | NA | count_birth_order3/5 | -0.03575 | 0.06218 | -0.5749 | 13907 | 0.5654 | -0.2103 | 0.1388 |
fixed | NA | count_birth_order4/5 | -0.0666 | 0.06586 | -1.011 | 13910 | 0.312 | -0.2515 | 0.1183 |
fixed | NA | count_birth_order5/5 | -0.1109 | 0.06733 | -1.648 | 13910 | 0.09939 | -0.2999 | 0.07804 |
fixed | NA | count_birth_order1/>5 | 0.04369 | 0.04651 | 0.9394 | 13909 | 0.3476 | -0.08686 | 0.1742 |
fixed | NA | count_birth_order2/>5 | 0.009542 | 0.04797 | 0.1989 | 13910 | 0.8423 | -0.1251 | 0.1442 |
fixed | NA | count_birth_order3/>5 | 0.02378 | 0.047 | 0.5059 | 13910 | 0.613 | -0.1081 | 0.1557 |
fixed | NA | count_birth_order4/>5 | 0.06431 | 0.04606 | 1.396 | 13910 | 0.1626 | -0.06497 | 0.1936 |
fixed | NA | count_birth_order5/>5 | 0.07289 | 0.0464 | 1.571 | 13909 | 0.1162 | -0.05735 | 0.2031 |
fixed | NA | count_birth_order>5/>5 | 0.009809 | 0.03612 | 0.2716 | 12651 | 0.786 | -0.09159 | 0.1112 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2849 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9437 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 39076 | 39159 | -19527 | 39054 | NA | NA | NA |
12 | 39078 | 39168 | -19527 | 39054 | 0.1024 | 1 | 0.749 |
16 | 39084 | 39205 | -19526 | 39052 | 1.999 | 4 | 0.736 |
26 | 39098 | 39294 | -19523 | 39046 | 6.132 | 10 | 0.804 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3543 | 0.4352 | -0.814 | 5906 | 0.4157 | -1.576 | 0.8675 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09127 | 0.04938 | 1.848 | 5910 | 0.06462 | -0.04735 | 0.2299 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004075 | 0.001762 | -2.313 | 5913 | 0.02077 | -0.009022 | 0.000871 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004695 | 0.00001995 | 2.353 | 5915 | 0.01865 | -0.000009057 | 0.000103 |
fixed | NA | male | -0.2664 | 0.02545 | -10.47 | 5874 | 2.056e-25 | -0.3378 | -0.1949 |
fixed | NA | sibling_count3 | 0.01865 | 0.03952 | 0.4719 | 4540 | 0.6371 | -0.09229 | 0.1296 |
fixed | NA | sibling_count4 | 0.02037 | 0.04245 | 0.4798 | 3988 | 0.6314 | -0.09879 | 0.1395 |
fixed | NA | sibling_count5 | 0.07006 | 0.04833 | 1.449 | 3532 | 0.1473 | -0.06561 | 0.2057 |
fixed | NA | sibling_count>5 | 0.1134 | 0.04237 | 2.676 | 3266 | 0.007478 | -0.005534 | 0.2324 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2875 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9381 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3506 | 0.4353 | -0.8054 | 5905 | 0.4206 | -1.573 | 0.8713 |
fixed | NA | birth_order | -0.004386 | 0.008375 | -0.5237 | 5712 | 0.6005 | -0.0279 | 0.01912 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09146 | 0.04939 | 1.852 | 5909 | 0.06409 | -0.04717 | 0.2301 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004074 | 0.001762 | -2.312 | 5912 | 0.02081 | -0.009021 | 0.0008722 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004677 | 0.00001996 | 2.343 | 5914 | 0.01914 | -0.000009251 | 0.0001028 |
fixed | NA | male | -0.2662 | 0.02546 | -10.46 | 5874 | 2.257e-25 | -0.3377 | -0.1947 |
fixed | NA | sibling_count3 | 0.02077 | 0.03973 | 0.5227 | 4543 | 0.6012 | -0.09076 | 0.1323 |
fixed | NA | sibling_count4 | 0.02537 | 0.04351 | 0.583 | 3990 | 0.5599 | -0.09677 | 0.1475 |
fixed | NA | sibling_count5 | 0.07826 | 0.05081 | 1.54 | 3602 | 0.1236 | -0.06437 | 0.2209 |
fixed | NA | sibling_count>5 | 0.1299 | 0.05275 | 2.462 | 3776 | 0.01386 | -0.0182 | 0.2779 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2875 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9382 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3461 | 0.4357 | -0.7943 | 5904 | 0.4271 | -1.569 | 0.8769 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09076 | 0.04938 | 1.838 | 5906 | 0.06614 | -0.04786 | 0.2294 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00404 | 0.001762 | -2.293 | 5909 | 0.0219 | -0.008987 | 0.0009064 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004615 | 0.00001996 | 2.312 | 5910 | 0.02079 | -0.000009872 | 0.0001022 |
fixed | NA | male | -0.2659 | 0.02544 | -10.45 | 5870 | 2.41e-25 | -0.3373 | -0.1945 |
fixed | NA | sibling_count3 | 0.002937 | 0.04055 | 0.07242 | 4732 | 0.9423 | -0.1109 | 0.1168 |
fixed | NA | sibling_count4 | 0.02674 | 0.04526 | 0.5908 | 4336 | 0.5547 | -0.1003 | 0.1538 |
fixed | NA | sibling_count5 | 0.09421 | 0.05348 | 1.762 | 4065 | 0.07822 | -0.05591 | 0.2443 |
fixed | NA | sibling_count>5 | 0.1447 | 0.05434 | 2.662 | 4069 | 0.007796 | -0.007876 | 0.2972 |
fixed | NA | birth_order_nonlinear2 | -0.01411 | 0.0331 | -0.4264 | 5070 | 0.6698 | -0.107 | 0.07879 |
fixed | NA | birth_order_nonlinear3 | 0.06996 | 0.04079 | 1.715 | 5302 | 0.08636 | -0.04453 | 0.1844 |
fixed | NA | birth_order_nonlinear4 | -0.1062 | 0.05038 | -2.109 | 5452 | 0.03501 | -0.2477 | 0.03518 |
fixed | NA | birth_order_nonlinear5 | -0.0758 | 0.06294 | -1.204 | 5358 | 0.2285 | -0.2525 | 0.1009 |
fixed | NA | birth_order_nonlinear>5 | -0.0365 | 0.06279 | -0.5813 | 5909 | 0.5611 | -0.2128 | 0.1398 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2848 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9382 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.4027 | 0.4364 | -0.9229 | 5894 | 0.3561 | -1.628 | 0.8221 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09799 | 0.04946 | 1.981 | 5896 | 0.04762 | -0.04085 | 0.2368 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004291 | 0.001765 | -2.431 | 5898 | 0.0151 | -0.009245 | 0.0006642 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000489 | 0.00002 | 2.445 | 5900 | 0.0145 | -0.00000723 | 0.000105 |
fixed | NA | male | -0.2654 | 0.02545 | -10.43 | 5858 | 2.97e-25 | -0.3369 | -0.194 |
fixed | NA | count_birth_order2/2 | -0.039 | 0.05976 | -0.6525 | 5248 | 0.5141 | -0.2068 | 0.1288 |
fixed | NA | count_birth_order1/3 | -0.04149 | 0.0525 | -0.7903 | 5886 | 0.4294 | -0.1889 | 0.1059 |
fixed | NA | count_birth_order2/3 | 0.01587 | 0.05738 | 0.2765 | 5897 | 0.7822 | -0.1452 | 0.1769 |
fixed | NA | count_birth_order3/3 | 0.08473 | 0.06415 | 1.321 | 5900 | 0.1866 | -0.09534 | 0.2648 |
fixed | NA | count_birth_order1/4 | 0.04092 | 0.0642 | 0.6374 | 5892 | 0.5239 | -0.1393 | 0.2211 |
fixed | NA | count_birth_order2/4 | 0.04203 | 0.06646 | 0.6324 | 5900 | 0.5271 | -0.1445 | 0.2286 |
fixed | NA | count_birth_order3/4 | 0.0375 | 0.07026 | 0.5337 | 5897 | 0.5936 | -0.1597 | 0.2347 |
fixed | NA | count_birth_order4/4 | -0.1151 | 0.07304 | -1.576 | 5896 | 0.1151 | -0.3201 | 0.08992 |
fixed | NA | count_birth_order1/5 | 0.2044 | 0.08723 | 2.344 | 5900 | 0.01914 | -0.04043 | 0.4493 |
fixed | NA | count_birth_order2/5 | -0.11 | 0.09341 | -1.177 | 5893 | 0.2391 | -0.3722 | 0.1522 |
fixed | NA | count_birth_order3/5 | 0.2414 | 0.08757 | 2.757 | 5891 | 0.005853 | -0.004389 | 0.4872 |
fixed | NA | count_birth_order4/5 | -0.0007861 | 0.08435 | -0.00932 | 5894 | 0.9926 | -0.2375 | 0.236 |
fixed | NA | count_birth_order5/5 | -0.06552 | 0.08778 | -0.7464 | 5888 | 0.4555 | -0.3119 | 0.1809 |
fixed | NA | count_birth_order1/>5 | 0.07957 | 0.08655 | 0.9194 | 5900 | 0.3579 | -0.1634 | 0.3225 |
fixed | NA | count_birth_order2/>5 | 0.1312 | 0.0857 | 1.531 | 5898 | 0.1259 | -0.1094 | 0.3717 |
fixed | NA | count_birth_order3/>5 | 0.1658 | 0.08586 | 1.93 | 5887 | 0.0536 | -0.07527 | 0.4068 |
fixed | NA | count_birth_order4/>5 | 0.04447 | 0.08091 | 0.5497 | 5884 | 0.5826 | -0.1826 | 0.2716 |
fixed | NA | count_birth_order5/>5 | 0.1124 | 0.07646 | 1.47 | 5883 | 0.1417 | -0.1023 | 0.327 |
fixed | NA | count_birth_order>5/>5 | 0.09957 | 0.05735 | 1.736 | 5353 | 0.08261 | -0.06142 | 0.2606 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2864 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9374 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16578 | 16652 | -8278 | 16556 | NA | NA | NA |
12 | 16580 | 16660 | -8278 | 16556 | 0.2748 | 1 | 0.6001 |
16 | 16576 | 16683 | -8272 | 16544 | 12.34 | 4 | 0.01502 |
26 | 16582 | 16755 | -8265 | 16530 | 14.13 | 10 | 0.1673 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3839 | 0.4336 | -0.8853 | 5958 | 0.376 | -1.601 | 0.8332 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09637 | 0.04922 | 1.958 | 5961 | 0.05029 | -0.04179 | 0.2345 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004224 | 0.001757 | -2.405 | 5964 | 0.01621 | -0.009155 | 0.0007065 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004839 | 0.00001989 | 2.432 | 5966 | 0.01503 | -0.000007456 | 0.0001042 |
fixed | NA | male | -0.2706 | 0.02533 | -10.68 | 5925 | 2.202e-26 | -0.3417 | -0.1994 |
fixed | NA | sibling_count3 | -0.001241 | 0.04271 | -0.02905 | 4700 | 0.9768 | -0.1211 | 0.1187 |
fixed | NA | sibling_count4 | -0.001944 | 0.04493 | -0.04327 | 4282 | 0.9655 | -0.1281 | 0.1242 |
fixed | NA | sibling_count5 | -0.03667 | 0.04794 | -0.765 | 3824 | 0.4443 | -0.1712 | 0.09789 |
fixed | NA | sibling_count>5 | 0.0932 | 0.04204 | 2.217 | 3909 | 0.0267 | -0.02482 | 0.2112 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2852 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9382 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3782 | 0.4337 | -0.8721 | 5957 | 0.3832 | -1.596 | 0.8392 |
fixed | NA | birth_order | -0.004982 | 0.00729 | -0.6834 | 5481 | 0.4944 | -0.02544 | 0.01548 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0964 | 0.04922 | 1.958 | 5960 | 0.05022 | -0.04177 | 0.2346 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004217 | 0.001757 | -2.4 | 5963 | 0.01641 | -0.009148 | 0.0007144 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004811 | 0.0000199 | 2.418 | 5965 | 0.01565 | -0.000007749 | 0.000104 |
fixed | NA | male | -0.2704 | 0.02534 | -10.67 | 5925 | 2.389e-26 | -0.3415 | -0.1993 |
fixed | NA | sibling_count3 | 0.00115 | 0.04286 | 0.02684 | 4698 | 0.9786 | -0.1192 | 0.1215 |
fixed | NA | sibling_count4 | 0.003495 | 0.04563 | 0.0766 | 4266 | 0.9389 | -0.1246 | 0.1316 |
fixed | NA | sibling_count5 | -0.02809 | 0.04956 | -0.5667 | 3829 | 0.571 | -0.1672 | 0.111 |
fixed | NA | sibling_count>5 | 0.1114 | 0.04977 | 2.238 | 4182 | 0.02526 | -0.02831 | 0.2511 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2853 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9382 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3631 | 0.434 | -0.8366 | 5955 | 0.4028 | -1.582 | 0.8552 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09484 | 0.04922 | 1.927 | 5958 | 0.05405 | -0.04333 | 0.233 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004152 | 0.001757 | -2.363 | 5960 | 0.01815 | -0.009084 | 0.0007798 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004717 | 0.0000199 | 2.37 | 5961 | 0.01782 | -0.000008698 | 0.000103 |
fixed | NA | male | -0.2712 | 0.02533 | -10.71 | 5921 | 1.678e-26 | -0.3423 | -0.2001 |
fixed | NA | sibling_count3 | -0.01381 | 0.04365 | -0.3164 | 4850 | 0.7517 | -0.1363 | 0.1087 |
fixed | NA | sibling_count4 | -0.007871 | 0.04728 | -0.1665 | 4558 | 0.8678 | -0.1406 | 0.1248 |
fixed | NA | sibling_count5 | -0.02175 | 0.05201 | -0.4181 | 4241 | 0.6759 | -0.1677 | 0.1243 |
fixed | NA | sibling_count>5 | 0.1204 | 0.05136 | 2.344 | 4492 | 0.0191 | -0.02376 | 0.2646 |
fixed | NA | birth_order_nonlinear2 | -0.02501 | 0.03368 | -0.7427 | 5200 | 0.4577 | -0.1196 | 0.06953 |
fixed | NA | birth_order_nonlinear3 | 0.05665 | 0.04062 | 1.395 | 5424 | 0.1632 | -0.05738 | 0.1707 |
fixed | NA | birth_order_nonlinear4 | -0.0316 | 0.04884 | -0.6469 | 5570 | 0.5177 | -0.1687 | 0.1055 |
fixed | NA | birth_order_nonlinear5 | -0.1226 | 0.05993 | -2.045 | 5545 | 0.04086 | -0.2908 | 0.04564 |
fixed | NA | birth_order_nonlinear>5 | -0.04813 | 0.05599 | -0.8595 | 5926 | 0.3901 | -0.2053 | 0.109 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2834 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9383 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3939 | 0.4347 | -0.906 | 5946 | 0.365 | -1.614 | 0.8264 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09802 | 0.04928 | 1.989 | 5948 | 0.04674 | -0.04031 | 0.2364 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004261 | 0.001759 | -2.422 | 5950 | 0.01547 | -0.009199 | 0.0006777 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004832 | 0.00001993 | 2.424 | 5951 | 0.01539 | -0.000007638 | 0.0001043 |
fixed | NA | male | -0.2715 | 0.02534 | -10.71 | 5911 | 1.53e-26 | -0.3426 | -0.2004 |
fixed | NA | count_birth_order2/2 | -0.01787 | 0.06539 | -0.2732 | 5358 | 0.7847 | -0.2014 | 0.1657 |
fixed | NA | count_birth_order1/3 | -0.02834 | 0.05683 | -0.4987 | 5938 | 0.618 | -0.1879 | 0.1312 |
fixed | NA | count_birth_order2/3 | -0.04075 | 0.06165 | -0.6609 | 5948 | 0.5087 | -0.2138 | 0.1323 |
fixed | NA | count_birth_order3/3 | 0.08512 | 0.0694 | 1.227 | 5951 | 0.22 | -0.1097 | 0.2799 |
fixed | NA | count_birth_order1/4 | -0.05575 | 0.06722 | -0.8294 | 5944 | 0.4069 | -0.2444 | 0.1329 |
fixed | NA | count_birth_order2/4 | -0.006205 | 0.06851 | -0.09057 | 5950 | 0.9278 | -0.1985 | 0.1861 |
fixed | NA | count_birth_order3/4 | 0.09585 | 0.07522 | 1.274 | 5949 | 0.2026 | -0.1153 | 0.307 |
fixed | NA | count_birth_order4/4 | -0.0416 | 0.07755 | -0.5364 | 5948 | 0.5917 | -0.2593 | 0.1761 |
fixed | NA | count_birth_order1/5 | 0.116 | 0.07979 | 1.454 | 5950 | 0.1459 | -0.1079 | 0.34 |
fixed | NA | count_birth_order2/5 | -0.04191 | 0.08573 | -0.4888 | 5948 | 0.625 | -0.2825 | 0.1987 |
fixed | NA | count_birth_order3/5 | 0.005031 | 0.08338 | 0.06034 | 5947 | 0.9519 | -0.229 | 0.2391 |
fixed | NA | count_birth_order4/5 | -0.08346 | 0.08643 | -0.9656 | 5940 | 0.3343 | -0.3261 | 0.1592 |
fixed | NA | count_birth_order5/5 | -0.249 | 0.08667 | -2.873 | 5939 | 0.004081 | -0.4923 | -0.005715 |
fixed | NA | count_birth_order1/>5 | 0.1245 | 0.07584 | 1.642 | 5949 | 0.1006 | -0.08835 | 0.3374 |
fixed | NA | count_birth_order2/>5 | 0.06323 | 0.07926 | 0.7977 | 5950 | 0.4251 | -0.1593 | 0.2857 |
fixed | NA | count_birth_order3/>5 | 0.1071 | 0.07777 | 1.377 | 5944 | 0.1687 | -0.1112 | 0.3254 |
fixed | NA | count_birth_order4/>5 | 0.1166 | 0.07485 | 1.558 | 5942 | 0.1193 | -0.09349 | 0.3268 |
fixed | NA | count_birth_order5/>5 | 0.07651 | 0.07694 | 0.9944 | 5930 | 0.3201 | -0.1395 | 0.2925 |
fixed | NA | count_birth_order>5/>5 | 0.075 | 0.05618 | 1.335 | 5485 | 0.182 | -0.08271 | 0.2327 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2831 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9382 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16714 | 16788 | -8346 | 16692 | NA | NA | NA |
12 | 16716 | 16796 | -8346 | 16692 | 0.4677 | 1 | 0.4941 |
16 | 16714 | 16821 | -8341 | 16682 | 9.387 | 4 | 0.05213 |
26 | 16723 | 16897 | -8335 | 16671 | 11.66 | 10 | 0.3085 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3119 | 0.4401 | -0.7089 | 5790 | 0.4784 | -1.547 | 0.9233 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08493 | 0.04995 | 1.7 | 5793 | 0.08912 | -0.05528 | 0.2251 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003823 | 0.001783 | -2.144 | 5795 | 0.03206 | -0.008827 | 0.001182 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004382 | 0.0000202 | 2.17 | 5796 | 0.03008 | -0.00001287 | 0.0001005 |
fixed | NA | male | -0.2671 | 0.0257 | -10.39 | 5761 | 4.477e-25 | -0.3392 | -0.195 |
fixed | NA | sibling_count3 | 0.02263 | 0.03892 | 0.5814 | 4439 | 0.561 | -0.08662 | 0.1319 |
fixed | NA | sibling_count4 | 0.02637 | 0.04206 | 0.6269 | 3907 | 0.5308 | -0.0917 | 0.1444 |
fixed | NA | sibling_count5 | 0.06156 | 0.04935 | 1.247 | 3337 | 0.2123 | -0.07697 | 0.2001 |
fixed | NA | sibling_count>5 | 0.1362 | 0.04268 | 3.191 | 3077 | 0.001431 | 0.0164 | 0.256 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2779 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9399 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.31 | 0.4401 | -0.7044 | 5789 | 0.4812 | -1.546 | 0.9254 |
fixed | NA | birth_order | -0.002816 | 0.008623 | -0.3265 | 5619 | 0.744 | -0.02702 | 0.02139 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0851 | 0.04996 | 1.703 | 5792 | 0.08855 | -0.05513 | 0.2253 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003823 | 0.001783 | -2.144 | 5794 | 0.03204 | -0.008828 | 0.001181 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004372 | 0.0000202 | 2.164 | 5795 | 0.0305 | -0.00001299 | 0.0001004 |
fixed | NA | male | -0.267 | 0.0257 | -10.39 | 5760 | 4.66e-25 | -0.3392 | -0.1949 |
fixed | NA | sibling_count3 | 0.02399 | 0.03915 | 0.6129 | 4440 | 0.54 | -0.08589 | 0.1339 |
fixed | NA | sibling_count4 | 0.02953 | 0.04316 | 0.6841 | 3920 | 0.494 | -0.09164 | 0.1507 |
fixed | NA | sibling_count5 | 0.06659 | 0.0517 | 1.288 | 3405 | 0.1978 | -0.07853 | 0.2117 |
fixed | NA | sibling_count>5 | 0.1467 | 0.05338 | 2.748 | 3686 | 0.006033 | -0.003175 | 0.2965 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2779 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.94 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3089 | 0.4404 | -0.7015 | 5787 | 0.483 | -1.545 | 0.9274 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08496 | 0.04995 | 1.701 | 5789 | 0.08902 | -0.05525 | 0.2252 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003814 | 0.001783 | -2.139 | 5791 | 0.03244 | -0.008818 | 0.00119 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004349 | 0.0000202 | 2.153 | 5791 | 0.03138 | -0.00001322 | 0.0001002 |
fixed | NA | male | -0.2661 | 0.02569 | -10.36 | 5757 | 6.318e-25 | -0.3383 | -0.194 |
fixed | NA | sibling_count3 | 0.00615 | 0.04 | 0.1538 | 4631 | 0.8778 | -0.1061 | 0.1184 |
fixed | NA | sibling_count4 | 0.03058 | 0.04497 | 0.68 | 4267 | 0.4966 | -0.09566 | 0.1568 |
fixed | NA | sibling_count5 | 0.08032 | 0.05419 | 1.482 | 3821 | 0.1384 | -0.07179 | 0.2324 |
fixed | NA | sibling_count>5 | 0.1524 | 0.05509 | 2.766 | 3999 | 0.005705 | -0.002274 | 0.307 |
fixed | NA | birth_order_nonlinear2 | -0.01162 | 0.03304 | -0.3517 | 4967 | 0.7251 | -0.1044 | 0.08113 |
fixed | NA | birth_order_nonlinear3 | 0.0701 | 0.04082 | 1.717 | 5177 | 0.086 | -0.04449 | 0.1847 |
fixed | NA | birth_order_nonlinear4 | -0.1025 | 0.05187 | -1.975 | 5336 | 0.04827 | -0.248 | 0.04313 |
fixed | NA | birth_order_nonlinear5 | -0.06008 | 0.06569 | -0.9146 | 5266 | 0.3604 | -0.2445 | 0.1243 |
fixed | NA | birth_order_nonlinear>5 | -0.008558 | 0.06479 | -0.1321 | 5791 | 0.8949 | -0.1904 | 0.1733 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2758 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9399 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.3435 | 0.4413 | -0.7782 | 5778 | 0.4365 | -1.582 | 0.8954 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08974 | 0.05005 | 1.793 | 5779 | 0.07301 | -0.05075 | 0.2302 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003982 | 0.001787 | -2.229 | 5781 | 0.02587 | -0.008997 | 0.001033 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004536 | 0.00002025 | 2.24 | 5781 | 0.02512 | -0.00001148 | 0.0001022 |
fixed | NA | male | -0.2651 | 0.02571 | -10.31 | 5745 | 1.02e-24 | -0.3373 | -0.1929 |
fixed | NA | count_birth_order2/2 | -0.03673 | 0.05826 | -0.6303 | 5107 | 0.5285 | -0.2003 | 0.1268 |
fixed | NA | count_birth_order1/3 | -0.03504 | 0.05183 | -0.6761 | 5768 | 0.499 | -0.1805 | 0.1104 |
fixed | NA | count_birth_order2/3 | 0.02112 | 0.05733 | 0.3685 | 5780 | 0.7125 | -0.1398 | 0.182 |
fixed | NA | count_birth_order3/3 | 0.08289 | 0.063 | 1.316 | 5780 | 0.1883 | -0.09395 | 0.2597 |
fixed | NA | count_birth_order1/4 | 0.03566 | 0.06449 | 0.5529 | 5777 | 0.5804 | -0.1454 | 0.2167 |
fixed | NA | count_birth_order2/4 | 0.05259 | 0.06634 | 0.7926 | 5781 | 0.428 | -0.1336 | 0.2388 |
fixed | NA | count_birth_order3/4 | 0.06513 | 0.06952 | 0.9368 | 5777 | 0.3489 | -0.13 | 0.2603 |
fixed | NA | count_birth_order4/4 | -0.1268 | 0.07348 | -1.725 | 5775 | 0.0846 | -0.333 | 0.07952 |
fixed | NA | count_birth_order1/5 | 0.1824 | 0.087 | 2.097 | 5781 | 0.03602 | -0.06176 | 0.4267 |
fixed | NA | count_birth_order2/5 | -0.1091 | 0.09619 | -1.135 | 5774 | 0.2566 | -0.3792 | 0.1609 |
fixed | NA | count_birth_order3/5 | 0.1727 | 0.09178 | 1.882 | 5771 | 0.05994 | -0.08494 | 0.4303 |
fixed | NA | count_birth_order4/5 | 0.01715 | 0.08843 | 0.1939 | 5774 | 0.8462 | -0.2311 | 0.2654 |
fixed | NA | count_birth_order5/5 | -0.05352 | 0.09396 | -0.5696 | 5769 | 0.569 | -0.3173 | 0.2102 |
fixed | NA | count_birth_order1/>5 | 0.09742 | 0.08857 | 1.1 | 5781 | 0.2714 | -0.1512 | 0.3461 |
fixed | NA | count_birth_order2/>5 | 0.1182 | 0.08785 | 1.346 | 5779 | 0.1785 | -0.1284 | 0.3648 |
fixed | NA | count_birth_order3/>5 | 0.1982 | 0.08707 | 2.276 | 5768 | 0.02285 | -0.04619 | 0.4426 |
fixed | NA | count_birth_order4/>5 | 0.06053 | 0.08517 | 0.7107 | 5759 | 0.4773 | -0.1785 | 0.2996 |
fixed | NA | count_birth_order5/>5 | 0.1239 | 0.07828 | 1.582 | 5764 | 0.1136 | -0.09587 | 0.3436 |
fixed | NA | count_birth_order>5/>5 | 0.1351 | 0.05831 | 2.316 | 5172 | 0.02058 | -0.02862 | 0.2987 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2761 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9398 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16235 | 16308 | -8106 | 16213 | NA | NA | NA |
12 | 16237 | 16317 | -8106 | 16213 | 0.1071 | 1 | 0.7435 |
16 | 16234 | 16340 | -8101 | 16202 | 11.14 | 4 | 0.02506 |
26 | 16243 | 16416 | -8096 | 16191 | 10.72 | 10 | 0.3799 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = big5_con)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.384 | 0.1564 | -8.846 | 13621 | 1.016e-18 | -1.823 | -0.9446 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07934 | 0.01497 | 5.299 | 13475 | 0.0000001185 | 0.03731 | 0.1214 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001195 | 0.0004398 | -2.718 | 13274 | 0.006579 | -0.00243 | 0.00003921 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005148 | 0.000004043 | 1.273 | 13095 | 0.203 | -0.000006202 | 0.0000165 |
fixed | NA | male | 0.0443 | 0.01659 | 2.669 | 13887 | 0.00761 | -0.002285 | 0.09088 |
fixed | NA | sibling_count3 | -0.01129 | 0.03263 | -0.346 | 10656 | 0.7293 | -0.1029 | 0.08031 |
fixed | NA | sibling_count4 | -0.01053 | 0.03347 | -0.3145 | 9594 | 0.7531 | -0.1045 | 0.08343 |
fixed | NA | sibling_count5 | -0.0000886 | 0.03461 | -0.00256 | 8380 | 0.998 | -0.09724 | 0.09706 |
fixed | NA | sibling_count>5 | 0.02139 | 0.02733 | 0.7829 | 9670 | 0.4337 | -0.05532 | 0.0981 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2052 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9578 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.384 | 0.1564 | -8.85 | 13624 | 9.775e-19 | -1.824 | -0.9454 |
fixed | NA | birth_order | -0.001557 | 0.003422 | -0.4549 | 10419 | 0.6492 | -0.01116 | 0.008049 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0798 | 0.01501 | 5.317 | 13457 | 0.0000001072 | 0.03767 | 0.1219 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001211 | 0.0004412 | -2.745 | 13209 | 0.006056 | -0.00245 | 0.00002729 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005292 | 0.000004056 | 1.305 | 13010 | 0.192 | -0.000006094 | 0.00001668 |
fixed | NA | male | 0.04434 | 0.0166 | 2.672 | 13886 | 0.007552 | -0.002243 | 0.09092 |
fixed | NA | sibling_count3 | -0.01089 | 0.03265 | -0.3337 | 10671 | 0.7386 | -0.1025 | 0.08075 |
fixed | NA | sibling_count4 | -0.009402 | 0.03357 | -0.2801 | 9650 | 0.7794 | -0.1036 | 0.08482 |
fixed | NA | sibling_count5 | 0.00183 | 0.03487 | 0.05247 | 8475 | 0.9582 | -0.09605 | 0.09971 |
fixed | NA | sibling_count>5 | 0.02738 | 0.03034 | 0.9025 | 10573 | 0.3668 | -0.05777 | 0.1125 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2055 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9578 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.373 | 0.1568 | -8.753 | 13630 | 2.309e-18 | -1.813 | -0.9327 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07988 | 0.01501 | 5.32 | 13469 | 0.0000001051 | 0.03773 | 0.122 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001203 | 0.0004413 | -2.726 | 13222 | 0.006414 | -0.002442 | 0.00003564 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005103 | 0.000004057 | 1.258 | 13011 | 0.2085 | -0.000006285 | 0.00001649 |
fixed | NA | male | 0.04452 | 0.0166 | 2.682 | 13882 | 0.007316 | -0.002067 | 0.0911 |
fixed | NA | sibling_count3 | -0.004833 | 0.03316 | -0.1457 | 11026 | 0.8841 | -0.09792 | 0.08825 |
fixed | NA | sibling_count4 | -0.003616 | 0.03464 | -0.1044 | 10422 | 0.9169 | -0.1008 | 0.09362 |
fixed | NA | sibling_count5 | 0.01333 | 0.0364 | 0.3662 | 9524 | 0.7142 | -0.08885 | 0.1155 |
fixed | NA | sibling_count>5 | 0.0351 | 0.03206 | 1.095 | 11818 | 0.2736 | -0.0549 | 0.1251 |
fixed | NA | birth_order_nonlinear2 | -0.04456 | 0.02432 | -1.832 | 12767 | 0.06694 | -0.1128 | 0.02371 |
fixed | NA | birth_order_nonlinear3 | -0.04247 | 0.02871 | -1.479 | 12682 | 0.1391 | -0.1231 | 0.03813 |
fixed | NA | birth_order_nonlinear4 | -0.01607 | 0.03269 | -0.4915 | 12813 | 0.6231 | -0.1078 | 0.07569 |
fixed | NA | birth_order_nonlinear5 | -0.06266 | 0.03717 | -1.686 | 12914 | 0.09183 | -0.167 | 0.04167 |
fixed | NA | birth_order_nonlinear>5 | -0.03018 | 0.03045 | -0.9914 | 13881 | 0.3215 | -0.1156 | 0.05528 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2051 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9578 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.345 | 0.1575 | -8.541 | 13635 | 1.476e-17 | -1.787 | -0.9032 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08008 | 0.01501 | 5.333 | 13463 | 0.00000009791 | 0.03793 | 0.1222 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001199 | 0.0004413 | -2.717 | 13210 | 0.006586 | -0.002438 | 0.00003951 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004988 | 0.000004057 | 1.229 | 12991 | 0.219 | -0.000006402 | 0.00001638 |
fixed | NA | male | 0.0447 | 0.0166 | 2.693 | 13872 | 0.007085 | -0.001889 | 0.09129 |
fixed | NA | count_birth_order2/2 | -0.1323 | 0.04729 | -2.798 | 12473 | 0.005147 | -0.2651 | 0.0004197 |
fixed | NA | count_birth_order1/3 | -0.05977 | 0.0442 | -1.352 | 13880 | 0.1763 | -0.1838 | 0.06429 |
fixed | NA | count_birth_order2/3 | -0.05331 | 0.04943 | -1.078 | 13893 | 0.2808 | -0.1921 | 0.08545 |
fixed | NA | count_birth_order3/3 | -0.07588 | 0.05538 | -1.37 | 13904 | 0.1707 | -0.2313 | 0.07959 |
fixed | NA | count_birth_order1/4 | -0.03678 | 0.05048 | -0.7286 | 13895 | 0.4663 | -0.1785 | 0.1049 |
fixed | NA | count_birth_order2/4 | -0.08135 | 0.0531 | -1.532 | 13897 | 0.1255 | -0.2304 | 0.06769 |
fixed | NA | count_birth_order3/4 | -0.0356 | 0.0577 | -0.6169 | 13903 | 0.5373 | -0.1976 | 0.1264 |
fixed | NA | count_birth_order4/4 | -0.1034 | 0.0611 | -1.692 | 13907 | 0.09073 | -0.2749 | 0.06815 |
fixed | NA | count_birth_order1/5 | 0.02975 | 0.0573 | 0.5192 | 13904 | 0.6037 | -0.1311 | 0.1906 |
fixed | NA | count_birth_order2/5 | -0.03593 | 0.06028 | -0.596 | 13908 | 0.5512 | -0.2052 | 0.1333 |
fixed | NA | count_birth_order3/5 | -0.08495 | 0.06188 | -1.373 | 13908 | 0.1698 | -0.2586 | 0.08875 |
fixed | NA | count_birth_order4/5 | -0.04652 | 0.06556 | -0.7095 | 13909 | 0.478 | -0.2305 | 0.1375 |
fixed | NA | count_birth_order5/5 | -0.1564 | 0.06702 | -2.333 | 13910 | 0.01966 | -0.3445 | 0.03176 |
fixed | NA | count_birth_order1/>5 | -0.04653 | 0.04629 | -1.005 | 13908 | 0.3148 | -0.1765 | 0.0834 |
fixed | NA | count_birth_order2/>5 | -0.02981 | 0.04775 | -0.6243 | 13910 | 0.5324 | -0.1639 | 0.1042 |
fixed | NA | count_birth_order3/>5 | -0.05692 | 0.04679 | -1.217 | 13910 | 0.2238 | -0.1883 | 0.07441 |
fixed | NA | count_birth_order4/>5 | 0.01003 | 0.04585 | 0.2187 | 13910 | 0.8269 | -0.1187 | 0.1387 |
fixed | NA | count_birth_order5/>5 | -0.03622 | 0.04619 | -0.7841 | 13910 | 0.433 | -0.1659 | 0.09345 |
fixed | NA | count_birth_order>5/>5 | -0.02832 | 0.0357 | -0.7933 | 12628 | 0.4276 | -0.1285 | 0.0719 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2051 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9577 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 38959 | 39042 | -19468 | 38937 | NA | NA | NA |
12 | 38960 | 39051 | -19468 | 38936 | 0.2064 | 1 | 0.6496 |
16 | 38963 | 39084 | -19466 | 38931 | 5.284 | 4 | 0.2594 |
26 | 38971 | 39167 | -19459 | 38919 | 12.56 | 10 | 0.2493 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8647 | 0.4405 | -1.963 | 5915 | 0.04968 | -2.101 | 0.3717 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01416 | 0.04997 | 0.2834 | 5914 | 0.7769 | -0.1261 | 0.1544 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001255 | 0.001782 | 0.7039 | 5911 | 0.4815 | -0.003749 | 0.006258 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002195 | 0.00002018 | -1.088 | 5904 | 0.2767 | -0.00007859 | 0.00003469 |
fixed | NA | male | 0.05224 | 0.02578 | 2.026 | 5900 | 0.04277 | -0.02012 | 0.1246 |
fixed | NA | sibling_count3 | -0.02611 | 0.03958 | -0.6597 | 4507 | 0.5095 | -0.1372 | 0.085 |
fixed | NA | sibling_count4 | -0.04355 | 0.0424 | -1.027 | 3883 | 0.3044 | -0.1626 | 0.07547 |
fixed | NA | sibling_count5 | -0.01096 | 0.04815 | -0.2276 | 3356 | 0.8199 | -0.1461 | 0.1242 |
fixed | NA | sibling_count>5 | 0.03937 | 0.04215 | 0.9341 | 3021 | 0.3503 | -0.07894 | 0.1577 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2157 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9676 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.85 | 0.4404 | -1.93 | 5914 | 0.05364 | -2.086 | 0.3862 |
fixed | NA | birth_order | -0.01736 | 0.008434 | -2.058 | 5468 | 0.03961 | -0.04104 | 0.006316 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01482 | 0.04995 | 0.2967 | 5913 | 0.7667 | -0.1254 | 0.155 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001262 | 0.001782 | 0.7084 | 5910 | 0.4787 | -0.00374 | 0.006264 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000227 | 0.00002018 | -1.125 | 5903 | 0.2605 | -0.00007934 | 0.00003393 |
fixed | NA | male | 0.05295 | 0.02577 | 2.054 | 5899 | 0.03999 | -0.0194 | 0.1253 |
fixed | NA | sibling_count3 | -0.01776 | 0.03978 | -0.4464 | 4506 | 0.6553 | -0.1294 | 0.09391 |
fixed | NA | sibling_count4 | -0.02394 | 0.04345 | -0.551 | 3873 | 0.5817 | -0.1459 | 0.09802 |
fixed | NA | sibling_count5 | 0.02124 | 0.05063 | 0.4196 | 3407 | 0.6748 | -0.1209 | 0.1634 |
fixed | NA | sibling_count>5 | 0.1041 | 0.0526 | 1.98 | 3526 | 0.04777 | -0.04349 | 0.2518 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2163 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9672 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8407 | 0.4411 | -1.906 | 5910 | 0.05671 | -2.079 | 0.3975 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01289 | 0.04999 | 0.2579 | 5909 | 0.7965 | -0.1274 | 0.1532 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001337 | 0.001783 | 0.7497 | 5905 | 0.4535 | -0.003669 | 0.006343 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002361 | 0.00002019 | -1.169 | 5898 | 0.2424 | -0.0000803 | 0.00003308 |
fixed | NA | male | 0.05276 | 0.02578 | 2.046 | 5895 | 0.04077 | -0.01961 | 0.1251 |
fixed | NA | sibling_count3 | -0.01599 | 0.04069 | -0.393 | 4706 | 0.6943 | -0.1302 | 0.09822 |
fixed | NA | sibling_count4 | -0.01708 | 0.04533 | -0.3768 | 4249 | 0.7064 | -0.1443 | 0.1102 |
fixed | NA | sibling_count5 | 0.02747 | 0.05349 | 0.5135 | 3911 | 0.6076 | -0.1227 | 0.1776 |
fixed | NA | sibling_count>5 | 0.1085 | 0.05435 | 1.997 | 3858 | 0.0459 | -0.04402 | 0.2611 |
fixed | NA | birth_order_nonlinear2 | -0.05026 | 0.03374 | -1.49 | 5060 | 0.1363 | -0.145 | 0.04444 |
fixed | NA | birth_order_nonlinear3 | -0.04458 | 0.04152 | -1.074 | 5325 | 0.283 | -0.1611 | 0.07198 |
fixed | NA | birth_order_nonlinear4 | -0.08636 | 0.05124 | -1.685 | 5489 | 0.09199 | -0.2302 | 0.05748 |
fixed | NA | birth_order_nonlinear5 | -0.08063 | 0.06405 | -1.259 | 5418 | 0.2081 | -0.2604 | 0.09917 |
fixed | NA | birth_order_nonlinear>5 | -0.127 | 0.06351 | -2 | 5876 | 0.04551 | -0.3053 | 0.05123 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2164 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9674 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8614 | 0.4418 | -1.95 | 5900 | 0.05126 | -2.102 | 0.3788 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01798 | 0.05007 | 0.3591 | 5899 | 0.7195 | -0.1226 | 0.1585 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001121 | 0.001787 | 0.6275 | 5896 | 0.5303 | -0.003894 | 0.006136 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002076 | 0.00002023 | -1.026 | 5889 | 0.3049 | -0.00007756 | 0.00003603 |
fixed | NA | male | 0.05421 | 0.02579 | 2.102 | 5884 | 0.03562 | -0.01819 | 0.1266 |
fixed | NA | count_birth_order2/2 | -0.1018 | 0.06088 | -1.672 | 5195 | 0.09458 | -0.2727 | 0.0691 |
fixed | NA | count_birth_order1/3 | -0.004458 | 0.05311 | -0.08395 | 5894 | 0.9331 | -0.1535 | 0.1446 |
fixed | NA | count_birth_order2/3 | -0.1003 | 0.05806 | -1.727 | 5899 | 0.08428 | -0.2632 | 0.06273 |
fixed | NA | count_birth_order3/3 | -0.1107 | 0.06495 | -1.705 | 5900 | 0.08831 | -0.293 | 0.07159 |
fixed | NA | count_birth_order1/4 | -0.05653 | 0.06495 | -0.8703 | 5895 | 0.3842 | -0.2388 | 0.1258 |
fixed | NA | count_birth_order2/4 | -0.05995 | 0.06727 | -0.8911 | 5900 | 0.3729 | -0.2488 | 0.1289 |
fixed | NA | count_birth_order3/4 | -0.02575 | 0.07114 | -0.362 | 5898 | 0.7174 | -0.2255 | 0.174 |
fixed | NA | count_birth_order4/4 | -0.1802 | 0.07397 | -2.437 | 5897 | 0.01485 | -0.3879 | 0.02739 |
fixed | NA | count_birth_order1/5 | -0.09011 | 0.0883 | -1.021 | 5900 | 0.3075 | -0.338 | 0.1577 |
fixed | NA | count_birth_order2/5 | 0.09637 | 0.0946 | 1.019 | 5898 | 0.3084 | -0.1692 | 0.3619 |
fixed | NA | count_birth_order3/5 | 0.02785 | 0.08869 | 0.314 | 5896 | 0.7535 | -0.2211 | 0.2768 |
fixed | NA | count_birth_order4/5 | -0.06482 | 0.08542 | -0.7588 | 5896 | 0.448 | -0.3046 | 0.175 |
fixed | NA | count_birth_order5/5 | -0.1599 | 0.08892 | -1.798 | 5893 | 0.07225 | -0.4095 | 0.08973 |
fixed | NA | count_birth_order1/>5 | 0.03187 | 0.08759 | 0.3638 | 5895 | 0.716 | -0.214 | 0.2777 |
fixed | NA | count_birth_order2/>5 | 0.01605 | 0.08675 | 0.1851 | 5899 | 0.8532 | -0.2275 | 0.2596 |
fixed | NA | count_birth_order3/>5 | -0.03007 | 0.08697 | -0.3458 | 5898 | 0.7295 | -0.2742 | 0.214 |
fixed | NA | count_birth_order4/>5 | 0.06919 | 0.08196 | 0.8442 | 5896 | 0.3986 | -0.1609 | 0.2992 |
fixed | NA | count_birth_order5/>5 | 0.07304 | 0.07745 | 0.943 | 5895 | 0.3457 | -0.1444 | 0.2905 |
fixed | NA | count_birth_order>5/>5 | -0.03498 | 0.05771 | -0.6062 | 5174 | 0.5444 | -0.197 | 0.127 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2171 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.967 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16715 | 16788 | -8346 | 16693 | NA | NA | NA |
12 | 16713 | 16793 | -8344 | 16689 | 4.241 | 1 | 0.03947 |
16 | 16719 | 16826 | -8344 | 16687 | 1.514 | 4 | 0.8241 |
26 | 16726 | 16900 | -8337 | 16674 | 13.11 | 10 | 0.2177 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8294 | 0.439 | -1.889 | 5966 | 0.0589 | -2.062 | 0.4029 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01291 | 0.04982 | 0.259 | 5965 | 0.7956 | -0.1269 | 0.1528 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001314 | 0.001778 | 0.7389 | 5962 | 0.46 | -0.003677 | 0.006304 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002253 | 0.00002013 | -1.12 | 5954 | 0.263 | -0.00007903 | 0.00003397 |
fixed | NA | male | 0.05108 | 0.02567 | 1.99 | 5950 | 0.04666 | -0.02098 | 0.1231 |
fixed | NA | sibling_count3 | -0.06959 | 0.04285 | -1.624 | 4674 | 0.1044 | -0.1899 | 0.05069 |
fixed | NA | sibling_count4 | -0.06697 | 0.04498 | -1.489 | 4208 | 0.1366 | -0.1932 | 0.0593 |
fixed | NA | sibling_count5 | -0.0582 | 0.04789 | -1.215 | 3688 | 0.2243 | -0.1926 | 0.07623 |
fixed | NA | sibling_count>5 | -0.01844 | 0.04201 | -0.4389 | 3738 | 0.6607 | -0.1364 | 0.09949 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2172 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9672 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8205 | 0.4391 | -1.869 | 5965 | 0.06171 | -2.053 | 0.412 |
fixed | NA | birth_order | -0.007815 | 0.007334 | -1.066 | 5112 | 0.2867 | -0.0284 | 0.01277 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01293 | 0.04982 | 0.2596 | 5964 | 0.7952 | -0.1269 | 0.1528 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001327 | 0.001778 | 0.7463 | 5961 | 0.4555 | -0.003664 | 0.006317 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002298 | 0.00002013 | -1.141 | 5954 | 0.2537 | -0.00007949 | 0.00003353 |
fixed | NA | male | 0.05132 | 0.02567 | 1.999 | 5949 | 0.04563 | -0.02074 | 0.1234 |
fixed | NA | sibling_count3 | -0.06585 | 0.04299 | -1.532 | 4668 | 0.1257 | -0.1865 | 0.05483 |
fixed | NA | sibling_count4 | -0.0585 | 0.04568 | -1.281 | 4181 | 0.2004 | -0.1867 | 0.06973 |
fixed | NA | sibling_count5 | -0.04485 | 0.04951 | -0.9058 | 3674 | 0.3651 | -0.1838 | 0.09413 |
fixed | NA | sibling_count>5 | 0.01003 | 0.0498 | 0.2014 | 3993 | 0.8404 | -0.1297 | 0.1498 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2179 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.967 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7972 | 0.4396 | -1.813 | 5961 | 0.06981 | -2.031 | 0.4368 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01086 | 0.04984 | 0.2178 | 5960 | 0.8276 | -0.1291 | 0.1508 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001404 | 0.001779 | 0.7896 | 5956 | 0.4298 | -0.003588 | 0.006397 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002385 | 0.00002015 | -1.184 | 5948 | 0.2365 | -0.0000804 | 0.0000327 |
fixed | NA | male | 0.05093 | 0.02568 | 1.983 | 5945 | 0.04736 | -0.02115 | 0.123 |
fixed | NA | sibling_count3 | -0.05132 | 0.04384 | -1.171 | 4834 | 0.2418 | -0.1744 | 0.07174 |
fixed | NA | sibling_count4 | -0.04716 | 0.04742 | -0.9943 | 4502 | 0.3201 | -0.1803 | 0.08596 |
fixed | NA | sibling_count5 | -0.03619 | 0.0521 | -0.6946 | 4129 | 0.4874 | -0.1824 | 0.1101 |
fixed | NA | sibling_count>5 | 0.01453 | 0.0515 | 0.2822 | 4358 | 0.7778 | -0.13 | 0.1591 |
fixed | NA | birth_order_nonlinear2 | -0.0495 | 0.03432 | -1.442 | 5196 | 0.1493 | -0.1458 | 0.04683 |
fixed | NA | birth_order_nonlinear3 | -0.08248 | 0.04134 | -1.995 | 5451 | 0.04609 | -0.1985 | 0.03357 |
fixed | NA | birth_order_nonlinear4 | -0.02223 | 0.04967 | -0.4476 | 5606 | 0.6545 | -0.1616 | 0.1172 |
fixed | NA | birth_order_nonlinear5 | -0.04183 | 0.06094 | -0.6863 | 5601 | 0.4925 | -0.2129 | 0.1292 |
fixed | NA | birth_order_nonlinear>5 | -0.0672 | 0.05659 | -1.187 | 5850 | 0.2351 | -0.2261 | 0.09166 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2171 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9672 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8331 | 0.4403 | -1.892 | 5951 | 0.05855 | -2.069 | 0.403 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01647 | 0.04991 | 0.3301 | 5950 | 0.7414 | -0.1236 | 0.1566 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001182 | 0.001781 | 0.6636 | 5946 | 0.507 | -0.003818 | 0.006183 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002112 | 0.00002018 | -1.047 | 5938 | 0.2952 | -0.00007777 | 0.00003552 |
fixed | NA | male | 0.0522 | 0.02569 | 2.032 | 5935 | 0.04221 | -0.01992 | 0.1243 |
fixed | NA | count_birth_order2/2 | -0.07531 | 0.06659 | -1.131 | 5310 | 0.2581 | -0.2622 | 0.1116 |
fixed | NA | count_birth_order1/3 | -0.04684 | 0.05752 | -0.8144 | 5946 | 0.4154 | -0.2083 | 0.1146 |
fixed | NA | count_birth_order2/3 | -0.1051 | 0.06241 | -1.683 | 5950 | 0.09236 | -0.2803 | 0.07013 |
fixed | NA | count_birth_order3/3 | -0.1749 | 0.07028 | -2.489 | 5951 | 0.01284 | -0.3722 | 0.02236 |
fixed | NA | count_birth_order1/4 | -0.04383 | 0.06804 | -0.6442 | 5947 | 0.5194 | -0.2348 | 0.1472 |
fixed | NA | count_birth_order2/4 | -0.09198 | 0.06936 | -1.326 | 5950 | 0.1849 | -0.2867 | 0.1027 |
fixed | NA | count_birth_order3/4 | -0.08984 | 0.07619 | -1.179 | 5950 | 0.2384 | -0.3037 | 0.124 |
fixed | NA | count_birth_order4/4 | -0.1675 | 0.07856 | -2.132 | 5949 | 0.03303 | -0.388 | 0.05301 |
fixed | NA | count_birth_order1/5 | -0.03052 | 0.08079 | -0.3778 | 5950 | 0.7056 | -0.2573 | 0.1962 |
fixed | NA | count_birth_order2/5 | -0.122 | 0.08684 | -1.404 | 5951 | 0.1602 | -0.3657 | 0.1218 |
fixed | NA | count_birth_order3/5 | -0.09178 | 0.08447 | -1.087 | 5949 | 0.2773 | -0.3289 | 0.1453 |
fixed | NA | count_birth_order4/5 | 0.002615 | 0.08758 | 0.02985 | 5945 | 0.9762 | -0.2432 | 0.2485 |
fixed | NA | count_birth_order5/5 | -0.1843 | 0.08783 | -2.098 | 5944 | 0.03592 | -0.4308 | 0.06225 |
fixed | NA | count_birth_order1/>5 | -0.07646 | 0.07677 | -0.9959 | 5945 | 0.3193 | -0.292 | 0.139 |
fixed | NA | count_birth_order2/>5 | -0.0221 | 0.08027 | -0.2753 | 5951 | 0.7831 | -0.2474 | 0.2032 |
fixed | NA | count_birth_order3/>5 | -0.1136 | 0.07879 | -1.442 | 5950 | 0.1494 | -0.3348 | 0.1075 |
fixed | NA | count_birth_order4/>5 | 0.01616 | 0.07584 | 0.2131 | 5948 | 0.8313 | -0.1967 | 0.2291 |
fixed | NA | count_birth_order5/>5 | 0.03516 | 0.07798 | 0.4509 | 5942 | 0.6521 | -0.1837 | 0.2541 |
fixed | NA | count_birth_order>5/>5 | -0.06057 | 0.05661 | -1.07 | 5357 | 0.2847 | -0.2195 | 0.09833 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2173 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9672 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16858 | 16931 | -8418 | 16836 | NA | NA | NA |
12 | 16859 | 16939 | -8417 | 16835 | 1.136 | 1 | 0.2865 |
16 | 16863 | 16970 | -8415 | 16831 | 3.922 | 4 | 0.4166 |
26 | 16873 | 17047 | -8411 | 16821 | 9.357 | 10 | 0.4986 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7476 | 0.4452 | -1.679 | 5796 | 0.09314 | -1.997 | 0.502 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.003025 | 0.05052 | 0.05987 | 5795 | 0.9523 | -0.1388 | 0.1448 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001617 | 0.001803 | 0.8969 | 5791 | 0.3698 | -0.003444 | 0.006678 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002573 | 0.00002042 | -1.26 | 5782 | 0.2077 | -0.00008305 | 0.00003159 |
fixed | NA | male | 0.05245 | 0.02602 | 2.016 | 5782 | 0.04386 | -0.02059 | 0.1255 |
fixed | NA | sibling_count3 | -0.06345 | 0.03902 | -1.626 | 4365 | 0.104 | -0.173 | 0.04609 |
fixed | NA | sibling_count4 | -0.05627 | 0.04207 | -1.338 | 3764 | 0.1811 | -0.1744 | 0.06182 |
fixed | NA | sibling_count5 | 0.01114 | 0.04923 | 0.2263 | 3116 | 0.821 | -0.127 | 0.1493 |
fixed | NA | sibling_count>5 | 0.04261 | 0.04251 | 1.002 | 2805 | 0.3162 | -0.07671 | 0.1619 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.215 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9666 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7362 | 0.4451 | -1.654 | 5795 | 0.09818 | -1.986 | 0.5132 |
fixed | NA | birth_order | -0.0169 | 0.008689 | -1.945 | 5418 | 0.05178 | -0.04129 | 0.007487 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.003965 | 0.05051 | 0.07849 | 5794 | 0.9374 | -0.1378 | 0.1458 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001616 | 0.001802 | 0.8963 | 5790 | 0.3701 | -0.003444 | 0.006675 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002637 | 0.00002042 | -1.292 | 5782 | 0.1965 | -0.00008369 | 0.00003094 |
fixed | NA | male | 0.05286 | 0.02601 | 2.032 | 5781 | 0.0422 | -0.02016 | 0.1259 |
fixed | NA | sibling_count3 | -0.0553 | 0.03924 | -1.409 | 4361 | 0.1588 | -0.1654 | 0.05484 |
fixed | NA | sibling_count4 | -0.03742 | 0.04316 | -0.8669 | 3763 | 0.386 | -0.1586 | 0.08374 |
fixed | NA | sibling_count5 | 0.04108 | 0.05157 | 0.7966 | 3169 | 0.4257 | -0.1037 | 0.1858 |
fixed | NA | sibling_count>5 | 0.1052 | 0.05331 | 1.974 | 3411 | 0.04849 | -0.04442 | 0.2549 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2149 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9664 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7235 | 0.4458 | -1.623 | 5791 | 0.1047 | -1.975 | 0.5279 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001757 | 0.05055 | 0.03477 | 5789 | 0.9723 | -0.1401 | 0.1436 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001695 | 0.001804 | 0.9395 | 5785 | 0.3475 | -0.003369 | 0.006758 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002722 | 0.00002044 | -1.332 | 5777 | 0.1829 | -0.00008459 | 0.00003014 |
fixed | NA | male | 0.05268 | 0.02603 | 2.024 | 5776 | 0.04299 | -0.02037 | 0.1257 |
fixed | NA | sibling_count3 | -0.05402 | 0.04017 | -1.345 | 4568 | 0.1787 | -0.1668 | 0.05873 |
fixed | NA | sibling_count4 | -0.03311 | 0.04509 | -0.7342 | 4144 | 0.4629 | -0.1597 | 0.09347 |
fixed | NA | sibling_count5 | 0.04809 | 0.05423 | 0.8869 | 3618 | 0.3752 | -0.1041 | 0.2003 |
fixed | NA | sibling_count>5 | 0.1025 | 0.05516 | 1.858 | 3761 | 0.06325 | -0.05235 | 0.2573 |
fixed | NA | birth_order_nonlinear2 | -0.04874 | 0.03365 | -1.449 | 4934 | 0.1475 | -0.1432 | 0.04571 |
fixed | NA | birth_order_nonlinear3 | -0.0439 | 0.04152 | -1.057 | 5175 | 0.2905 | -0.1605 | 0.07266 |
fixed | NA | birth_order_nonlinear4 | -0.07397 | 0.05271 | -1.403 | 5357 | 0.1606 | -0.2219 | 0.074 |
fixed | NA | birth_order_nonlinear5 | -0.09912 | 0.06679 | -1.484 | 5305 | 0.1379 | -0.2866 | 0.08836 |
fixed | NA | birth_order_nonlinear>5 | -0.1016 | 0.06554 | -1.55 | 5773 | 0.1211 | -0.2856 | 0.08236 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2148 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9667 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7227 | 0.4465 | -1.619 | 5781 | 0.1056 | -1.976 | 0.5305 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.004249 | 0.05062 | 0.08394 | 5780 | 0.9331 | -0.1378 | 0.1463 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001573 | 0.001807 | 0.8707 | 5775 | 0.384 | -0.003498 | 0.006645 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002548 | 0.00002047 | -1.244 | 5766 | 0.2134 | -0.00008294 | 0.00003199 |
fixed | NA | male | 0.0537 | 0.02603 | 2.063 | 5765 | 0.03913 | -0.01936 | 0.1268 |
fixed | NA | count_birth_order2/2 | -0.09551 | 0.05926 | -1.612 | 5042 | 0.1071 | -0.2618 | 0.07083 |
fixed | NA | count_birth_order1/3 | -0.0317 | 0.05239 | -0.6052 | 5774 | 0.5451 | -0.1788 | 0.1154 |
fixed | NA | count_birth_order2/3 | -0.1419 | 0.05797 | -2.447 | 5780 | 0.01442 | -0.3046 | 0.02086 |
fixed | NA | count_birth_order3/3 | -0.1565 | 0.06373 | -2.456 | 5780 | 0.01408 | -0.3354 | 0.02237 |
fixed | NA | count_birth_order1/4 | -0.1047 | 0.0652 | -1.606 | 5777 | 0.1083 | -0.2877 | 0.0783 |
fixed | NA | count_birth_order2/4 | -0.03028 | 0.0671 | -0.4513 | 5781 | 0.6518 | -0.2186 | 0.1581 |
fixed | NA | count_birth_order3/4 | -0.01813 | 0.07034 | -0.2577 | 5778 | 0.7966 | -0.2156 | 0.1793 |
fixed | NA | count_birth_order4/4 | -0.2182 | 0.07436 | -2.935 | 5777 | 0.003354 | -0.4269 | -0.00948 |
fixed | NA | count_birth_order1/5 | -0.08435 | 0.08798 | -0.9588 | 5780 | 0.3377 | -0.3313 | 0.1626 |
fixed | NA | count_birth_order2/5 | 0.0693 | 0.09733 | 0.712 | 5779 | 0.4765 | -0.2039 | 0.3425 |
fixed | NA | count_birth_order3/5 | 0.05283 | 0.09288 | 0.5688 | 5777 | 0.5695 | -0.2079 | 0.3135 |
fixed | NA | count_birth_order4/5 | -0.0298 | 0.08948 | -0.333 | 5777 | 0.7391 | -0.281 | 0.2214 |
fixed | NA | count_birth_order5/5 | -0.08705 | 0.09509 | -0.9154 | 5774 | 0.36 | -0.354 | 0.1799 |
fixed | NA | count_birth_order1/>5 | 0.07337 | 0.08958 | 0.8191 | 5779 | 0.4128 | -0.1781 | 0.3248 |
fixed | NA | count_birth_order2/>5 | -0.01039 | 0.08886 | -0.1169 | 5780 | 0.9069 | -0.2598 | 0.239 |
fixed | NA | count_birth_order3/>5 | -0.04537 | 0.08811 | -0.515 | 5778 | 0.6066 | -0.2927 | 0.2019 |
fixed | NA | count_birth_order4/>5 | 0.1355 | 0.08621 | 1.571 | 5775 | 0.1161 | -0.1065 | 0.3775 |
fixed | NA | count_birth_order5/>5 | 0.0005431 | 0.07922 | 0.006856 | 5775 | 0.9945 | -0.2218 | 0.2229 |
fixed | NA | count_birth_order>5/>5 | -0.01412 | 0.05865 | -0.2408 | 4974 | 0.8097 | -0.1788 | 0.1505 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2155 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9659 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16366 | 16440 | -8172 | 16344 | NA | NA | NA |
12 | 16364 | 16444 | -8170 | 16340 | 3.79 | 1 | 0.05156 |
16 | 16372 | 16478 | -8170 | 16340 | 0.7968 | 4 | 0.9389 |
26 | 16375 | 16548 | -8161 | 16323 | 16.83 | 10 | 0.07811 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = big5_agree)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5625 | 0.1596 | -3.524 | 13676 | 0.0004259 | -1.011 | -0.1145 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0273 | 0.01529 | 1.786 | 13553 | 0.07411 | -0.01561 | 0.07021 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002583 | 0.0004491 | -0.5752 | 13371 | 0.5652 | -0.001519 | 0.001002 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008022 | 0.000004131 | -0.1942 | 13199 | 0.846 | -0.0000124 | 0.00001079 |
fixed | NA | male | 0.06076 | 0.0169 | 3.596 | 13854 | 0.0003241 | 0.01333 | 0.1082 |
fixed | NA | sibling_count3 | -0.02089 | 0.03345 | -0.6245 | 10670 | 0.5323 | -0.1148 | 0.07301 |
fixed | NA | sibling_count4 | 0.03056 | 0.03436 | 0.8896 | 9679 | 0.3737 | -0.06588 | 0.127 |
fixed | NA | sibling_count5 | 0.007767 | 0.03558 | 0.2183 | 8553 | 0.8272 | -0.0921 | 0.1076 |
fixed | NA | sibling_count>5 | 0.005771 | 0.02805 | 0.2058 | 9766 | 0.837 | -0.07295 | 0.0845 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2511 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9667 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5602 | 0.1596 | -3.509 | 13678 | 0.0004505 | -1.008 | -0.1121 |
fixed | NA | birth_order | 0.004807 | 0.003507 | 1.371 | 11206 | 0.1704 | -0.005036 | 0.01465 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02588 | 0.01532 | 1.689 | 13536 | 0.09117 | -0.01712 | 0.06888 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002084 | 0.0004506 | -0.4624 | 13310 | 0.6438 | -0.001473 | 0.001056 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001256 | 0.000004144 | -0.303 | 13116 | 0.7619 | -0.00001289 | 0.00001038 |
fixed | NA | male | 0.06062 | 0.0169 | 3.588 | 13853 | 0.0003345 | 0.01319 | 0.108 |
fixed | NA | sibling_count3 | -0.0221 | 0.03346 | -0.6604 | 10683 | 0.509 | -0.116 | 0.07183 |
fixed | NA | sibling_count4 | 0.02712 | 0.03445 | 0.7873 | 9736 | 0.4311 | -0.06957 | 0.1238 |
fixed | NA | sibling_count5 | 0.001865 | 0.03584 | 0.05204 | 8652 | 0.9585 | -0.09873 | 0.1025 |
fixed | NA | sibling_count>5 | -0.01264 | 0.03109 | -0.4065 | 10700 | 0.6844 | -0.09992 | 0.07464 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.251 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9667 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5594 | 0.1601 | -3.495 | 13681 | 0.0004758 | -1.009 | -0.1101 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02613 | 0.01533 | 1.705 | 13547 | 0.0882 | -0.01689 | 0.06916 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002155 | 0.0004507 | -0.4782 | 13321 | 0.6325 | -0.001481 | 0.00105 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001198 | 0.000004146 | -0.2889 | 13117 | 0.7727 | -0.00001283 | 0.00001044 |
fixed | NA | male | 0.0607 | 0.0169 | 3.592 | 13849 | 0.0003293 | 0.01326 | 0.1081 |
fixed | NA | sibling_count3 | -0.01916 | 0.03398 | -0.5638 | 11024 | 0.5729 | -0.1145 | 0.07623 |
fixed | NA | sibling_count4 | 0.02892 | 0.03552 | 0.814 | 10472 | 0.4156 | -0.07079 | 0.1286 |
fixed | NA | sibling_count5 | 0.007183 | 0.03737 | 0.1922 | 9652 | 0.8476 | -0.09771 | 0.1121 |
fixed | NA | sibling_count>5 | -0.01117 | 0.03282 | -0.3404 | 11853 | 0.7335 | -0.1033 | 0.08095 |
fixed | NA | birth_order_nonlinear2 | 0.008944 | 0.0247 | 0.3622 | 12790 | 0.7172 | -0.06038 | 0.07827 |
fixed | NA | birth_order_nonlinear3 | -0.002557 | 0.02915 | -0.08772 | 12675 | 0.9301 | -0.08439 | 0.07928 |
fixed | NA | birth_order_nonlinear4 | 0.02067 | 0.0332 | 0.6226 | 12782 | 0.5336 | -0.07252 | 0.1139 |
fixed | NA | birth_order_nonlinear5 | -0.001727 | 0.03775 | -0.04573 | 12862 | 0.9635 | -0.1077 | 0.1042 |
fixed | NA | birth_order_nonlinear>5 | 0.04206 | 0.03104 | 1.355 | 13911 | 0.1753 | -0.04506 | 0.1292 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.251 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9668 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5441 | 0.1607 | -3.384 | 13685 | 0.0007151 | -0.9953 | -0.09283 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0261 | 0.01533 | 1.703 | 13541 | 0.08864 | -0.01693 | 0.06913 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002053 | 0.0004508 | -0.4555 | 13310 | 0.6487 | -0.001471 | 0.00106 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001373 | 0.000004146 | -0.331 | 13098 | 0.7406 | -0.00001301 | 0.00001027 |
fixed | NA | male | 0.06108 | 0.0169 | 3.615 | 13836 | 0.0003019 | 0.01365 | 0.1085 |
fixed | NA | count_birth_order2/2 | -0.03887 | 0.048 | -0.8099 | 12577 | 0.418 | -0.1736 | 0.09586 |
fixed | NA | count_birth_order1/3 | -0.02833 | 0.04506 | -0.6288 | 13856 | 0.5295 | -0.1548 | 0.09816 |
fixed | NA | count_birth_order2/3 | 0.003943 | 0.05039 | 0.07825 | 13880 | 0.9376 | -0.1375 | 0.1454 |
fixed | NA | count_birth_order3/3 | -0.1023 | 0.05645 | -1.812 | 13899 | 0.07 | -0.2607 | 0.05616 |
fixed | NA | count_birth_order1/4 | 0.0002992 | 0.05146 | 0.005815 | 13883 | 0.9954 | -0.1442 | 0.1447 |
fixed | NA | count_birth_order2/4 | 0.0164 | 0.05412 | 0.3031 | 13889 | 0.7618 | -0.1355 | 0.1683 |
fixed | NA | count_birth_order3/4 | -0.02745 | 0.05881 | -0.4668 | 13900 | 0.6406 | -0.1925 | 0.1376 |
fixed | NA | count_birth_order4/4 | 0.09601 | 0.06227 | 1.542 | 13907 | 0.1231 | -0.07878 | 0.2708 |
fixed | NA | count_birth_order1/5 | 0.03871 | 0.0584 | 0.6629 | 13900 | 0.5074 | -0.1252 | 0.2026 |
fixed | NA | count_birth_order2/5 | -0.03562 | 0.06143 | -0.5797 | 13907 | 0.5621 | -0.2081 | 0.1368 |
fixed | NA | count_birth_order3/5 | -0.03819 | 0.06306 | -0.6057 | 13908 | 0.5448 | -0.2152 | 0.1388 |
fixed | NA | count_birth_order4/5 | -0.01414 | 0.0668 | -0.2117 | 13910 | 0.8323 | -0.2017 | 0.1734 |
fixed | NA | count_birth_order5/5 | 0.01126 | 0.06829 | 0.1649 | 13910 | 0.869 | -0.1804 | 0.203 |
fixed | NA | count_birth_order1/>5 | -0.08303 | 0.04717 | -1.76 | 13908 | 0.07837 | -0.2154 | 0.04937 |
fixed | NA | count_birth_order2/>5 | -0.001421 | 0.04866 | -0.02921 | 13910 | 0.9767 | -0.138 | 0.1352 |
fixed | NA | count_birth_order3/>5 | 0.03321 | 0.04767 | 0.6967 | 13910 | 0.486 | -0.1006 | 0.167 |
fixed | NA | count_birth_order4/>5 | -0.02795 | 0.04671 | -0.5984 | 13910 | 0.5496 | -0.1591 | 0.1032 |
fixed | NA | count_birth_order5/>5 | -0.03953 | 0.04706 | -0.8398 | 13909 | 0.401 | -0.1716 | 0.09258 |
fixed | NA | count_birth_order>5/>5 | 0.0126 | 0.03651 | 0.3452 | 12680 | 0.73 | -0.08988 | 0.1151 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2528 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9662 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 39479 | 39562 | -19728 | 39457 | NA | NA | NA |
12 | 39479 | 39569 | -19727 | 39455 | 1.881 | 1 | 0.1702 |
16 | 39486 | 39607 | -19727 | 39454 | 0.9485 | 4 | 0.9175 |
26 | 39492 | 39688 | -19720 | 39440 | 13.71 | 10 | 0.1865 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.645 | 0.4388 | -1.47 | 5911 | 0.1416 | -1.877 | 0.5867 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03354 | 0.04978 | 0.6737 | 5914 | 0.5005 | -0.1062 | 0.1733 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003367 | 0.001776 | -0.1896 | 5915 | 0.8496 | -0.005323 | 0.004649 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000005582 | 0.00002011 | -0.02776 | 5914 | 0.9779 | -0.00005701 | 0.00005589 |
fixed | NA | male | 0.05795 | 0.02567 | 2.258 | 5886 | 0.024 | -0.0141 | 0.13 |
fixed | NA | sibling_count3 | -0.04282 | 0.03968 | -1.079 | 4538 | 0.2805 | -0.1542 | 0.06856 |
fixed | NA | sibling_count4 | -0.05145 | 0.04258 | -1.208 | 3962 | 0.227 | -0.171 | 0.06806 |
fixed | NA | sibling_count5 | 0.007037 | 0.04843 | 0.1453 | 3482 | 0.8845 | -0.1289 | 0.143 |
fixed | NA | sibling_count>5 | -0.05468 | 0.04243 | -1.288 | 3192 | 0.1977 | -0.1738 | 0.06444 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2632 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9527 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6472 | 0.4389 | -1.475 | 5910 | 0.1404 | -1.879 | 0.5847 |
fixed | NA | birth_order | 0.002615 | 0.00843 | 0.3102 | 5637 | 0.7564 | -0.02105 | 0.02628 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03343 | 0.04979 | 0.6715 | 5913 | 0.5019 | -0.1063 | 0.1732 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003375 | 0.001776 | -0.19 | 5914 | 0.8493 | -0.005324 | 0.004649 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000004477 | 0.00002011 | -0.02226 | 5913 | 0.9822 | -0.00005691 | 0.00005601 |
fixed | NA | male | 0.05784 | 0.02567 | 2.253 | 5885 | 0.02429 | -0.01422 | 0.1299 |
fixed | NA | sibling_count3 | -0.04408 | 0.03989 | -1.105 | 4540 | 0.2692 | -0.1561 | 0.06789 |
fixed | NA | sibling_count4 | -0.05442 | 0.04364 | -1.247 | 3959 | 0.2125 | -0.1769 | 0.06809 |
fixed | NA | sibling_count5 | 0.002162 | 0.05092 | 0.04246 | 3544 | 0.9661 | -0.1408 | 0.1451 |
fixed | NA | sibling_count>5 | -0.06446 | 0.05288 | -1.219 | 3698 | 0.2229 | -0.2129 | 0.08397 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2632 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9528 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6237 | 0.4395 | -1.419 | 5907 | 0.1559 | -1.857 | 0.6101 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03241 | 0.04982 | 0.6507 | 5909 | 0.5153 | -0.1074 | 0.1722 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002935 | 0.001777 | -0.1651 | 5910 | 0.8689 | -0.005283 | 0.004696 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001054 | 0.00002013 | -0.05235 | 5909 | 0.9583 | -0.00005756 | 0.00005545 |
fixed | NA | male | 0.05752 | 0.02568 | 2.24 | 5880 | 0.02512 | -0.01455 | 0.1296 |
fixed | NA | sibling_count3 | -0.03331 | 0.04077 | -0.8171 | 4729 | 0.4139 | -0.1477 | 0.08112 |
fixed | NA | sibling_count4 | -0.05023 | 0.04547 | -1.105 | 4313 | 0.2693 | -0.1779 | 0.0774 |
fixed | NA | sibling_count5 | -0.003593 | 0.05371 | -0.06689 | 4020 | 0.9467 | -0.1543 | 0.1472 |
fixed | NA | sibling_count>5 | -0.05582 | 0.05457 | -1.023 | 4005 | 0.3064 | -0.209 | 0.09736 |
fixed | NA | birth_order_nonlinear2 | -0.03669 | 0.03347 | -1.096 | 5072 | 0.2731 | -0.1306 | 0.05727 |
fixed | NA | birth_order_nonlinear3 | -0.04412 | 0.04123 | -1.07 | 5315 | 0.2846 | -0.1599 | 0.07161 |
fixed | NA | birth_order_nonlinear4 | 0.02951 | 0.05091 | 0.5796 | 5468 | 0.5622 | -0.1134 | 0.1724 |
fixed | NA | birth_order_nonlinear5 | 0.03323 | 0.06362 | 0.5224 | 5383 | 0.6014 | -0.1453 | 0.2118 |
fixed | NA | birth_order_nonlinear>5 | -0.03071 | 0.06333 | -0.485 | 5903 | 0.6277 | -0.2085 | 0.147 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.263 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9529 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6322 | 0.4405 | -1.435 | 5898 | 0.1513 | -1.869 | 0.6043 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03344 | 0.04993 | 0.6699 | 5899 | 0.503 | -0.1067 | 0.1736 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003295 | 0.001782 | -0.1849 | 5900 | 0.8533 | -0.005331 | 0.004672 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006666 | 0.00002018 | -0.03303 | 5899 | 0.9737 | -0.00005732 | 0.00005598 |
fixed | NA | male | 0.05848 | 0.0257 | 2.276 | 5870 | 0.02291 | -0.01366 | 0.1306 |
fixed | NA | count_birth_order2/2 | -0.03959 | 0.06047 | -0.6547 | 5235 | 0.5127 | -0.2093 | 0.1302 |
fixed | NA | count_birth_order1/3 | -0.02909 | 0.05298 | -0.5491 | 5890 | 0.5829 | -0.1778 | 0.1196 |
fixed | NA | count_birth_order2/3 | -0.05869 | 0.05791 | -1.014 | 5898 | 0.3108 | -0.2212 | 0.1038 |
fixed | NA | count_birth_order3/3 | -0.1059 | 0.06475 | -1.636 | 5900 | 0.102 | -0.2877 | 0.07586 |
fixed | NA | count_birth_order1/4 | -0.06212 | 0.06478 | -0.9589 | 5893 | 0.3377 | -0.244 | 0.1197 |
fixed | NA | count_birth_order2/4 | -0.1076 | 0.06708 | -1.603 | 5900 | 0.1089 | -0.2959 | 0.08075 |
fixed | NA | count_birth_order3/4 | -0.0601 | 0.07093 | -0.8474 | 5898 | 0.3968 | -0.2592 | 0.139 |
fixed | NA | count_birth_order4/4 | -0.0189 | 0.07374 | -0.2563 | 5897 | 0.7978 | -0.2259 | 0.1881 |
fixed | NA | count_birth_order1/5 | 0.04298 | 0.08804 | 0.4882 | 5900 | 0.6255 | -0.2042 | 0.2901 |
fixed | NA | count_birth_order2/5 | -0.101 | 0.09431 | -1.071 | 5895 | 0.2844 | -0.3657 | 0.1638 |
fixed | NA | count_birth_order3/5 | -0.02089 | 0.08841 | -0.2363 | 5893 | 0.8132 | -0.269 | 0.2273 |
fixed | NA | count_birth_order4/5 | -0.05274 | 0.08515 | -0.6193 | 5895 | 0.5357 | -0.2918 | 0.1863 |
fixed | NA | count_birth_order5/5 | 0.08936 | 0.08862 | 1.008 | 5890 | 0.3134 | -0.1594 | 0.3381 |
fixed | NA | count_birth_order1/>5 | -0.1027 | 0.08735 | -1.176 | 5900 | 0.2398 | -0.3479 | 0.1425 |
fixed | NA | count_birth_order2/>5 | -0.0403 | 0.08651 | -0.4659 | 5900 | 0.6413 | -0.2831 | 0.2025 |
fixed | NA | count_birth_order3/>5 | -0.1274 | 0.08669 | -1.47 | 5892 | 0.1417 | -0.3707 | 0.1159 |
fixed | NA | count_birth_order4/>5 | 0.03782 | 0.08169 | 0.463 | 5889 | 0.6434 | -0.1915 | 0.2671 |
fixed | NA | count_birth_order5/>5 | -0.0659 | 0.0772 | -0.8536 | 5888 | 0.3934 | -0.2826 | 0.1508 |
fixed | NA | count_birth_order>5/>5 | -0.08752 | 0.05776 | -1.515 | 5299 | 0.1298 | -0.2497 | 0.07461 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2633 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9531 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16672 | 16745 | -8325 | 16650 | NA | NA | NA |
12 | 16673 | 16754 | -8325 | 16649 | 0.09659 | 1 | 0.756 |
16 | 16677 | 16784 | -8323 | 16645 | 3.955 | 4 | 0.4121 |
26 | 16692 | 16866 | -8320 | 16640 | 5.719 | 10 | 0.8383 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6188 | 0.4369 | -1.416 | 5962 | 0.1568 | -1.845 | 0.6077 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03119 | 0.04959 | 0.629 | 5965 | 0.5294 | -0.108 | 0.1704 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002451 | 0.00177 | -0.1385 | 5966 | 0.8899 | -0.005213 | 0.004723 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001585 | 0.00002004 | -0.07908 | 5965 | 0.937 | -0.00005784 | 0.00005467 |
fixed | NA | male | 0.05768 | 0.02554 | 2.259 | 5937 | 0.02392 | -0.014 | 0.1294 |
fixed | NA | sibling_count3 | -0.05156 | 0.04288 | -1.202 | 4705 | 0.2292 | -0.1719 | 0.0688 |
fixed | NA | sibling_count4 | -0.02386 | 0.04507 | -0.5294 | 4273 | 0.5965 | -0.1504 | 0.1026 |
fixed | NA | sibling_count5 | -0.03461 | 0.04805 | -0.7203 | 3794 | 0.4714 | -0.1695 | 0.1003 |
fixed | NA | sibling_count>5 | -0.0736 | 0.04215 | -1.746 | 3867 | 0.08084 | -0.1919 | 0.04471 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2616 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.952 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6268 | 0.437 | -1.434 | 5961 | 0.1515 | -1.853 | 0.5998 |
fixed | NA | birth_order | 0.007124 | 0.007328 | 0.9722 | 5363 | 0.331 | -0.01345 | 0.02769 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03115 | 0.04959 | 0.6282 | 5964 | 0.5299 | -0.1081 | 0.1704 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002563 | 0.00177 | -0.1448 | 5965 | 0.8849 | -0.005224 | 0.004712 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001183 | 0.00002005 | -0.05902 | 5964 | 0.9529 | -0.00005745 | 0.00005508 |
fixed | NA | male | 0.05745 | 0.02554 | 2.249 | 5936 | 0.02452 | -0.01424 | 0.1291 |
fixed | NA | sibling_count3 | -0.05498 | 0.04302 | -1.278 | 4700 | 0.2013 | -0.1757 | 0.06579 |
fixed | NA | sibling_count4 | -0.03161 | 0.04577 | -0.6907 | 4250 | 0.4898 | -0.1601 | 0.09686 |
fixed | NA | sibling_count5 | -0.04685 | 0.04967 | -0.9433 | 3789 | 0.3456 | -0.1863 | 0.09257 |
fixed | NA | sibling_count>5 | -0.0996 | 0.04991 | -1.995 | 4129 | 0.04606 | -0.2397 | 0.04051 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2614 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9521 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6006 | 0.4376 | -1.373 | 5959 | 0.1699 | -1.829 | 0.6277 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03018 | 0.04962 | 0.6083 | 5960 | 0.543 | -0.1091 | 0.1695 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002201 | 0.001771 | -0.1243 | 5961 | 0.9011 | -0.005192 | 0.004751 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001571 | 0.00002006 | -0.07831 | 5960 | 0.9376 | -0.00005789 | 0.00005474 |
fixed | NA | male | 0.05734 | 0.02555 | 2.244 | 5932 | 0.02485 | -0.01438 | 0.1291 |
fixed | NA | sibling_count3 | -0.04586 | 0.04386 | -1.046 | 4857 | 0.2958 | -0.169 | 0.07725 |
fixed | NA | sibling_count4 | -0.0244 | 0.04748 | -0.5138 | 4553 | 0.6074 | -0.1577 | 0.1089 |
fixed | NA | sibling_count5 | -0.04551 | 0.05221 | -0.8717 | 4217 | 0.3834 | -0.1921 | 0.101 |
fixed | NA | sibling_count>5 | -0.1009 | 0.05158 | -1.957 | 4460 | 0.05039 | -0.2457 | 0.04383 |
fixed | NA | birth_order_nonlinear2 | -0.02657 | 0.03404 | -0.7807 | 5209 | 0.435 | -0.1221 | 0.06897 |
fixed | NA | birth_order_nonlinear3 | -0.02837 | 0.04103 | -0.6913 | 5442 | 0.4894 | -0.1435 | 0.08681 |
fixed | NA | birth_order_nonlinear4 | 0.01991 | 0.04932 | 0.4036 | 5589 | 0.6865 | -0.1185 | 0.1583 |
fixed | NA | birth_order_nonlinear5 | 0.04047 | 0.06051 | 0.6688 | 5572 | 0.5036 | -0.1294 | 0.2103 |
fixed | NA | birth_order_nonlinear>5 | 0.04104 | 0.05641 | 0.7276 | 5905 | 0.4669 | -0.1173 | 0.1994 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2608 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9524 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.6018 | 0.4385 | -1.372 | 5949 | 0.1701 | -1.833 | 0.6293 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.03204 | 0.04971 | 0.6445 | 5950 | 0.5193 | -0.1075 | 0.1716 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002896 | 0.001775 | -0.1632 | 5951 | 0.8704 | -0.005271 | 0.004692 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000007273 | 0.0000201 | -0.03618 | 5949 | 0.9711 | -0.00005716 | 0.00005571 |
fixed | NA | male | 0.05762 | 0.02557 | 2.253 | 5922 | 0.0243 | -0.01417 | 0.1294 |
fixed | NA | count_birth_order2/2 | -0.07001 | 0.0661 | -1.059 | 5348 | 0.2896 | -0.2556 | 0.1155 |
fixed | NA | count_birth_order1/3 | -0.05588 | 0.05731 | -0.9752 | 5941 | 0.3295 | -0.2167 | 0.105 |
fixed | NA | count_birth_order2/3 | -0.06772 | 0.06217 | -1.089 | 5949 | 0.2761 | -0.2422 | 0.1068 |
fixed | NA | count_birth_order3/3 | -0.127 | 0.07 | -1.814 | 5951 | 0.06968 | -0.3235 | 0.06949 |
fixed | NA | count_birth_order1/4 | -0.05227 | 0.06778 | -0.7711 | 5945 | 0.4407 | -0.2425 | 0.138 |
fixed | NA | count_birth_order2/4 | -0.04976 | 0.06909 | -0.7201 | 5950 | 0.4715 | -0.2437 | 0.1442 |
fixed | NA | count_birth_order3/4 | -0.07543 | 0.07588 | -0.9941 | 5949 | 0.3202 | -0.2884 | 0.1376 |
fixed | NA | count_birth_order4/4 | -0.01413 | 0.07823 | -0.1806 | 5949 | 0.8567 | -0.2337 | 0.2055 |
fixed | NA | count_birth_order1/5 | -0.03582 | 0.08047 | -0.4451 | 5950 | 0.6562 | -0.2617 | 0.1901 |
fixed | NA | count_birth_order2/5 | -0.1593 | 0.08648 | -1.842 | 5949 | 0.06554 | -0.402 | 0.08347 |
fixed | NA | count_birth_order3/5 | -0.03115 | 0.08411 | -0.3704 | 5948 | 0.7111 | -0.2673 | 0.205 |
fixed | NA | count_birth_order4/5 | -0.06292 | 0.0872 | -0.7215 | 5943 | 0.4706 | -0.3077 | 0.1819 |
fixed | NA | count_birth_order5/5 | -0.0179 | 0.08745 | -0.2047 | 5941 | 0.8378 | -0.2634 | 0.2276 |
fixed | NA | count_birth_order1/>5 | -0.1703 | 0.07649 | -2.227 | 5948 | 0.02598 | -0.385 | 0.04436 |
fixed | NA | count_birth_order2/>5 | -0.1037 | 0.07995 | -1.297 | 5951 | 0.1948 | -0.3281 | 0.1208 |
fixed | NA | count_birth_order3/>5 | -0.1335 | 0.07845 | -1.701 | 5947 | 0.08891 | -0.3537 | 0.08674 |
fixed | NA | count_birth_order4/>5 | -0.08556 | 0.07552 | -1.133 | 5945 | 0.2573 | -0.2975 | 0.1264 |
fixed | NA | count_birth_order5/>5 | -0.07678 | 0.07763 | -0.989 | 5935 | 0.3227 | -0.2947 | 0.1411 |
fixed | NA | count_birth_order>5/>5 | -0.07471 | 0.05656 | -1.321 | 5447 | 0.1866 | -0.2335 | 0.08405 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2602 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9531 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16802 | 16876 | -8390 | 16780 | NA | NA | NA |
12 | 16803 | 16884 | -8390 | 16779 | 0.9475 | 1 | 0.3304 |
16 | 16810 | 16917 | -8389 | 16778 | 1.889 | 4 | 0.7562 |
26 | 16825 | 17000 | -8387 | 16773 | 4.132 | 10 | 0.9412 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5969 | 0.4431 | -1.347 | 5793 | 0.178 | -1.841 | 0.647 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02716 | 0.0503 | 0.5399 | 5795 | 0.5893 | -0.114 | 0.1683 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00008155 | 0.001795 | -0.04543 | 5796 | 0.9638 | -0.00512 | 0.004957 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003671 | 0.00002033 | -0.1805 | 5794 | 0.8567 | -0.00006075 | 0.00005341 |
fixed | NA | male | 0.0572 | 0.02589 | 2.21 | 5769 | 0.02718 | -0.01547 | 0.1299 |
fixed | NA | sibling_count3 | -0.04753 | 0.03907 | -1.217 | 4416 | 0.2238 | -0.1572 | 0.06213 |
fixed | NA | sibling_count4 | -0.06009 | 0.04218 | -1.425 | 3862 | 0.1544 | -0.1785 | 0.05832 |
fixed | NA | sibling_count5 | 0.04759 | 0.04945 | 0.9624 | 3265 | 0.3359 | -0.09122 | 0.1864 |
fixed | NA | sibling_count>5 | -0.0633 | 0.04274 | -1.481 | 2989 | 0.1387 | -0.1833 | 0.05668 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2586 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9519 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5982 | 0.4432 | -1.35 | 5792 | 0.1771 | -1.842 | 0.6459 |
fixed | NA | birth_order | 0.001925 | 0.008673 | 0.222 | 5563 | 0.8243 | -0.02242 | 0.02627 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02705 | 0.0503 | 0.5377 | 5794 | 0.5908 | -0.1142 | 0.1682 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00008128 | 0.001795 | -0.04528 | 5795 | 0.9639 | -0.00512 | 0.004958 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003598 | 0.00002034 | -0.1769 | 5793 | 0.8596 | -0.00006069 | 0.00005349 |
fixed | NA | male | 0.05715 | 0.02589 | 2.207 | 5768 | 0.02732 | -0.01552 | 0.1298 |
fixed | NA | sibling_count3 | -0.04846 | 0.03929 | -1.233 | 4416 | 0.2176 | -0.1588 | 0.06184 |
fixed | NA | sibling_count4 | -0.06225 | 0.04329 | -1.438 | 3871 | 0.1505 | -0.1838 | 0.05927 |
fixed | NA | sibling_count5 | 0.04417 | 0.05181 | 0.8525 | 3330 | 0.394 | -0.1013 | 0.1896 |
fixed | NA | sibling_count>5 | -0.07045 | 0.05352 | -1.316 | 3599 | 0.1881 | -0.2207 | 0.07977 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2587 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9519 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5775 | 0.4438 | -1.301 | 5789 | 0.1932 | -1.823 | 0.6683 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02592 | 0.05033 | 0.515 | 5791 | 0.6066 | -0.1154 | 0.1672 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00003914 | 0.001796 | -0.02179 | 5791 | 0.9826 | -0.005081 | 0.005003 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000004064 | 0.00002035 | -0.1997 | 5789 | 0.8417 | -0.0000612 | 0.00005307 |
fixed | NA | male | 0.0566 | 0.0259 | 2.186 | 5763 | 0.02888 | -0.01609 | 0.1293 |
fixed | NA | sibling_count3 | -0.03684 | 0.0402 | -0.9166 | 4608 | 0.3594 | -0.1497 | 0.076 |
fixed | NA | sibling_count4 | -0.05666 | 0.04517 | -1.254 | 4225 | 0.2098 | -0.1835 | 0.07015 |
fixed | NA | sibling_count5 | 0.04475 | 0.0544 | 0.8225 | 3754 | 0.4108 | -0.108 | 0.1975 |
fixed | NA | sibling_count>5 | -0.06844 | 0.05532 | -1.237 | 3922 | 0.2161 | -0.2237 | 0.08684 |
fixed | NA | birth_order_nonlinear2 | -0.02562 | 0.03336 | -0.768 | 4955 | 0.4425 | -0.1193 | 0.06802 |
fixed | NA | birth_order_nonlinear3 | -0.04947 | 0.0412 | -1.201 | 5175 | 0.2299 | -0.1651 | 0.06617 |
fixed | NA | birth_order_nonlinear4 | 0.0286 | 0.05233 | 0.5465 | 5341 | 0.5847 | -0.1183 | 0.1755 |
fixed | NA | birth_order_nonlinear5 | 0.007749 | 0.06629 | 0.1169 | 5277 | 0.9069 | -0.1783 | 0.1938 |
fixed | NA | birth_order_nonlinear>5 | -0.00116 | 0.06527 | -0.01777 | 5789 | 0.9858 | -0.1844 | 0.1821 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2588 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.952 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5521 | 0.4449 | -1.241 | 5780 | 0.2147 | -1.801 | 0.6967 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02312 | 0.05045 | 0.4584 | 5781 | 0.6467 | -0.1185 | 0.1647 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00006625 | 0.001801 | 0.03679 | 5781 | 0.9707 | -0.004988 | 0.005121 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000005314 | 0.00002041 | -0.2604 | 5779 | 0.7945 | -0.0000626 | 0.00005197 |
fixed | NA | male | 0.05695 | 0.02592 | 2.197 | 5752 | 0.02805 | -0.01581 | 0.1297 |
fixed | NA | count_birth_order2/2 | -0.03262 | 0.05883 | -0.5544 | 5086 | 0.5793 | -0.1978 | 0.1325 |
fixed | NA | count_birth_order1/3 | -0.03163 | 0.05223 | -0.6057 | 5770 | 0.5448 | -0.1782 | 0.115 |
fixed | NA | count_birth_order2/3 | -0.05113 | 0.05778 | -0.885 | 5780 | 0.3762 | -0.2133 | 0.111 |
fixed | NA | count_birth_order3/3 | -0.1218 | 0.0635 | -1.918 | 5780 | 0.05516 | -0.3 | 0.05645 |
fixed | NA | count_birth_order1/4 | -0.07897 | 0.06499 | -1.215 | 5777 | 0.2244 | -0.2614 | 0.1035 |
fixed | NA | count_birth_order2/4 | -0.1058 | 0.06687 | -1.583 | 5781 | 0.1135 | -0.2935 | 0.08185 |
fixed | NA | count_birth_order3/4 | -0.07093 | 0.07008 | -1.012 | 5777 | 0.3115 | -0.2676 | 0.1258 |
fixed | NA | count_birth_order4/4 | -0.01687 | 0.07408 | -0.2277 | 5775 | 0.8199 | -0.2248 | 0.1911 |
fixed | NA | count_birth_order1/5 | 0.05054 | 0.08768 | 0.5764 | 5781 | 0.5644 | -0.1956 | 0.2967 |
fixed | NA | count_birth_order2/5 | -0.01504 | 0.09697 | -0.1551 | 5776 | 0.8767 | -0.2872 | 0.2572 |
fixed | NA | count_birth_order3/5 | -0.0003237 | 0.09252 | -0.003499 | 5773 | 0.9972 | -0.26 | 0.2594 |
fixed | NA | count_birth_order4/5 | -0.02 | 0.08914 | -0.2244 | 5775 | 0.8225 | -0.2702 | 0.2302 |
fixed | NA | count_birth_order5/5 | 0.1681 | 0.09472 | 1.774 | 5771 | 0.07608 | -0.09783 | 0.4339 |
fixed | NA | count_birth_order1/>5 | -0.0804 | 0.08927 | -0.9006 | 5781 | 0.3679 | -0.331 | 0.1702 |
fixed | NA | count_birth_order2/>5 | -0.05915 | 0.08855 | -0.668 | 5780 | 0.5042 | -0.3077 | 0.1894 |
fixed | NA | count_birth_order3/>5 | -0.1176 | 0.08777 | -1.34 | 5772 | 0.1802 | -0.364 | 0.1287 |
fixed | NA | count_birth_order4/>5 | 0.02036 | 0.08587 | 0.2372 | 5765 | 0.8125 | -0.2207 | 0.2614 |
fixed | NA | count_birth_order5/>5 | -0.1374 | 0.07891 | -1.741 | 5767 | 0.08173 | -0.3589 | 0.08412 |
fixed | NA | count_birth_order>5/>5 | -0.07222 | 0.05867 | -1.231 | 5114 | 0.2184 | -0.2369 | 0.09246 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2592 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9522 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16314 | 16387 | -8146 | 16292 | NA | NA | NA |
12 | 16316 | 16396 | -8146 | 16292 | 0.0492 | 1 | 0.8245 |
16 | 16321 | 16428 | -8144 | 16289 | 2.826 | 4 | 0.5874 |
26 | 16334 | 16508 | -8141 | 16282 | 6.65 | 10 | 0.758 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = big5_open)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4167 | 0.1589 | 2.623 | 13709 | 0.008727 | -0.02924 | 0.8626 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03942 | 0.01522 | -2.59 | 13601 | 0.009601 | -0.08214 | 0.003299 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001142 | 0.0004473 | 2.552 | 13428 | 0.01072 | -0.000114 | 0.002397 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001113 | 0.000004115 | -2.705 | 13257 | 0.006832 | -0.00002269 | 0.0000004185 |
fixed | NA | male | 0.1705 | 0.01678 | 10.16 | 13815 | 3.517e-24 | 0.1234 | 0.2177 |
fixed | NA | sibling_count3 | -0.0164 | 0.03344 | -0.4905 | 10579 | 0.6238 | -0.1103 | 0.07746 |
fixed | NA | sibling_count4 | -0.04541 | 0.03438 | -1.321 | 9628 | 0.1866 | -0.1419 | 0.05109 |
fixed | NA | sibling_count5 | -0.004679 | 0.03564 | -0.1313 | 8559 | 0.8956 | -0.1047 | 0.09537 |
fixed | NA | sibling_count>5 | -0.07108 | 0.02806 | -2.533 | 9722 | 0.01132 | -0.1498 | 0.007688 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2818 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9529 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4136 | 0.1588 | 2.604 | 13710 | 0.009231 | -0.03229 | 0.8595 |
fixed | NA | birth_order | -0.006737 | 0.003501 | -1.924 | 11701 | 0.05434 | -0.01657 | 0.003091 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03742 | 0.01525 | -2.453 | 13584 | 0.01416 | -0.08023 | 0.005394 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001071 | 0.0004488 | 2.386 | 13368 | 0.01707 | -0.0001891 | 0.00233 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001049 | 0.000004129 | -2.54 | 13175 | 0.0111 | -0.00002208 | 0.000001103 |
fixed | NA | male | 0.1707 | 0.01678 | 10.18 | 13814 | 3.116e-24 | 0.1236 | 0.2178 |
fixed | NA | sibling_count3 | -0.01476 | 0.03344 | -0.4413 | 10591 | 0.659 | -0.1086 | 0.07912 |
fixed | NA | sibling_count4 | -0.04063 | 0.03446 | -1.179 | 9685 | 0.2384 | -0.1374 | 0.0561 |
fixed | NA | sibling_count5 | 0.003553 | 0.03589 | 0.099 | 8660 | 0.9211 | -0.0972 | 0.1043 |
fixed | NA | sibling_count>5 | -0.04537 | 0.03107 | -1.46 | 10694 | 0.1443 | -0.1326 | 0.04186 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2814 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9529 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4067 | 0.1593 | 2.554 | 13713 | 0.01067 | -0.04038 | 0.8538 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03765 | 0.01526 | -2.467 | 13594 | 0.01362 | -0.08047 | 0.005181 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001092 | 0.0004489 | 2.432 | 13379 | 0.01501 | -0.0001681 | 0.002352 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001079 | 0.00000413 | -2.613 | 13175 | 0.008993 | -0.00002238 | 0.0000008026 |
fixed | NA | male | 0.1708 | 0.01678 | 10.18 | 13810 | 3.101e-24 | 0.1237 | 0.2179 |
fixed | NA | sibling_count3 | -0.004799 | 0.03395 | -0.1414 | 10928 | 0.8876 | -0.1001 | 0.09049 |
fixed | NA | sibling_count4 | -0.02479 | 0.0355 | -0.6983 | 10404 | 0.485 | -0.1245 | 0.07487 |
fixed | NA | sibling_count5 | 0.01456 | 0.03739 | 0.3894 | 9631 | 0.697 | -0.09039 | 0.1195 |
fixed | NA | sibling_count>5 | -0.04095 | 0.03276 | -1.25 | 11805 | 0.2113 | -0.1329 | 0.051 |
fixed | NA | birth_order_nonlinear2 | -0.01379 | 0.02447 | -0.5636 | 12763 | 0.5731 | -0.08249 | 0.0549 |
fixed | NA | birth_order_nonlinear3 | -0.0592 | 0.02888 | -2.049 | 12620 | 0.04044 | -0.1403 | 0.02188 |
fixed | NA | birth_order_nonlinear4 | -0.05691 | 0.0329 | -1.73 | 12710 | 0.08366 | -0.1493 | 0.03543 |
fixed | NA | birth_order_nonlinear5 | -0.007878 | 0.03741 | -0.2106 | 12776 | 0.8332 | -0.1129 | 0.09714 |
fixed | NA | birth_order_nonlinear>5 | -0.04945 | 0.03085 | -1.603 | 13920 | 0.109 | -0.136 | 0.03715 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2817 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9528 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4334 | 0.16 | 2.709 | 13713 | 0.006754 | -0.01566 | 0.8824 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03779 | 0.01526 | -2.477 | 13585 | 0.01327 | -0.08063 | 0.00504 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001099 | 0.0004489 | 2.448 | 13365 | 0.01439 | -0.0001613 | 0.002359 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001087 | 0.000004131 | -2.633 | 13155 | 0.008485 | -0.00002247 | 0.0000007208 |
fixed | NA | male | 0.1706 | 0.01678 | 10.16 | 13800 | 3.581e-24 | 0.1234 | 0.2177 |
fixed | NA | count_birth_order2/2 | -0.08334 | 0.04757 | -1.752 | 12613 | 0.0798 | -0.2169 | 0.05019 |
fixed | NA | count_birth_order1/3 | -0.0571 | 0.04482 | -1.274 | 13832 | 0.2027 | -0.1829 | 0.06871 |
fixed | NA | count_birth_order2/3 | -0.02348 | 0.05011 | -0.4685 | 13867 | 0.6394 | -0.1641 | 0.1172 |
fixed | NA | count_birth_order3/3 | -0.0652 | 0.05612 | -1.162 | 13895 | 0.2454 | -0.2227 | 0.09234 |
fixed | NA | count_birth_order1/4 | -0.07077 | 0.05117 | -1.383 | 13871 | 0.1667 | -0.2144 | 0.07288 |
fixed | NA | count_birth_order2/4 | -0.009176 | 0.05382 | -0.1705 | 13881 | 0.8646 | -0.1602 | 0.1419 |
fixed | NA | count_birth_order3/4 | -0.1791 | 0.05847 | -3.062 | 13898 | 0.002201 | -0.3432 | -0.01492 |
fixed | NA | count_birth_order4/4 | -0.07479 | 0.0619 | -1.208 | 13906 | 0.227 | -0.2485 | 0.09897 |
fixed | NA | count_birth_order1/5 | 0.0005729 | 0.05806 | 0.009867 | 13896 | 0.9921 | -0.1624 | 0.1636 |
fixed | NA | count_birth_order2/5 | -0.06346 | 0.06107 | -1.039 | 13905 | 0.2988 | -0.2349 | 0.108 |
fixed | NA | count_birth_order3/5 | -0.07172 | 0.06269 | -1.144 | 13908 | 0.2526 | -0.2477 | 0.1042 |
fixed | NA | count_birth_order4/5 | -0.02146 | 0.0664 | -0.3232 | 13910 | 0.7465 | -0.2079 | 0.1649 |
fixed | NA | count_birth_order5/5 | -0.03514 | 0.06788 | -0.5177 | 13910 | 0.6046 | -0.2257 | 0.1554 |
fixed | NA | count_birth_order1/>5 | -0.06634 | 0.04689 | -1.415 | 13909 | 0.1571 | -0.198 | 0.06527 |
fixed | NA | count_birth_order2/>5 | -0.07713 | 0.04836 | -1.595 | 13910 | 0.1108 | -0.2129 | 0.05863 |
fixed | NA | count_birth_order3/>5 | -0.1038 | 0.04738 | -2.19 | 13910 | 0.02853 | -0.2368 | 0.02923 |
fixed | NA | count_birth_order4/>5 | -0.1541 | 0.04643 | -3.319 | 13910 | 0.0009054 | -0.2845 | -0.02378 |
fixed | NA | count_birth_order5/>5 | -0.06927 | 0.04678 | -1.481 | 13909 | 0.1387 | -0.2006 | 0.06204 |
fixed | NA | count_birth_order>5/>5 | -0.1164 | 0.0364 | -3.198 | 12676 | 0.001387 | -0.2186 | -0.01423 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2812 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.953 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 39311 | 39394 | -19645 | 39289 | NA | NA | NA |
12 | 39310 | 39400 | -19643 | 39286 | 3.706 | 1 | 0.05421 |
16 | 39315 | 39435 | -19641 | 39283 | 3.124 | 4 | 0.5373 |
26 | 39324 | 39521 | -19636 | 39272 | 10.07 | 10 | 0.4341 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.833 | 0.4144 | -2.01 | 5898 | 0.04449 | -1.996 | 0.3304 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1105 | 0.04703 | 2.349 | 5903 | 0.01885 | -0.02153 | 0.2425 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004051 | 0.001678 | -2.414 | 5908 | 0.01581 | -0.008761 | 0.0006597 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004751 | 0.000019 | 2.5 | 5911 | 0.01245 | -0.000005835 | 0.0001008 |
fixed | NA | male | 0.1386 | 0.02423 | 5.719 | 5858 | 0.00000001124 | 0.07055 | 0.2066 |
fixed | NA | sibling_count3 | -0.09714 | 0.03779 | -2.571 | 4467 | 0.01018 | -0.2032 | 0.008928 |
fixed | NA | sibling_count4 | -0.08943 | 0.04063 | -2.201 | 3920 | 0.02778 | -0.2035 | 0.02462 |
fixed | NA | sibling_count5 | -0.1136 | 0.04629 | -2.453 | 3478 | 0.01421 | -0.2435 | 0.01638 |
fixed | NA | sibling_count>5 | -0.1441 | 0.04061 | -3.548 | 3230 | 0.0003942 | -0.2581 | -0.03008 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2961 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8871 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8361 | 0.4145 | -2.017 | 5897 | 0.04374 | -2 | 0.3275 |
fixed | NA | birth_order | 0.003801 | 0.007987 | 0.4758 | 5757 | 0.6342 | -0.01862 | 0.02622 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1103 | 0.04703 | 2.345 | 5902 | 0.01904 | -0.02171 | 0.2423 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004051 | 0.001678 | -2.414 | 5907 | 0.01581 | -0.008762 | 0.0006597 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004766 | 0.00001901 | 2.507 | 5910 | 0.01219 | -0.000005693 | 0.000101 |
fixed | NA | male | 0.1384 | 0.02423 | 5.711 | 5858 | 0.00000001176 | 0.07038 | 0.2064 |
fixed | NA | sibling_count3 | -0.09898 | 0.03799 | -2.606 | 4471 | 0.009196 | -0.2056 | 0.007644 |
fixed | NA | sibling_count4 | -0.09377 | 0.04164 | -2.252 | 3925 | 0.02438 | -0.2107 | 0.02312 |
fixed | NA | sibling_count5 | -0.1207 | 0.04866 | -2.481 | 3554 | 0.01317 | -0.2573 | 0.01589 |
fixed | NA | sibling_count>5 | -0.1583 | 0.0505 | -3.136 | 3749 | 0.001727 | -0.3001 | -0.0166 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.296 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8872 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8633 | 0.4151 | -2.08 | 5897 | 0.03758 | -2.028 | 0.3018 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.113 | 0.04705 | 2.402 | 5900 | 0.01634 | -0.01906 | 0.2451 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00414 | 0.001679 | -2.466 | 5904 | 0.01369 | -0.008853 | 0.0005725 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000485 | 0.00001902 | 2.55 | 5907 | 0.01079 | -0.000004881 | 0.0001019 |
fixed | NA | male | 0.1388 | 0.02423 | 5.727 | 5852 | 0.00000001074 | 0.07074 | 0.2068 |
fixed | NA | sibling_count3 | -0.0928 | 0.03879 | -2.392 | 4656 | 0.01677 | -0.2017 | 0.01608 |
fixed | NA | sibling_count4 | -0.09456 | 0.04332 | -2.183 | 4267 | 0.02912 | -0.2162 | 0.02706 |
fixed | NA | sibling_count5 | -0.1389 | 0.05122 | -2.712 | 4011 | 0.006717 | -0.2827 | 0.00487 |
fixed | NA | sibling_count>5 | -0.146 | 0.05205 | -2.806 | 4036 | 0.005043 | -0.2921 | 0.00006495 |
fixed | NA | birth_order_nonlinear2 | 0.02394 | 0.03144 | 0.7614 | 5006 | 0.4465 | -0.06432 | 0.1122 |
fixed | NA | birth_order_nonlinear3 | -0.01775 | 0.03877 | -0.4578 | 5241 | 0.6471 | -0.1266 | 0.09107 |
fixed | NA | birth_order_nonlinear4 | 0.05292 | 0.0479 | 1.105 | 5396 | 0.2693 | -0.08154 | 0.1874 |
fixed | NA | birth_order_nonlinear5 | 0.106 | 0.05983 | 1.771 | 5286 | 0.07654 | -0.06196 | 0.274 |
fixed | NA | birth_order_nonlinear>5 | -0.03825 | 0.05984 | -0.6391 | 5909 | 0.5228 | -0.2062 | 0.1297 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2962 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8869 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8675 | 0.416 | -2.085 | 5888 | 0.03708 | -2.035 | 0.3002 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1149 | 0.04715 | 2.436 | 5890 | 0.01486 | -0.01747 | 0.2472 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.004197 | 0.001683 | -2.494 | 5894 | 0.01267 | -0.00892 | 0.0005273 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004901 | 0.00001906 | 2.571 | 5897 | 0.01018 | -0.000004509 | 0.0001025 |
fixed | NA | male | 0.1395 | 0.02425 | 5.752 | 5842 | 0.000000009252 | 0.07142 | 0.2076 |
fixed | NA | count_birth_order2/2 | -0.01995 | 0.05685 | -0.351 | 5213 | 0.7256 | -0.1795 | 0.1396 |
fixed | NA | count_birth_order1/3 | -0.137 | 0.05008 | -2.736 | 5880 | 0.00623 | -0.2776 | 0.003537 |
fixed | NA | count_birth_order2/3 | -0.07656 | 0.05472 | -1.399 | 5896 | 0.1619 | -0.2302 | 0.07705 |
fixed | NA | count_birth_order3/3 | -0.0773 | 0.06117 | -1.264 | 5900 | 0.2064 | -0.249 | 0.09441 |
fixed | NA | count_birth_order1/4 | -0.07394 | 0.06123 | -1.208 | 5891 | 0.2273 | -0.2458 | 0.09794 |
fixed | NA | count_birth_order2/4 | -0.1317 | 0.06338 | -2.078 | 5900 | 0.03775 | -0.3096 | 0.04621 |
fixed | NA | count_birth_order3/4 | -0.1464 | 0.06698 | -2.186 | 5897 | 0.02884 | -0.3345 | 0.04158 |
fixed | NA | count_birth_order4/4 | -0.02691 | 0.06964 | -0.3864 | 5895 | 0.6992 | -0.2224 | 0.1686 |
fixed | NA | count_birth_order1/5 | -0.1685 | 0.08317 | -2.026 | 5900 | 0.0428 | -0.402 | 0.06496 |
fixed | NA | count_birth_order2/5 | -0.05147 | 0.08905 | -0.578 | 5889 | 0.5633 | -0.3014 | 0.1985 |
fixed | NA | count_birth_order3/5 | -0.2027 | 0.08347 | -2.428 | 5888 | 0.01521 | -0.437 | 0.03163 |
fixed | NA | count_birth_order4/5 | -0.1164 | 0.08041 | -1.448 | 5892 | 0.1476 | -0.3422 | 0.1093 |
fixed | NA | count_birth_order5/5 | -0.05156 | 0.08367 | -0.6162 | 5884 | 0.5378 | -0.2864 | 0.1833 |
fixed | NA | count_birth_order1/>5 | -0.1743 | 0.08252 | -2.112 | 5899 | 0.03475 | -0.4059 | 0.05737 |
fixed | NA | count_birth_order2/>5 | -0.06251 | 0.0817 | -0.7651 | 5894 | 0.4442 | -0.2919 | 0.1668 |
fixed | NA | count_birth_order3/>5 | -0.2153 | 0.08185 | -2.631 | 5879 | 0.008545 | -0.4451 | 0.01444 |
fixed | NA | count_birth_order4/>5 | -0.1316 | 0.07712 | -1.707 | 5875 | 0.08787 | -0.3481 | 0.08483 |
fixed | NA | count_birth_order5/>5 | -0.0526 | 0.07288 | -0.7217 | 5876 | 0.4705 | -0.2572 | 0.152 |
fixed | NA | count_birth_order>5/>5 | -0.1993 | 0.05481 | -3.636 | 5364 | 0.0002797 | -0.3531 | -0.04543 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2959 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8872 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16002 | 16076 | -7990 | 15980 | NA | NA | NA |
12 | 16004 | 16084 | -7990 | 15980 | 0.2274 | 1 | 0.6335 |
16 | 16005 | 16112 | -7986 | 15973 | 7.314 | 4 | 0.1202 |
26 | 16018 | 16192 | -7983 | 15966 | 6.635 | 10 | 0.7594 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7636 | 0.4132 | -1.848 | 5950 | 0.06468 | -1.924 | 0.3964 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1043 | 0.04691 | 2.224 | 5954 | 0.02621 | -0.02736 | 0.236 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003837 | 0.001674 | -2.292 | 5959 | 0.02196 | -0.008537 | 0.0008629 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004507 | 0.00001896 | 2.376 | 5962 | 0.01751 | -0.000008165 | 0.0000983 |
fixed | NA | male | 0.1403 | 0.02414 | 5.814 | 5908 | 0.000000006409 | 0.07258 | 0.2081 |
fixed | NA | sibling_count3 | -0.1248 | 0.04088 | -3.052 | 4624 | 0.002283 | -0.2395 | -0.01003 |
fixed | NA | sibling_count4 | -0.1013 | 0.04303 | -2.354 | 4207 | 0.01864 | -0.2221 | 0.01951 |
fixed | NA | sibling_count5 | -0.1191 | 0.04596 | -2.592 | 3760 | 0.009571 | -0.2481 | 0.00987 |
fixed | NA | sibling_count>5 | -0.134 | 0.0403 | -3.325 | 3858 | 0.0008931 | -0.2471 | -0.02087 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2966 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8872 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7645 | 0.4133 | -1.85 | 5949 | 0.06442 | -1.925 | 0.3957 |
fixed | NA | birth_order | 0.0008314 | 0.006965 | 0.1194 | 5559 | 0.905 | -0.01872 | 0.02038 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1043 | 0.04691 | 2.223 | 5953 | 0.02623 | -0.02738 | 0.236 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003838 | 0.001674 | -2.292 | 5957 | 0.02193 | -0.008539 | 0.0008622 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004511 | 0.00001897 | 2.378 | 5961 | 0.01743 | -0.000008134 | 0.00009836 |
fixed | NA | male | 0.1403 | 0.02414 | 5.812 | 5907 | 0.000000006484 | 0.07255 | 0.2081 |
fixed | NA | sibling_count3 | -0.1252 | 0.04102 | -3.052 | 4621 | 0.002288 | -0.2403 | -0.01004 |
fixed | NA | sibling_count4 | -0.1022 | 0.04371 | -2.338 | 4193 | 0.01943 | -0.2249 | 0.0205 |
fixed | NA | sibling_count5 | -0.1206 | 0.04751 | -2.538 | 3769 | 0.0112 | -0.2539 | 0.0128 |
fixed | NA | sibling_count>5 | -0.137 | 0.04768 | -2.874 | 4144 | 0.004076 | -0.2709 | -0.003186 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2967 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8873 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7658 | 0.4139 | -1.85 | 5949 | 0.06431 | -1.928 | 0.3959 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1043 | 0.04693 | 2.221 | 5951 | 0.02636 | -0.02749 | 0.236 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00383 | 0.001675 | -2.286 | 5955 | 0.02228 | -0.008533 | 0.0008726 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000449 | 0.00001898 | 2.366 | 5958 | 0.01803 | -0.00000838 | 0.00009818 |
fixed | NA | male | 0.1403 | 0.02414 | 5.81 | 5902 | 0.000000006563 | 0.07251 | 0.2081 |
fixed | NA | sibling_count3 | -0.1194 | 0.04179 | -2.857 | 4777 | 0.00429 | -0.2367 | -0.002104 |
fixed | NA | sibling_count4 | -0.1057 | 0.04529 | -2.333 | 4488 | 0.0197 | -0.2328 | 0.02148 |
fixed | NA | sibling_count5 | -0.1304 | 0.04986 | -2.614 | 4182 | 0.008972 | -0.2703 | 0.009608 |
fixed | NA | sibling_count>5 | -0.126 | 0.04921 | -2.561 | 4450 | 0.01046 | -0.2642 | 0.0121 |
fixed | NA | birth_order_nonlinear2 | 0.006196 | 0.03202 | 0.1935 | 5140 | 0.8466 | -0.0837 | 0.09609 |
fixed | NA | birth_order_nonlinear3 | -0.02327 | 0.03865 | -0.6022 | 5366 | 0.547 | -0.1318 | 0.08521 |
fixed | NA | birth_order_nonlinear4 | 0.05037 | 0.04648 | 1.084 | 5519 | 0.2785 | -0.08011 | 0.1809 |
fixed | NA | birth_order_nonlinear5 | 0.04243 | 0.05703 | 0.744 | 5482 | 0.4569 | -0.1176 | 0.2025 |
fixed | NA | birth_order_nonlinear>5 | -0.04304 | 0.05343 | -0.8055 | 5943 | 0.4206 | -0.193 | 0.1069 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2968 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8872 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7433 | 0.4145 | -1.793 | 5939 | 0.073 | -1.907 | 0.4203 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1031 | 0.04699 | 2.194 | 5941 | 0.02827 | -0.02881 | 0.235 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003777 | 0.001678 | -2.251 | 5944 | 0.02442 | -0.008487 | 0.0009329 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004418 | 0.00001901 | 2.324 | 5948 | 0.02016 | -0.000009185 | 0.00009755 |
fixed | NA | male | 0.1401 | 0.02415 | 5.801 | 5891 | 0.000000006922 | 0.07232 | 0.2079 |
fixed | NA | count_birth_order2/2 | -0.03849 | 0.0622 | -0.6188 | 5328 | 0.5361 | -0.2131 | 0.1361 |
fixed | NA | count_birth_order1/3 | -0.1582 | 0.05423 | -2.917 | 5931 | 0.003545 | -0.3104 | -0.005976 |
fixed | NA | count_birth_order2/3 | -0.1277 | 0.05882 | -2.171 | 5946 | 0.03 | -0.2928 | 0.03743 |
fixed | NA | count_birth_order3/3 | -0.1121 | 0.0662 | -1.693 | 5951 | 0.09043 | -0.2979 | 0.07372 |
fixed | NA | count_birth_order1/4 | -0.1371 | 0.06414 | -2.138 | 5942 | 0.03256 | -0.3172 | 0.04291 |
fixed | NA | count_birth_order2/4 | -0.1088 | 0.06536 | -1.665 | 5950 | 0.09598 | -0.2923 | 0.07464 |
fixed | NA | count_birth_order3/4 | -0.2025 | 0.07174 | -2.823 | 5948 | 0.004773 | -0.4039 | -0.001148 |
fixed | NA | count_birth_order4/4 | 0.008894 | 0.07396 | 0.1203 | 5948 | 0.9043 | -0.1987 | 0.2165 |
fixed | NA | count_birth_order1/5 | -0.1709 | 0.07612 | -2.245 | 5950 | 0.0248 | -0.3846 | 0.04277 |
fixed | NA | count_birth_order2/5 | -0.161 | 0.08176 | -1.969 | 5947 | 0.04903 | -0.3904 | 0.06854 |
fixed | NA | count_birth_order3/5 | -0.1594 | 0.07951 | -2.004 | 5944 | 0.04509 | -0.3826 | 0.06383 |
fixed | NA | count_birth_order4/5 | -0.03537 | 0.08242 | -0.4291 | 5936 | 0.6679 | -0.2667 | 0.196 |
fixed | NA | count_birth_order5/5 | -0.1204 | 0.08264 | -1.457 | 5935 | 0.1453 | -0.3524 | 0.1116 |
fixed | NA | count_birth_order1/>5 | -0.084 | 0.07236 | -1.161 | 5950 | 0.2457 | -0.2871 | 0.1191 |
fixed | NA | count_birth_order2/>5 | -0.08335 | 0.0756 | -1.103 | 5947 | 0.2703 | -0.2955 | 0.1289 |
fixed | NA | count_birth_order3/>5 | -0.17 | 0.07416 | -2.293 | 5939 | 0.02188 | -0.3782 | 0.03811 |
fixed | NA | count_birth_order4/>5 | -0.201 | 0.07138 | -2.816 | 5937 | 0.004873 | -0.4014 | -0.0006655 |
fixed | NA | count_birth_order5/>5 | -0.08702 | 0.07335 | -1.186 | 5920 | 0.2355 | -0.2929 | 0.1189 |
fixed | NA | count_birth_order>5/>5 | -0.1847 | 0.05372 | -3.439 | 5495 | 0.0005887 | -0.3355 | -0.03394 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2977 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8869 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16143 | 16217 | -8061 | 16121 | NA | NA | NA |
12 | 16145 | 16225 | -8061 | 16121 | 0.01427 | 1 | 0.9049 |
16 | 16149 | 16256 | -8058 | 16117 | 4.361 | 4 | 0.3594 |
26 | 16158 | 16332 | -8053 | 16106 | 10.45 | 10 | 0.4015 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7587 | 0.4191 | -1.81 | 5780 | 0.07031 | -1.935 | 0.4178 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1017 | 0.04758 | 2.138 | 5785 | 0.03258 | -0.03184 | 0.2353 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003723 | 0.001698 | -2.192 | 5789 | 0.02841 | -0.00849 | 0.001044 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004357 | 0.00001924 | 2.264 | 5793 | 0.0236 | -0.00001044 | 0.00009758 |
fixed | NA | male | 0.1344 | 0.02447 | 5.493 | 5740 | 0.00000004125 | 0.06571 | 0.2031 |
fixed | NA | sibling_count3 | -0.1099 | 0.03728 | -2.949 | 4351 | 0.003205 | -0.2146 | -0.005294 |
fixed | NA | sibling_count4 | -0.09092 | 0.04034 | -2.254 | 3830 | 0.02428 | -0.2042 | 0.02233 |
fixed | NA | sibling_count5 | -0.09754 | 0.04741 | -2.057 | 3285 | 0.03975 | -0.2306 | 0.03555 |
fixed | NA | sibling_count>5 | -0.1308 | 0.04103 | -3.188 | 3049 | 0.001449 | -0.246 | -0.01561 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2968 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8863 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7619 | 0.4192 | -1.818 | 5779 | 0.06917 | -1.938 | 0.4147 |
fixed | NA | birth_order | 0.004791 | 0.008228 | 0.5822 | 5679 | 0.5604 | -0.01831 | 0.02789 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1014 | 0.04758 | 2.131 | 5784 | 0.03309 | -0.03214 | 0.235 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003721 | 0.001698 | -2.191 | 5788 | 0.02848 | -0.008488 | 0.001046 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004374 | 0.00001924 | 2.273 | 5792 | 0.02307 | -0.00001028 | 0.00009776 |
fixed | NA | male | 0.1343 | 0.02447 | 5.487 | 5739 | 0.00000004254 | 0.06559 | 0.203 |
fixed | NA | sibling_count3 | -0.1123 | 0.0375 | -2.994 | 4354 | 0.002767 | -0.2175 | -0.007017 |
fixed | NA | sibling_count4 | -0.09632 | 0.0414 | -2.327 | 3848 | 0.02004 | -0.2125 | 0.01989 |
fixed | NA | sibling_count5 | -0.1061 | 0.04965 | -2.137 | 3361 | 0.03265 | -0.2455 | 0.03326 |
fixed | NA | sibling_count>5 | -0.1486 | 0.05122 | -2.902 | 3668 | 0.003734 | -0.2924 | -0.004849 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2968 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8863 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7727 | 0.4197 | -1.841 | 5780 | 0.06568 | -1.951 | 0.4055 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1028 | 0.0476 | 2.16 | 5782 | 0.0308 | -0.03079 | 0.2364 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003761 | 0.001699 | -2.214 | 5785 | 0.02689 | -0.008531 | 0.001008 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004398 | 0.00001926 | 2.284 | 5788 | 0.02242 | -0.00001007 | 0.00009803 |
fixed | NA | male | 0.1339 | 0.02447 | 5.473 | 5734 | 0.00000004602 | 0.06525 | 0.2026 |
fixed | NA | sibling_count3 | -0.1077 | 0.03832 | -2.811 | 4541 | 0.004962 | -0.2153 | -0.000148 |
fixed | NA | sibling_count4 | -0.1011 | 0.04312 | -2.345 | 4186 | 0.01908 | -0.2222 | 0.01993 |
fixed | NA | sibling_count5 | -0.1219 | 0.05202 | -2.344 | 3762 | 0.01913 | -0.268 | 0.02409 |
fixed | NA | sibling_count>5 | -0.1329 | 0.05286 | -2.514 | 3966 | 0.01199 | -0.2813 | 0.01551 |
fixed | NA | birth_order_nonlinear2 | 0.01259 | 0.03137 | 0.4012 | 4886 | 0.6883 | -0.07547 | 0.1006 |
fixed | NA | birth_order_nonlinear3 | -0.007885 | 0.03878 | -0.2033 | 5100 | 0.8389 | -0.1167 | 0.101 |
fixed | NA | birth_order_nonlinear4 | 0.06473 | 0.0493 | 1.313 | 5262 | 0.1892 | -0.07364 | 0.2031 |
fixed | NA | birth_order_nonlinear5 | 0.07644 | 0.06242 | 1.225 | 5174 | 0.2208 | -0.09878 | 0.2517 |
fixed | NA | birth_order_nonlinear>5 | -0.03802 | 0.06175 | -0.6156 | 5785 | 0.5382 | -0.2114 | 0.1353 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2956 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.8866 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.7574 | 0.4207 | -1.8 | 5771 | 0.07189 | -1.938 | 0.4236 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1027 | 0.04771 | 2.152 | 5772 | 0.0314 | -0.03123 | 0.2366 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003749 | 0.001703 | -2.201 | 5776 | 0.02778 | -0.008531 | 0.001032 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004374 | 0.00001931 | 2.266 | 5779 | 0.02352 | -0.00001046 | 0.00009794 |
fixed | NA | male | 0.1337 | 0.02449 | 5.46 | 5723 | 0.00000004957 | 0.06499 | 0.2025 |
fixed | NA | count_birth_order2/2 | -0.03314 | 0.05536 | -0.5986 | 5061 | 0.5495 | -0.1886 | 0.1223 |
fixed | NA | count_birth_order1/3 | -0.1392 | 0.04945 | -2.815 | 5760 | 0.004896 | -0.278 | -0.0003884 |
fixed | NA | count_birth_order2/3 | -0.1234 | 0.05468 | -2.257 | 5779 | 0.02403 | -0.2769 | 0.03006 |
fixed | NA | count_birth_order3/3 | -0.08378 | 0.06007 | -1.395 | 5780 | 0.1632 | -0.2524 | 0.08484 |
fixed | NA | count_birth_order1/4 | -0.1067 | 0.06151 | -1.735 | 5775 | 0.08283 | -0.2794 | 0.06596 |
fixed | NA | count_birth_order2/4 | -0.1168 | 0.06327 | -1.846 | 5781 | 0.065 | -0.2944 | 0.06083 |
fixed | NA | count_birth_order3/4 | -0.1429 | 0.06628 | -2.156 | 5776 | 0.0311 | -0.329 | 0.04313 |
fixed | NA | count_birth_order4/4 | -0.02894 | 0.07005 | -0.4132 | 5772 | 0.6795 | -0.2256 | 0.1677 |
fixed | NA | count_birth_order1/5 | -0.2023 | 0.08297 | -2.438 | 5781 | 0.0148 | -0.4352 | 0.03062 |
fixed | NA | count_birth_order2/5 | -0.03606 | 0.0917 | -0.3932 | 5768 | 0.6942 | -0.2934 | 0.2213 |
fixed | NA | count_birth_order3/5 | -0.1885 | 0.08748 | -2.154 | 5766 | 0.03125 | -0.434 | 0.0571 |
fixed | NA | count_birth_order4/5 | -0.05182 | 0.08429 | -0.6147 | 5771 | 0.5388 | -0.2884 | 0.1848 |
fixed | NA | count_birth_order5/5 | -0.04479 | 0.08956 | -0.5001 | 5763 | 0.617 | -0.2962 | 0.2066 |
fixed | NA | count_birth_order1/>5 | -0.1186 | 0.08445 | -1.404 | 5778 | 0.1603 | -0.3556 | 0.1185 |
fixed | NA | count_birth_order2/>5 | -0.06131 | 0.08375 | -0.7321 | 5774 | 0.4642 | -0.2964 | 0.1738 |
fixed | NA | count_birth_order3/>5 | -0.1921 | 0.08298 | -2.315 | 5757 | 0.02065 | -0.425 | 0.04083 |
fixed | NA | count_birth_order4/>5 | -0.1344 | 0.08117 | -1.656 | 5743 | 0.09781 | -0.3622 | 0.09344 |
fixed | NA | count_birth_order5/>5 | -0.08222 | 0.0746 | -1.102 | 5753 | 0.2704 | -0.2916 | 0.1272 |
fixed | NA | count_birth_order>5/>5 | -0.1868 | 0.05579 | -3.349 | 5198 | 0.000818 | -0.3434 | -0.03021 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2954 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.887 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15673 | 15746 | -7826 | 15651 | NA | NA | NA |
12 | 15675 | 15755 | -7825 | 15651 | 0.3398 | 1 | 0.5599 |
16 | 15678 | 15785 | -7823 | 15646 | 4.718 | 4 | 0.3175 |
26 | 15692 | 15865 | -7820 | 15640 | 6.553 | 10 | 0.7669 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = riskA)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.147 | 0.1737 | 6.604 | 11994 | 0.0000000000418 | 0.6596 | 1.635 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09252 | 0.01678 | -5.513 | 11800 | 0.00000003595 | -0.1396 | -0.04541 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002406 | 0.0004989 | 4.822 | 11527 | 0.000001438 | 0.001005 | 0.003806 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001908 | 0.000004653 | -4.1 | 11257 | 0.00004163 | -0.00003214 | -0.000006015 |
fixed | NA | male | -0.2332 | 0.01776 | -13.13 | 12290 | 3.886e-39 | -0.283 | -0.1834 |
fixed | NA | sibling_count3 | 0.003204 | 0.03507 | 0.09136 | 9926 | 0.9272 | -0.09525 | 0.1017 |
fixed | NA | sibling_count4 | 0.004187 | 0.03594 | 0.1165 | 9135 | 0.9073 | -0.09671 | 0.1051 |
fixed | NA | sibling_count5 | -0.008956 | 0.03722 | -0.2406 | 8113 | 0.8098 | -0.1134 | 0.09551 |
fixed | NA | sibling_count>5 | 0.04878 | 0.02933 | 1.663 | 9175 | 0.09638 | -0.03356 | 0.1311 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2501 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9575 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.149 | 0.1738 | 6.615 | 11995 | 0.00000000003867 | 0.6617 | 1.637 |
fixed | NA | birth_order | 0.002926 | 0.003685 | 0.794 | 10092 | 0.4272 | -0.007419 | 0.01327 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09344 | 0.01682 | -5.555 | 11775 | 0.00000002835 | -0.1407 | -0.04622 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002438 | 0.0005005 | 4.871 | 11459 | 0.000001126 | 0.001033 | 0.003843 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001937 | 0.000004668 | -4.15 | 11169 | 0.00003342 | -0.00003248 | -0.000006271 |
fixed | NA | male | -0.2333 | 0.01776 | -13.14 | 12289 | 3.698e-39 | -0.2831 | -0.1834 |
fixed | NA | sibling_count3 | 0.002364 | 0.03509 | 0.06739 | 9936 | 0.9463 | -0.09613 | 0.1009 |
fixed | NA | sibling_count4 | 0.002011 | 0.03604 | 0.05579 | 9175 | 0.9555 | -0.09916 | 0.1032 |
fixed | NA | sibling_count5 | -0.01272 | 0.03751 | -0.3391 | 8187 | 0.7346 | -0.118 | 0.09258 |
fixed | NA | sibling_count>5 | 0.03741 | 0.03264 | 1.146 | 9887 | 0.2517 | -0.0542 | 0.129 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2494 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9577 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.134 | 0.1743 | 6.508 | 11992 | 0.00000000007936 | 0.645 | 1.623 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09246 | 0.01683 | -5.495 | 11783 | 0.00000003986 | -0.1397 | -0.04523 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002401 | 0.0005007 | 4.795 | 11465 | 0.000001648 | 0.0009953 | 0.003806 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001898 | 0.00000467 | -4.064 | 11162 | 0.00004865 | -0.00003208 | -0.000005868 |
fixed | NA | male | -0.2334 | 0.01776 | -13.14 | 12284 | 3.363e-39 | -0.2832 | -0.1835 |
fixed | NA | sibling_count3 | 0.00682 | 0.03566 | 0.1912 | 10217 | 0.8484 | -0.09329 | 0.1069 |
fixed | NA | sibling_count4 | 0.006205 | 0.03719 | 0.1669 | 9772 | 0.8675 | -0.09818 | 0.1106 |
fixed | NA | sibling_count5 | -0.01895 | 0.03919 | -0.4834 | 9054 | 0.6288 | -0.129 | 0.09107 |
fixed | NA | sibling_count>5 | 0.04327 | 0.03453 | 1.253 | 10833 | 0.2102 | -0.05366 | 0.1402 |
fixed | NA | birth_order_nonlinear2 | 0.03422 | 0.02611 | 1.311 | 11515 | 0.1899 | -0.03906 | 0.1075 |
fixed | NA | birth_order_nonlinear3 | -0.005286 | 0.0307 | -0.1722 | 11400 | 0.8633 | -0.09145 | 0.08088 |
fixed | NA | birth_order_nonlinear4 | 0.015 | 0.03513 | 0.4268 | 11505 | 0.6695 | -0.08362 | 0.1136 |
fixed | NA | birth_order_nonlinear5 | 0.08311 | 0.03947 | 2.106 | 11550 | 0.03526 | -0.02769 | 0.1939 |
fixed | NA | birth_order_nonlinear>5 | 0.009131 | 0.03275 | 0.2789 | 12349 | 0.7804 | -0.08279 | 0.101 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2505 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9573 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.152 | 0.175 | 6.581 | 11987 | 0.00000000004863 | 0.6604 | 1.643 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.09299 | 0.01682 | -5.528 | 11770 | 0.00000003299 | -0.1402 | -0.04577 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002411 | 0.0005005 | 4.817 | 11443 | 0.000001478 | 0.001006 | 0.003816 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001901 | 0.000004669 | -4.072 | 11131 | 0.00004694 | -0.00003212 | -0.000005906 |
fixed | NA | male | -0.2341 | 0.01775 | -13.19 | 12273 | 1.866e-39 | -0.2839 | -0.1843 |
fixed | NA | count_birth_order2/2 | 0.005908 | 0.05039 | 0.1173 | 11387 | 0.9067 | -0.1355 | 0.1473 |
fixed | NA | count_birth_order1/3 | -0.04965 | 0.04725 | -1.051 | 12312 | 0.2934 | -0.1823 | 0.08299 |
fixed | NA | count_birth_order2/3 | 0.02964 | 0.05332 | 0.5559 | 12329 | 0.5783 | -0.12 | 0.1793 |
fixed | NA | count_birth_order3/3 | 0.08396 | 0.05874 | 1.429 | 12340 | 0.1529 | -0.08092 | 0.2488 |
fixed | NA | count_birth_order1/4 | 0.05371 | 0.05395 | 0.9955 | 12331 | 0.3195 | -0.09773 | 0.2051 |
fixed | NA | count_birth_order2/4 | -0.01678 | 0.05658 | -0.2965 | 12334 | 0.7668 | -0.1756 | 0.1421 |
fixed | NA | count_birth_order3/4 | -0.09029 | 0.06134 | -1.472 | 12344 | 0.141 | -0.2625 | 0.08188 |
fixed | NA | count_birth_order4/4 | 0.07955 | 0.06589 | 1.207 | 12346 | 0.2273 | -0.1054 | 0.2645 |
fixed | NA | count_birth_order1/5 | -0.02778 | 0.062 | -0.4482 | 12343 | 0.654 | -0.2018 | 0.1462 |
fixed | NA | count_birth_order2/5 | 0.04518 | 0.06404 | 0.7054 | 12345 | 0.4806 | -0.1346 | 0.225 |
fixed | NA | count_birth_order3/5 | 0.01774 | 0.06616 | 0.2682 | 12347 | 0.7886 | -0.168 | 0.2034 |
fixed | NA | count_birth_order4/5 | -0.1898 | 0.06999 | -2.712 | 12347 | 0.006689 | -0.3863 | 0.006622 |
fixed | NA | count_birth_order5/5 | 0.1188 | 0.07047 | 1.686 | 12347 | 0.09189 | -0.07903 | 0.3166 |
fixed | NA | count_birth_order1/>5 | 0.02633 | 0.04975 | 0.5293 | 12347 | 0.5966 | -0.1133 | 0.166 |
fixed | NA | count_birth_order2/>5 | 0.1002 | 0.05139 | 1.949 | 12346 | 0.05127 | -0.04407 | 0.2444 |
fixed | NA | count_birth_order3/>5 | -0.006486 | 0.05003 | -0.1296 | 12346 | 0.8968 | -0.1469 | 0.1339 |
fixed | NA | count_birth_order4/>5 | 0.0823 | 0.049 | 1.68 | 12347 | 0.09304 | -0.05524 | 0.2198 |
fixed | NA | count_birth_order5/>5 | 0.09391 | 0.04895 | 1.919 | 12346 | 0.05505 | -0.04348 | 0.2313 |
fixed | NA | count_birth_order>5/>5 | 0.04251 | 0.03807 | 1.116 | 11430 | 0.2642 | -0.06437 | 0.1494 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2503 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9567 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 34828 | 34909 | -17403 | 34806 | NA | NA | NA |
12 | 34829 | 34918 | -17403 | 34805 | 0.6324 | 1 | 0.4265 |
16 | 34831 | 34949 | -17399 | 34799 | 6.352 | 4 | 0.1743 |
26 | 34825 | 35018 | -17386 | 34773 | 25.71 | 10 | 0.004149 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.577 | 0.4493 | 3.51 | 5320 | 0.000452 | 0.3158 | 2.838 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.134 | 0.05105 | -2.626 | 5322 | 0.008665 | -0.2773 | 0.009243 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003493 | 0.001825 | 1.914 | 5323 | 0.05565 | -0.001629 | 0.008614 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002836 | 0.0000207 | -1.37 | 5324 | 0.1708 | -0.00008648 | 0.00002975 |
fixed | NA | male | -0.2542 | 0.02616 | -9.717 | 5298 | 3.894e-22 | -0.3276 | -0.1808 |
fixed | NA | sibling_count3 | -0.01637 | 0.04026 | -0.4067 | 4232 | 0.6843 | -0.1294 | 0.09664 |
fixed | NA | sibling_count4 | 0.01001 | 0.04325 | 0.2314 | 3736 | 0.817 | -0.1114 | 0.1314 |
fixed | NA | sibling_count5 | 0.02769 | 0.04899 | 0.5652 | 3337 | 0.5719 | -0.1098 | 0.1652 |
fixed | NA | sibling_count>5 | 0.1299 | 0.04299 | 3.021 | 3120 | 0.002542 | 0.009186 | 0.2506 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2518 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9226 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.58 | 0.4494 | 3.516 | 5319 | 0.0004423 | 0.3185 | 2.841 |
fixed | NA | birth_order | -0.003278 | 0.008588 | -0.3817 | 5089 | 0.7027 | -0.02738 | 0.02083 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1339 | 0.05105 | -2.624 | 5321 | 0.008728 | -0.2772 | 0.009369 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003494 | 0.001825 | 1.915 | 5322 | 0.05557 | -0.001628 | 0.008616 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000285 | 0.00002071 | -1.376 | 5323 | 0.1688 | -0.00008663 | 0.00002963 |
fixed | NA | male | -0.2541 | 0.02616 | -9.71 | 5297 | 4.156e-22 | -0.3275 | -0.1806 |
fixed | NA | sibling_count3 | -0.01474 | 0.04049 | -0.3641 | 4234 | 0.7158 | -0.1284 | 0.09891 |
fixed | NA | sibling_count4 | 0.01385 | 0.0444 | 0.3118 | 3736 | 0.7552 | -0.1108 | 0.1385 |
fixed | NA | sibling_count5 | 0.03389 | 0.05161 | 0.6566 | 3384 | 0.5115 | -0.111 | 0.1788 |
fixed | NA | sibling_count>5 | 0.1424 | 0.05406 | 2.634 | 3552 | 0.00848 | -0.009364 | 0.2941 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2515 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9228 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.557 | 0.4502 | 3.459 | 5316 | 0.0005455 | 0.2937 | 2.821 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1325 | 0.05109 | -2.593 | 5317 | 0.009537 | -0.2759 | 0.01093 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003436 | 0.001826 | 1.881 | 5319 | 0.05999 | -0.001691 | 0.008563 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002774 | 0.00002073 | -1.338 | 5319 | 0.1808 | -0.00008593 | 0.00003045 |
fixed | NA | male | -0.2537 | 0.02617 | -9.693 | 5292 | 4.897e-22 | -0.3271 | -0.1802 |
fixed | NA | sibling_count3 | -0.02883 | 0.04149 | -0.6949 | 4391 | 0.4872 | -0.1453 | 0.08763 |
fixed | NA | sibling_count4 | 0.003924 | 0.04641 | 0.08454 | 4052 | 0.9326 | -0.1264 | 0.1342 |
fixed | NA | sibling_count5 | 0.01893 | 0.05466 | 0.3463 | 3814 | 0.7291 | -0.1345 | 0.1724 |
fixed | NA | sibling_count>5 | 0.1267 | 0.05591 | 2.266 | 3862 | 0.02349 | -0.03024 | 0.2836 |
fixed | NA | birth_order_nonlinear2 | 0.01925 | 0.03437 | 0.5601 | 4676 | 0.5755 | -0.07722 | 0.1157 |
fixed | NA | birth_order_nonlinear3 | 0.05381 | 0.04222 | 1.274 | 4855 | 0.2026 | -0.06472 | 0.1723 |
fixed | NA | birth_order_nonlinear4 | -0.02119 | 0.05203 | -0.4073 | 4967 | 0.6838 | -0.1672 | 0.1248 |
fixed | NA | birth_order_nonlinear5 | 0.03094 | 0.0651 | 0.4752 | 4899 | 0.6346 | -0.1518 | 0.2137 |
fixed | NA | birth_order_nonlinear>5 | -0.00119 | 0.06463 | -0.01842 | 5316 | 0.9853 | -0.1826 | 0.1802 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2539 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9223 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.526 | 0.4507 | 3.385 | 5306 | 0.0007173 | 0.2604 | 2.791 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1286 | 0.05114 | -2.514 | 5307 | 0.01198 | -0.2721 | 0.015 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003327 | 0.001828 | 1.82 | 5308 | 0.06888 | -0.001805 | 0.008458 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002686 | 0.00002075 | -1.294 | 5309 | 0.1956 | -0.00008511 | 0.00003139 |
fixed | NA | male | -0.2536 | 0.02619 | -9.683 | 5280 | 5.417e-22 | -0.3271 | -0.1801 |
fixed | NA | count_birth_order2/2 | -0.008658 | 0.06139 | -0.141 | 4803 | 0.8879 | -0.181 | 0.1637 |
fixed | NA | count_birth_order1/3 | -0.1013 | 0.05393 | -1.878 | 5302 | 0.06041 | -0.2527 | 0.05009 |
fixed | NA | count_birth_order2/3 | 0.01465 | 0.05898 | 0.2484 | 5308 | 0.8039 | -0.1509 | 0.1802 |
fixed | NA | count_birth_order3/3 | 0.08765 | 0.06512 | 1.346 | 5309 | 0.1783 | -0.09513 | 0.2704 |
fixed | NA | count_birth_order1/4 | 0.05273 | 0.06664 | 0.7913 | 5305 | 0.4288 | -0.1343 | 0.2398 |
fixed | NA | count_birth_order2/4 | -0.01304 | 0.06801 | -0.1917 | 5309 | 0.848 | -0.204 | 0.1779 |
fixed | NA | count_birth_order3/4 | -0.04041 | 0.07259 | -0.5568 | 5306 | 0.5777 | -0.2442 | 0.1633 |
fixed | NA | count_birth_order4/4 | 0.02005 | 0.07383 | 0.2715 | 5306 | 0.786 | -0.1872 | 0.2273 |
fixed | NA | count_birth_order1/5 | 0.1057 | 0.08996 | 1.175 | 5309 | 0.2401 | -0.1468 | 0.3582 |
fixed | NA | count_birth_order2/5 | -0.01872 | 0.09657 | -0.1939 | 5304 | 0.8463 | -0.2898 | 0.2524 |
fixed | NA | count_birth_order3/5 | 0.02719 | 0.0897 | 0.3031 | 5301 | 0.7618 | -0.2246 | 0.279 |
fixed | NA | count_birth_order4/5 | 0.0244 | 0.08554 | 0.2853 | 5305 | 0.7754 | -0.2157 | 0.2645 |
fixed | NA | count_birth_order5/5 | -0.02271 | 0.08904 | -0.2551 | 5301 | 0.7987 | -0.2726 | 0.2272 |
fixed | NA | count_birth_order1/>5 | 0.1101 | 0.09201 | 1.197 | 5309 | 0.2315 | -0.1482 | 0.3684 |
fixed | NA | count_birth_order2/>5 | 0.1728 | 0.08828 | 1.957 | 5308 | 0.05037 | -0.07502 | 0.4206 |
fixed | NA | count_birth_order3/>5 | 0.1931 | 0.08797 | 2.195 | 5304 | 0.0282 | -0.05383 | 0.44 |
fixed | NA | count_birth_order4/>5 | -0.004091 | 0.08442 | -0.04846 | 5298 | 0.9614 | -0.2411 | 0.2329 |
fixed | NA | count_birth_order5/>5 | 0.1929 | 0.07866 | 2.452 | 5297 | 0.01425 | -0.02796 | 0.4137 |
fixed | NA | count_birth_order>5/>5 | 0.1152 | 0.05806 | 1.985 | 4842 | 0.04723 | -0.04774 | 0.2782 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2554 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9215 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14660 | 14732 | -7319 | 14638 | NA | NA | NA |
12 | 14661 | 14740 | -7319 | 14637 | 0.1468 | 1 | 0.7016 |
16 | 14667 | 14772 | -7317 | 14635 | 2.604 | 4 | 0.6262 |
26 | 14672 | 14844 | -7310 | 14620 | 14.37 | 10 | 0.1569 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.549 | 0.4478 | 3.46 | 5369 | 0.0005442 | 0.2924 | 2.806 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1301 | 0.05091 | -2.555 | 5371 | 0.01064 | -0.273 | 0.01282 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003384 | 0.00182 | 1.859 | 5372 | 0.06307 | -0.001725 | 0.008493 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002719 | 0.00002066 | -1.316 | 5373 | 0.1882 | -0.00008517 | 0.0000308 |
fixed | NA | male | -0.2574 | 0.02605 | -9.882 | 5346 | 7.785e-23 | -0.3305 | -0.1843 |
fixed | NA | sibling_count3 | -0.03451 | 0.04357 | -0.792 | 4369 | 0.4284 | -0.1568 | 0.0878 |
fixed | NA | sibling_count4 | -0.03854 | 0.04574 | -0.8425 | 3984 | 0.3995 | -0.1669 | 0.08985 |
fixed | NA | sibling_count5 | 0.02241 | 0.04858 | 0.4612 | 3611 | 0.6447 | -0.114 | 0.1588 |
fixed | NA | sibling_count>5 | 0.0725 | 0.04271 | 1.697 | 3685 | 0.08972 | -0.0474 | 0.1924 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2535 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9221 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.545 | 0.4479 | 3.45 | 5368 | 0.0005658 | 0.2878 | 2.802 |
fixed | NA | birth_order | 0.003578 | 0.007458 | 0.4798 | 4894 | 0.6314 | -0.01736 | 0.02451 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1301 | 0.05091 | -2.555 | 5370 | 0.01065 | -0.273 | 0.01284 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003378 | 0.00182 | 1.856 | 5371 | 0.06357 | -0.001732 | 0.008487 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002699 | 0.00002066 | -1.306 | 5372 | 0.1916 | -0.00008499 | 0.00003102 |
fixed | NA | male | -0.2575 | 0.02605 | -9.886 | 5345 | 7.537e-23 | -0.3307 | -0.1844 |
fixed | NA | sibling_count3 | -0.03628 | 0.04373 | -0.8296 | 4365 | 0.4068 | -0.159 | 0.08648 |
fixed | NA | sibling_count4 | -0.04254 | 0.0465 | -0.9149 | 3969 | 0.3603 | -0.1731 | 0.08798 |
fixed | NA | sibling_count5 | 0.01616 | 0.0503 | 0.3213 | 3609 | 0.748 | -0.125 | 0.1574 |
fixed | NA | sibling_count>5 | 0.0592 | 0.05092 | 1.163 | 3896 | 0.245 | -0.08372 | 0.2021 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2537 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9222 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.522 | 0.4487 | 3.392 | 5366 | 0.0006988 | 0.2625 | 2.781 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.128 | 0.05094 | -2.513 | 5367 | 0.01201 | -0.271 | 0.015 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003294 | 0.001822 | 1.808 | 5368 | 0.07066 | -0.00182 | 0.008407 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002588 | 0.00002068 | -1.252 | 5368 | 0.2108 | -0.00008393 | 0.00003217 |
fixed | NA | male | -0.2576 | 0.02605 | -9.888 | 5340 | 7.394e-23 | -0.3307 | -0.1844 |
fixed | NA | sibling_count3 | -0.05732 | 0.04465 | -1.284 | 4491 | 0.1994 | -0.1827 | 0.06803 |
fixed | NA | sibling_count4 | -0.06546 | 0.04836 | -1.354 | 4231 | 0.1759 | -0.2012 | 0.07029 |
fixed | NA | sibling_count5 | -0.0008842 | 0.05303 | -0.01667 | 3990 | 0.9867 | -0.1497 | 0.148 |
fixed | NA | sibling_count>5 | 0.0348 | 0.05268 | 0.6606 | 4203 | 0.5089 | -0.1131 | 0.1827 |
fixed | NA | birth_order_nonlinear2 | 0.03458 | 0.03489 | 0.9911 | 4780 | 0.3217 | -0.06336 | 0.1325 |
fixed | NA | birth_order_nonlinear3 | 0.09857 | 0.04209 | 2.342 | 4959 | 0.01921 | -0.01957 | 0.2167 |
fixed | NA | birth_order_nonlinear4 | 0.0352 | 0.05032 | 0.6995 | 5072 | 0.4843 | -0.1061 | 0.1765 |
fixed | NA | birth_order_nonlinear5 | 0.003997 | 0.06168 | 0.06481 | 5041 | 0.9483 | -0.1691 | 0.1771 |
fixed | NA | birth_order_nonlinear>5 | 0.07155 | 0.05752 | 1.244 | 5334 | 0.2136 | -0.08993 | 0.233 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2558 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9214 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.49 | 0.4492 | 3.317 | 5356 | 0.0009158 | 0.2291 | 2.751 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1225 | 0.05098 | -2.404 | 5356 | 0.01627 | -0.2656 | 0.02057 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003108 | 0.001823 | 1.705 | 5357 | 0.08829 | -0.002009 | 0.008225 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002392 | 0.0000207 | -1.156 | 5358 | 0.2478 | -0.00008202 | 0.00003418 |
fixed | NA | male | -0.2572 | 0.02606 | -9.871 | 5329 | 8.746e-23 | -0.3304 | -0.1841 |
fixed | NA | count_birth_order2/2 | -0.01902 | 0.06687 | -0.2844 | 4888 | 0.7761 | -0.2067 | 0.1687 |
fixed | NA | count_birth_order1/3 | -0.1438 | 0.05846 | -2.46 | 5351 | 0.01392 | -0.3079 | 0.02028 |
fixed | NA | count_birth_order2/3 | 0.003974 | 0.06319 | 0.0629 | 5356 | 0.9498 | -0.1734 | 0.1813 |
fixed | NA | count_birth_order3/3 | 0.08898 | 0.0708 | 1.257 | 5358 | 0.2089 | -0.1098 | 0.2877 |
fixed | NA | count_birth_order1/4 | -0.01275 | 0.06936 | -0.1838 | 5355 | 0.8541 | -0.2074 | 0.1819 |
fixed | NA | count_birth_order2/4 | -0.1237 | 0.07019 | -1.762 | 5358 | 0.07817 | -0.3207 | 0.07337 |
fixed | NA | count_birth_order3/4 | -0.04247 | 0.07755 | -0.5477 | 5356 | 0.5839 | -0.2601 | 0.1752 |
fixed | NA | count_birth_order4/4 | 0.01075 | 0.07811 | 0.1376 | 5356 | 0.8905 | -0.2085 | 0.23 |
fixed | NA | count_birth_order1/5 | 0.01399 | 0.08174 | 0.1712 | 5358 | 0.8641 | -0.2154 | 0.2434 |
fixed | NA | count_birth_order2/5 | 0.009527 | 0.08838 | 0.1078 | 5356 | 0.9142 | -0.2386 | 0.2576 |
fixed | NA | count_birth_order3/5 | 0.1061 | 0.08479 | 1.251 | 5354 | 0.211 | -0.1319 | 0.3441 |
fixed | NA | count_birth_order4/5 | 0.02947 | 0.08793 | 0.3351 | 5351 | 0.7375 | -0.2174 | 0.2763 |
fixed | NA | count_birth_order5/5 | -0.0916 | 0.08745 | -1.047 | 5349 | 0.295 | -0.3371 | 0.1539 |
fixed | NA | count_birth_order1/>5 | 0.001461 | 0.07901 | 0.01849 | 5357 | 0.9852 | -0.2203 | 0.2233 |
fixed | NA | count_birth_order2/>5 | 0.1332 | 0.08149 | 1.635 | 5357 | 0.1021 | -0.0955 | 0.362 |
fixed | NA | count_birth_order3/>5 | 0.06555 | 0.08021 | 0.8172 | 5354 | 0.4139 | -0.1596 | 0.2907 |
fixed | NA | count_birth_order4/>5 | -0.01491 | 0.07757 | -0.1922 | 5351 | 0.8476 | -0.2326 | 0.2028 |
fixed | NA | count_birth_order5/>5 | 0.07852 | 0.07906 | 0.9931 | 5342 | 0.3207 | -0.1434 | 0.3004 |
fixed | NA | count_birth_order>5/>5 | 0.08841 | 0.05687 | 1.555 | 4983 | 0.1201 | -0.07122 | 0.248 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2571 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9206 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14794 | 14866 | -7386 | 14772 | NA | NA | NA |
12 | 14796 | 14875 | -7386 | 14772 | 0.2304 | 1 | 0.6312 |
16 | 14797 | 14903 | -7383 | 14765 | 6.297 | 4 | 0.178 |
26 | 14802 | 14973 | -7375 | 14750 | 15.5 | 10 | 0.1149 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.476 | 0.455 | 3.243 | 5219 | 0.00119 | 0.1984 | 2.753 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1219 | 0.05172 | -2.358 | 5221 | 0.01842 | -0.2671 | 0.02323 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003027 | 0.00185 | 1.637 | 5222 | 0.1018 | -0.002165 | 0.008219 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002277 | 0.00002101 | -1.084 | 5223 | 0.2784 | -0.00008173 | 0.00003619 |
fixed | NA | male | -0.259 | 0.02642 | -9.801 | 5196 | 1.743e-22 | -0.3331 | -0.1848 |
fixed | NA | sibling_count3 | -0.01595 | 0.03977 | -0.4011 | 4134 | 0.6884 | -0.1276 | 0.09568 |
fixed | NA | sibling_count4 | 0.002577 | 0.04305 | 0.05986 | 3673 | 0.9523 | -0.1183 | 0.1234 |
fixed | NA | sibling_count5 | 0.06957 | 0.05029 | 1.383 | 3182 | 0.1666 | -0.07159 | 0.2107 |
fixed | NA | sibling_count>5 | 0.1304 | 0.04352 | 2.997 | 2969 | 0.002745 | 0.008285 | 0.2526 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.255 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.922 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.477 | 0.4551 | 3.246 | 5218 | 0.001177 | 0.1999 | 2.755 |
fixed | NA | birth_order | -0.002007 | 0.008824 | -0.2275 | 5012 | 0.8201 | -0.02678 | 0.02276 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1219 | 0.05173 | -2.356 | 5220 | 0.01851 | -0.2671 | 0.02333 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003028 | 0.00185 | 1.637 | 5221 | 0.1017 | -0.002165 | 0.00822 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002285 | 0.00002101 | -1.088 | 5222 | 0.2768 | -0.00008183 | 0.00003612 |
fixed | NA | male | -0.2589 | 0.02643 | -9.798 | 5195 | 1.79e-22 | -0.3331 | -0.1847 |
fixed | NA | sibling_count3 | -0.01493 | 0.04002 | -0.3731 | 4132 | 0.7091 | -0.1273 | 0.09741 |
fixed | NA | sibling_count4 | 0.004905 | 0.04426 | 0.1108 | 3679 | 0.9118 | -0.1193 | 0.1291 |
fixed | NA | sibling_count5 | 0.0732 | 0.05277 | 1.387 | 3230 | 0.1655 | -0.07492 | 0.2213 |
fixed | NA | sibling_count>5 | 0.1381 | 0.0549 | 2.515 | 3487 | 0.01196 | -0.01605 | 0.2922 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2549 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9221 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.46 | 0.4559 | 3.203 | 5215 | 0.00137 | 0.1803 | 2.74 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1207 | 0.05177 | -2.332 | 5217 | 0.01975 | -0.266 | 0.0246 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002979 | 0.001851 | 1.609 | 5217 | 0.1077 | -0.002218 | 0.008176 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002217 | 0.00002103 | -1.054 | 5218 | 0.2918 | -0.0000812 | 0.00003686 |
fixed | NA | male | -0.2584 | 0.02643 | -9.775 | 5190 | 2.242e-22 | -0.3326 | -0.1842 |
fixed | NA | sibling_count3 | -0.02704 | 0.04106 | -0.6587 | 4293 | 0.5101 | -0.1423 | 0.0882 |
fixed | NA | sibling_count4 | -0.002276 | 0.04631 | -0.04916 | 3991 | 0.9608 | -0.1323 | 0.1277 |
fixed | NA | sibling_count5 | 0.06283 | 0.0556 | 1.13 | 3618 | 0.2585 | -0.09323 | 0.2189 |
fixed | NA | sibling_count>5 | 0.1202 | 0.05686 | 2.113 | 3802 | 0.03465 | -0.03945 | 0.2798 |
fixed | NA | birth_order_nonlinear2 | 0.01531 | 0.03429 | 0.4465 | 4577 | 0.6553 | -0.08093 | 0.1115 |
fixed | NA | birth_order_nonlinear3 | 0.04702 | 0.04216 | 1.115 | 4732 | 0.2647 | -0.07132 | 0.1654 |
fixed | NA | birth_order_nonlinear4 | -0.02296 | 0.05335 | -0.4304 | 4862 | 0.6669 | -0.1727 | 0.1268 |
fixed | NA | birth_order_nonlinear5 | 0.02594 | 0.06801 | 0.3815 | 4794 | 0.7029 | -0.165 | 0.2168 |
fixed | NA | birth_order_nonlinear>5 | 0.01797 | 0.0667 | 0.2694 | 5217 | 0.7877 | -0.1693 | 0.2052 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2571 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9217 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.418 | 0.4564 | 3.108 | 5205 | 0.001896 | 0.1372 | 2.699 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1144 | 0.05181 | -2.207 | 5206 | 0.02734 | -0.2598 | 0.03107 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002775 | 0.001853 | 1.497 | 5207 | 0.1343 | -0.002427 | 0.007976 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002013 | 0.00002105 | -0.9565 | 5208 | 0.3388 | -0.00007922 | 0.00003895 |
fixed | NA | male | -0.2579 | 0.02644 | -9.756 | 5178 | 2.713e-22 | -0.3322 | -0.1837 |
fixed | NA | count_birth_order2/2 | -0.03894 | 0.05986 | -0.6506 | 4693 | 0.5154 | -0.207 | 0.1291 |
fixed | NA | count_birth_order1/3 | -0.1122 | 0.05335 | -2.103 | 5200 | 0.03548 | -0.262 | 0.03754 |
fixed | NA | count_birth_order2/3 | -0.005963 | 0.05896 | -0.1011 | 5208 | 0.9194 | -0.1715 | 0.1595 |
fixed | NA | count_birth_order3/3 | 0.0912 | 0.06371 | 1.432 | 5207 | 0.1523 | -0.08763 | 0.27 |
fixed | NA | count_birth_order1/4 | 0.0365 | 0.06697 | 0.5451 | 5206 | 0.5857 | -0.1515 | 0.2245 |
fixed | NA | count_birth_order2/4 | 0.00438 | 0.06821 | 0.06421 | 5208 | 0.9488 | -0.1871 | 0.1959 |
fixed | NA | count_birth_order3/4 | -0.08139 | 0.07209 | -1.129 | 5203 | 0.259 | -0.2838 | 0.121 |
fixed | NA | count_birth_order4/4 | -0.01876 | 0.07401 | -0.2534 | 5202 | 0.7999 | -0.2265 | 0.189 |
fixed | NA | count_birth_order1/5 | 0.1228 | 0.09013 | 1.362 | 5208 | 0.1733 | -0.1303 | 0.3758 |
fixed | NA | count_birth_order2/5 | 0.01063 | 0.09959 | 0.1067 | 5202 | 0.915 | -0.2689 | 0.2902 |
fixed | NA | count_birth_order3/5 | 0.05929 | 0.09337 | 0.6351 | 5199 | 0.5254 | -0.2028 | 0.3214 |
fixed | NA | count_birth_order4/5 | 0.09376 | 0.09014 | 1.04 | 5203 | 0.2983 | -0.1593 | 0.3468 |
fixed | NA | count_birth_order5/5 | -0.02808 | 0.09563 | -0.2937 | 5199 | 0.769 | -0.2965 | 0.2404 |
fixed | NA | count_birth_order1/>5 | 0.08835 | 0.09431 | 0.9368 | 5207 | 0.3489 | -0.1764 | 0.3531 |
fixed | NA | count_birth_order2/>5 | 0.1599 | 0.09032 | 1.771 | 5206 | 0.07668 | -0.0936 | 0.4134 |
fixed | NA | count_birth_order3/>5 | 0.1489 | 0.08977 | 1.659 | 5200 | 0.09721 | -0.1031 | 0.4009 |
fixed | NA | count_birth_order4/>5 | -0.02845 | 0.0881 | -0.3229 | 5193 | 0.7468 | -0.2757 | 0.2188 |
fixed | NA | count_birth_order5/>5 | 0.1909 | 0.08075 | 2.365 | 5193 | 0.01809 | -0.03573 | 0.4176 |
fixed | NA | count_birth_order>5/>5 | 0.119 | 0.05923 | 2.01 | 4696 | 0.0445 | -0.04721 | 0.2853 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2591 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9205 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14385 | 14457 | -7181 | 14363 | NA | NA | NA |
12 | 14386 | 14465 | -7181 | 14362 | 0.05235 | 1 | 0.819 |
16 | 14392 | 14497 | -7180 | 14360 | 2.057 | 4 | 0.7253 |
26 | 14395 | 14565 | -7171 | 14343 | 17.69 | 10 | 0.06035 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = riskB)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3885 | 0.1683 | 2.309 | 12765 | 0.02098 | -0.08389 | 0.861 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02493 | 0.01621 | -1.537 | 12562 | 0.1242 | -0.07044 | 0.02058 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007458 | 0.0004805 | 1.552 | 12293 | 0.1206 | -0.0006029 | 0.002095 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000007326 | 0.000004462 | -1.642 | 12042 | 0.1007 | -0.00001985 | 0.000005199 |
fixed | NA | male | -0.1892 | 0.01731 | -10.93 | 13119 | 1.054e-27 | -0.2378 | -0.1406 |
fixed | NA | sibling_count3 | -0.02192 | 0.03395 | -0.6458 | 10321 | 0.5184 | -0.1172 | 0.07337 |
fixed | NA | sibling_count4 | -0.00809 | 0.03496 | -0.2314 | 9498 | 0.817 | -0.1062 | 0.09005 |
fixed | NA | sibling_count5 | -0.03174 | 0.03599 | -0.8819 | 8323 | 0.3779 | -0.1328 | 0.06929 |
fixed | NA | sibling_count>5 | -0.04519 | 0.0285 | -1.586 | 9488 | 0.1129 | -0.1252 | 0.03481 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2164 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.969 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3874 | 0.1683 | 2.301 | 12768 | 0.02139 | -0.08514 | 0.8599 |
fixed | NA | birth_order | -0.001201 | 0.003596 | -0.3339 | 10334 | 0.7384 | -0.0113 | 0.008894 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02453 | 0.01626 | -1.509 | 12531 | 0.1314 | -0.07017 | 0.02111 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000732 | 0.0004823 | 1.518 | 12211 | 0.1291 | -0.0006218 | 0.002086 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000072 | 0.000004478 | -1.608 | 11938 | 0.1079 | -0.00001977 | 0.00000537 |
fixed | NA | male | -0.1892 | 0.01731 | -10.93 | 13118 | 1.098e-27 | -0.2377 | -0.1406 |
fixed | NA | sibling_count3 | -0.02161 | 0.03396 | -0.6363 | 10335 | 0.5246 | -0.1169 | 0.07372 |
fixed | NA | sibling_count4 | -0.007222 | 0.03506 | -0.206 | 9548 | 0.8368 | -0.1056 | 0.09119 |
fixed | NA | sibling_count5 | -0.03024 | 0.03627 | -0.8337 | 8416 | 0.4045 | -0.1321 | 0.07158 |
fixed | NA | sibling_count>5 | -0.04059 | 0.03166 | -1.282 | 10305 | 0.1999 | -0.1295 | 0.04829 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2165 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.969 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.3921 | 0.1689 | 2.321 | 12768 | 0.02028 | -0.082 | 0.8661 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02604 | 0.01627 | -1.601 | 12546 | 0.1095 | -0.0717 | 0.01962 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007753 | 0.0004825 | 1.607 | 12226 | 0.1081 | -0.000579 | 0.00213 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000007514 | 0.00000448 | -1.677 | 11940 | 0.09356 | -0.00002009 | 0.000005063 |
fixed | NA | male | -0.1895 | 0.01731 | -10.95 | 13113 | 9.203e-28 | -0.238 | -0.1409 |
fixed | NA | sibling_count3 | -0.03004 | 0.0345 | -0.8706 | 10641 | 0.384 | -0.1269 | 0.06681 |
fixed | NA | sibling_count4 | -0.01974 | 0.03616 | -0.546 | 10203 | 0.5851 | -0.1212 | 0.08175 |
fixed | NA | sibling_count5 | -0.04581 | 0.0379 | -1.209 | 9357 | 0.2268 | -0.1522 | 0.06057 |
fixed | NA | sibling_count>5 | -0.06451 | 0.03346 | -1.928 | 11369 | 0.05388 | -0.1584 | 0.02941 |
fixed | NA | birth_order_nonlinear2 | 0.01757 | 0.02529 | 0.6947 | 12145 | 0.4873 | -0.05343 | 0.08857 |
fixed | NA | birth_order_nonlinear3 | 0.04294 | 0.02996 | 1.433 | 12111 | 0.1519 | -0.04117 | 0.127 |
fixed | NA | birth_order_nonlinear4 | 0.02767 | 0.03418 | 0.8097 | 12211 | 0.4182 | -0.06827 | 0.1236 |
fixed | NA | birth_order_nonlinear5 | 0.0263 | 0.03854 | 0.6825 | 12265 | 0.4949 | -0.08188 | 0.1345 |
fixed | NA | birth_order_nonlinear>5 | 0.03267 | 0.03179 | 1.028 | 13117 | 0.3041 | -0.05657 | 0.1219 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.217 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.969 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4261 | 0.1695 | 2.513 | 12765 | 0.01197 | -0.04979 | 0.9021 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.02658 | 0.01626 | -1.635 | 12534 | 0.1022 | -0.07222 | 0.01907 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0007872 | 0.0004824 | 1.632 | 12206 | 0.1027 | -0.0005668 | 0.002141 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000757 | 0.00000448 | -1.69 | 11909 | 0.09112 | -0.00002015 | 0.000005006 |
fixed | NA | male | -0.1896 | 0.0173 | -10.96 | 13103 | 8.252e-28 | -0.2381 | -0.141 |
fixed | NA | count_birth_order2/2 | -0.05705 | 0.04918 | -1.16 | 11911 | 0.246 | -0.1951 | 0.08099 |
fixed | NA | count_birth_order1/3 | -0.1249 | 0.04595 | -2.718 | 13109 | 0.006575 | -0.2539 | 0.004088 |
fixed | NA | count_birth_order2/3 | 0.0004879 | 0.05123 | 0.009525 | 13120 | 0.9924 | -0.1433 | 0.1443 |
fixed | NA | count_birth_order3/3 | 0.06406 | 0.05765 | 1.111 | 13131 | 0.2665 | -0.09777 | 0.2259 |
fixed | NA | count_birth_order1/4 | 0.03162 | 0.05249 | 0.6024 | 13122 | 0.547 | -0.1157 | 0.179 |
fixed | NA | count_birth_order2/4 | -0.04005 | 0.05544 | -0.7225 | 13125 | 0.47 | -0.1957 | 0.1156 |
fixed | NA | count_birth_order3/4 | -0.1284 | 0.06086 | -2.109 | 13132 | 0.03494 | -0.2992 | 0.04246 |
fixed | NA | count_birth_order4/4 | -0.001447 | 0.06385 | -0.02266 | 13134 | 0.9819 | -0.1807 | 0.1778 |
fixed | NA | count_birth_order1/5 | -0.1393 | 0.05994 | -2.324 | 13132 | 0.02014 | -0.3076 | 0.02895 |
fixed | NA | count_birth_order2/5 | -0.06536 | 0.06223 | -1.05 | 13134 | 0.2936 | -0.24 | 0.1093 |
fixed | NA | count_birth_order3/5 | 0.00197 | 0.06385 | 0.03086 | 13135 | 0.9754 | -0.1773 | 0.1812 |
fixed | NA | count_birth_order4/5 | -0.05504 | 0.06836 | -0.8053 | 13136 | 0.4207 | -0.2469 | 0.1368 |
fixed | NA | count_birth_order5/5 | 0.03196 | 0.06921 | 0.4618 | 13136 | 0.6442 | -0.1623 | 0.2262 |
fixed | NA | count_birth_order1/>5 | -0.08178 | 0.04827 | -1.694 | 13134 | 0.09023 | -0.2173 | 0.05371 |
fixed | NA | count_birth_order2/>5 | -0.05255 | 0.04983 | -1.055 | 13136 | 0.2917 | -0.1924 | 0.08733 |
fixed | NA | count_birth_order3/>5 | -0.04667 | 0.04888 | -0.9549 | 13136 | 0.3396 | -0.1839 | 0.09053 |
fixed | NA | count_birth_order4/>5 | -0.06846 | 0.04795 | -1.428 | 13136 | 0.1534 | -0.2031 | 0.06614 |
fixed | NA | count_birth_order5/>5 | -0.09239 | 0.04793 | -1.928 | 13136 | 0.0539 | -0.2269 | 0.04214 |
fixed | NA | count_birth_order>5/>5 | -0.05918 | 0.03721 | -1.591 | 12080 | 0.1117 | -0.1636 | 0.04525 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2169 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9685 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 37149 | 37232 | -18564 | 37127 | NA | NA | NA |
12 | 37151 | 37241 | -18564 | 37127 | 0.1115 | 1 | 0.7384 |
16 | 37157 | 37277 | -18562 | 37125 | 2.188 | 4 | 0.7013 |
26 | 37153 | 37348 | -18550 | 37101 | 23.98 | 10 | 0.007645 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.049 | 0.4283 | 2.45 | 5592 | 0.01433 | -0.1531 | 2.251 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0891 | 0.04851 | -1.837 | 5584 | 0.06632 | -0.2253 | 0.04708 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002848 | 0.001728 | 1.648 | 5571 | 0.09949 | -0.002004 | 0.007699 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000287 | 0.00001954 | -1.469 | 5551 | 0.1419 | -0.00008354 | 0.00002614 |
fixed | NA | male | -0.2247 | 0.02515 | -8.938 | 5596 | 5.295e-19 | -0.2953 | -0.1542 |
fixed | NA | sibling_count3 | -0.07825 | 0.03816 | -2.051 | 4405 | 0.04037 | -0.1854 | 0.02887 |
fixed | NA | sibling_count4 | -0.02742 | 0.04083 | -0.6716 | 3811 | 0.5019 | -0.142 | 0.08719 |
fixed | NA | sibling_count5 | -0.05557 | 0.04624 | -1.202 | 3280 | 0.2295 | -0.1854 | 0.07422 |
fixed | NA | sibling_count>5 | -0.01853 | 0.04043 | -0.4583 | 2939 | 0.6468 | -0.132 | 0.09495 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1238 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9313 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.052 | 0.4284 | 2.455 | 5591 | 0.01413 | -0.151 | 2.254 |
fixed | NA | birth_order | -0.00229 | 0.008256 | -0.2774 | 5083 | 0.7815 | -0.02547 | 0.02089 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08908 | 0.04852 | -1.836 | 5583 | 0.0664 | -0.2253 | 0.04711 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002851 | 0.001729 | 1.649 | 5570 | 0.09911 | -0.002001 | 0.007703 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002882 | 0.00001954 | -1.475 | 5550 | 0.1403 | -0.00008368 | 0.00002604 |
fixed | NA | male | -0.2247 | 0.02515 | -8.934 | 5595 | 5.493e-19 | -0.2953 | -0.1541 |
fixed | NA | sibling_count3 | -0.07714 | 0.03837 | -2.011 | 4401 | 0.04443 | -0.1848 | 0.03056 |
fixed | NA | sibling_count4 | -0.02485 | 0.04188 | -0.5933 | 3796 | 0.553 | -0.1424 | 0.0927 |
fixed | NA | sibling_count5 | -0.05135 | 0.04868 | -1.055 | 3318 | 0.2916 | -0.188 | 0.08531 |
fixed | NA | sibling_count>5 | -0.01003 | 0.05071 | -0.1979 | 3400 | 0.8431 | -0.1524 | 0.1323 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1234 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9315 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.026 | 0.429 | 2.391 | 5586 | 0.01685 | -0.1786 | 2.23 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08819 | 0.04855 | -1.816 | 5578 | 0.06936 | -0.2245 | 0.04809 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002811 | 0.00173 | 1.625 | 5564 | 0.1042 | -0.002045 | 0.007667 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002829 | 0.00001956 | -1.446 | 5544 | 0.1482 | -0.00008319 | 0.00002662 |
fixed | NA | male | -0.2244 | 0.02515 | -8.92 | 5591 | 6.231e-19 | -0.295 | -0.1538 |
fixed | NA | sibling_count3 | -0.08624 | 0.03928 | -2.196 | 4582 | 0.02817 | -0.1965 | 0.02402 |
fixed | NA | sibling_count4 | -0.03939 | 0.04378 | -0.8997 | 4151 | 0.3683 | -0.1623 | 0.08349 |
fixed | NA | sibling_count5 | -0.05825 | 0.05154 | -1.13 | 3794 | 0.2585 | -0.2029 | 0.08644 |
fixed | NA | sibling_count>5 | -0.0163 | 0.0524 | -0.311 | 3709 | 0.7558 | -0.1634 | 0.1308 |
fixed | NA | birth_order_nonlinear2 | 0.04954 | 0.03309 | 1.497 | 4885 | 0.1344 | -0.04333 | 0.1424 |
fixed | NA | birth_order_nonlinear3 | 0.03766 | 0.04077 | 0.9236 | 5141 | 0.3557 | -0.07679 | 0.1521 |
fixed | NA | birth_order_nonlinear4 | 0.03502 | 0.05007 | 0.6993 | 5284 | 0.4844 | -0.1055 | 0.1756 |
fixed | NA | birth_order_nonlinear5 | -0.02212 | 0.06288 | -0.3517 | 5282 | 0.7251 | -0.1986 | 0.1544 |
fixed | NA | birth_order_nonlinear>5 | 0.01008 | 0.06199 | 0.1626 | 5498 | 0.8709 | -0.1639 | 0.1841 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1225 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9316 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9659 | 0.4297 | 2.248 | 5576 | 0.02463 | -0.2403 | 2.172 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08106 | 0.04864 | -1.667 | 5569 | 0.09563 | -0.2176 | 0.05546 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002578 | 0.001733 | 1.487 | 5555 | 0.137 | -0.002287 | 0.007443 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002589 | 0.0000196 | -1.321 | 5535 | 0.1866 | -0.00008091 | 0.00002913 |
fixed | NA | male | -0.2227 | 0.02516 | -8.853 | 5581 | 1.127e-18 | -0.2934 | -0.1521 |
fixed | NA | count_birth_order2/2 | 0.02637 | 0.05933 | 0.4445 | 4955 | 0.6567 | -0.1402 | 0.1929 |
fixed | NA | count_birth_order1/3 | -0.1491 | 0.05167 | -2.885 | 5580 | 0.003932 | -0.2941 | -0.004016 |
fixed | NA | count_birth_order2/3 | -0.006833 | 0.05633 | -0.1213 | 5581 | 0.9035 | -0.165 | 0.1513 |
fixed | NA | count_birth_order3/3 | -0.005061 | 0.06322 | -0.08006 | 5581 | 0.9362 | -0.1825 | 0.1724 |
fixed | NA | count_birth_order1/4 | 0.007126 | 0.06334 | 0.1125 | 5579 | 0.9104 | -0.1707 | 0.1849 |
fixed | NA | count_birth_order2/4 | -0.03101 | 0.06571 | -0.4719 | 5581 | 0.637 | -0.2155 | 0.1534 |
fixed | NA | count_birth_order3/4 | -0.07549 | 0.06934 | -1.089 | 5580 | 0.2763 | -0.2701 | 0.1191 |
fixed | NA | count_birth_order4/4 | 0.02371 | 0.07167 | 0.3308 | 5580 | 0.7408 | -0.1775 | 0.2249 |
fixed | NA | count_birth_order1/5 | 0.0343 | 0.08707 | 0.3939 | 5581 | 0.6936 | -0.2101 | 0.2787 |
fixed | NA | count_birth_order2/5 | -0.1382 | 0.0915 | -1.511 | 5581 | 0.1309 | -0.3951 | 0.1186 |
fixed | NA | count_birth_order3/5 | 0.06142 | 0.08583 | 0.7156 | 5580 | 0.4743 | -0.1795 | 0.3024 |
fixed | NA | count_birth_order4/5 | -0.08468 | 0.08257 | -1.025 | 5580 | 0.3052 | -0.3165 | 0.1471 |
fixed | NA | count_birth_order5/5 | -0.1152 | 0.08712 | -1.322 | 5578 | 0.1861 | -0.3597 | 0.1293 |
fixed | NA | count_birth_order1/>5 | -0.05294 | 0.08612 | -0.6147 | 5566 | 0.5388 | -0.2947 | 0.1888 |
fixed | NA | count_birth_order2/>5 | 0.1103 | 0.08418 | 1.31 | 5572 | 0.1902 | -0.126 | 0.3466 |
fixed | NA | count_birth_order3/>5 | -0.07246 | 0.08492 | -0.8532 | 5580 | 0.3936 | -0.3108 | 0.1659 |
fixed | NA | count_birth_order4/>5 | 0.01143 | 0.07976 | 0.1433 | 5581 | 0.8861 | -0.2125 | 0.2353 |
fixed | NA | count_birth_order5/>5 | -0.02858 | 0.07532 | -0.3794 | 5581 | 0.7044 | -0.24 | 0.1828 |
fixed | NA | count_birth_order>5/>5 | -0.01489 | 0.05589 | -0.2664 | 4859 | 0.7899 | -0.1718 | 0.142 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1247 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9309 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15219 | 15292 | -7598 | 15197 | NA | NA | NA |
12 | 15221 | 15300 | -7598 | 15197 | 0.07815 | 1 | 0.7798 |
16 | 15226 | 15332 | -7597 | 15194 | 3.215 | 4 | 0.5226 |
26 | 15230 | 15403 | -7589 | 15178 | 15.45 | 10 | 0.1164 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.028 | 0.4272 | 2.407 | 5644 | 0.01612 | -0.171 | 2.228 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08594 | 0.04842 | -1.775 | 5635 | 0.07593 | -0.2218 | 0.04996 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00276 | 0.001725 | 1.6 | 5621 | 0.1098 | -0.002083 | 0.007603 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002778 | 0.00001951 | -1.424 | 5600 | 0.1544 | -0.00008253 | 0.00002697 |
fixed | NA | male | -0.2282 | 0.02506 | -9.107 | 5648 | 1.154e-19 | -0.2986 | -0.1579 |
fixed | NA | sibling_count3 | -0.09326 | 0.04133 | -2.256 | 4563 | 0.0241 | -0.2093 | 0.02276 |
fixed | NA | sibling_count4 | -0.05237 | 0.04336 | -1.208 | 4110 | 0.2272 | -0.1741 | 0.06934 |
fixed | NA | sibling_count5 | -0.05936 | 0.04608 | -1.288 | 3599 | 0.1978 | -0.1887 | 0.06999 |
fixed | NA | sibling_count>5 | -0.04957 | 0.04042 | -1.226 | 3618 | 0.2201 | -0.163 | 0.06388 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1245 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9322 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.03 | 0.4274 | 2.41 | 5642 | 0.016 | -0.1698 | 2.229 |
fixed | NA | birth_order | -0.00116 | 0.007178 | -0.1616 | 4714 | 0.8716 | -0.02131 | 0.01899 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08597 | 0.04842 | -1.775 | 5634 | 0.07587 | -0.2219 | 0.04995 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002763 | 0.001726 | 1.601 | 5620 | 0.1094 | -0.002081 | 0.007606 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002786 | 0.00001951 | -1.428 | 5598 | 0.1534 | -0.00008263 | 0.00002691 |
fixed | NA | male | -0.2282 | 0.02506 | -9.105 | 5647 | 1.174e-19 | -0.2985 | -0.1578 |
fixed | NA | sibling_count3 | -0.0927 | 0.04148 | -2.235 | 4555 | 0.02546 | -0.2091 | 0.02372 |
fixed | NA | sibling_count4 | -0.05113 | 0.04404 | -1.161 | 4077 | 0.2456 | -0.1747 | 0.07248 |
fixed | NA | sibling_count5 | -0.0574 | 0.04767 | -1.204 | 3578 | 0.2286 | -0.1912 | 0.07641 |
fixed | NA | sibling_count>5 | -0.04536 | 0.04809 | -0.9432 | 3823 | 0.3456 | -0.1803 | 0.08963 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1245 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9322 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.002 | 0.4279 | 2.342 | 5637 | 0.01922 | -0.199 | 2.203 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08492 | 0.04844 | -1.753 | 5629 | 0.07965 | -0.2209 | 0.05106 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002714 | 0.001726 | 1.572 | 5615 | 0.116 | -0.002132 | 0.00756 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002717 | 0.00001952 | -1.391 | 5593 | 0.1641 | -0.00008197 | 0.00002764 |
fixed | NA | male | -0.228 | 0.02506 | -9.096 | 5643 | 1.274e-19 | -0.2983 | -0.1576 |
fixed | NA | sibling_count3 | -0.1039 | 0.04233 | -2.456 | 4702 | 0.0141 | -0.2228 | 0.01487 |
fixed | NA | sibling_count4 | -0.06911 | 0.04576 | -1.51 | 4366 | 0.131 | -0.1976 | 0.05934 |
fixed | NA | sibling_count5 | -0.0629 | 0.05026 | -1.251 | 4013 | 0.2108 | -0.204 | 0.07818 |
fixed | NA | sibling_count>5 | -0.05826 | 0.04978 | -1.17 | 4167 | 0.2419 | -0.198 | 0.08147 |
fixed | NA | birth_order_nonlinear2 | 0.05573 | 0.03362 | 1.657 | 5001 | 0.0975 | -0.03866 | 0.1501 |
fixed | NA | birth_order_nonlinear3 | 0.04984 | 0.04063 | 1.227 | 5251 | 0.2201 | -0.06422 | 0.1639 |
fixed | NA | birth_order_nonlinear4 | 0.04656 | 0.04858 | 0.9584 | 5395 | 0.3379 | -0.0898 | 0.1829 |
fixed | NA | birth_order_nonlinear5 | -0.03878 | 0.05997 | -0.6466 | 5413 | 0.5179 | -0.2071 | 0.1296 |
fixed | NA | birth_order_nonlinear>5 | 0.0368 | 0.05516 | 0.667 | 5458 | 0.5048 | -0.1181 | 0.1916 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1244 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9322 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9712 | 0.4283 | 2.267 | 5626 | 0.0234 | -0.2311 | 2.174 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0814 | 0.04848 | -1.679 | 5618 | 0.09319 | -0.2175 | 0.05468 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002602 | 0.001728 | 1.506 | 5603 | 0.1321 | -0.002248 | 0.007453 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002605 | 0.00001954 | -1.333 | 5581 | 0.1826 | -0.00008091 | 0.00002881 |
fixed | NA | male | -0.2291 | 0.02507 | -9.14 | 5633 | 8.554e-20 | -0.2995 | -0.1587 |
fixed | NA | count_birth_order2/2 | 0.04849 | 0.06493 | 0.7467 | 5044 | 0.4553 | -0.1338 | 0.2308 |
fixed | NA | count_birth_order1/3 | -0.1679 | 0.05589 | -3.005 | 5632 | 0.002671 | -0.3248 | -0.01104 |
fixed | NA | count_birth_order2/3 | -0.02805 | 0.06057 | -0.4631 | 5633 | 0.6433 | -0.1981 | 0.142 |
fixed | NA | count_birth_order3/3 | 0.0296 | 0.06842 | 0.4325 | 5633 | 0.6654 | -0.1625 | 0.2217 |
fixed | NA | count_birth_order1/4 | -0.005126 | 0.06627 | -0.07735 | 5632 | 0.9383 | -0.1911 | 0.1809 |
fixed | NA | count_birth_order2/4 | -0.04986 | 0.06714 | -0.7426 | 5633 | 0.4578 | -0.2383 | 0.1386 |
fixed | NA | count_birth_order3/4 | -0.1197 | 0.07463 | -1.605 | 5632 | 0.1086 | -0.3292 | 0.08974 |
fixed | NA | count_birth_order4/4 | 0.02688 | 0.07657 | 0.3511 | 5632 | 0.7256 | -0.1881 | 0.2418 |
fixed | NA | count_birth_order1/5 | -0.0005703 | 0.07891 | -0.007228 | 5632 | 0.9942 | -0.2221 | 0.2209 |
fixed | NA | count_birth_order2/5 | -0.06387 | 0.08439 | -0.7568 | 5633 | 0.4492 | -0.3007 | 0.173 |
fixed | NA | count_birth_order3/5 | 0.05279 | 0.08275 | 0.6379 | 5633 | 0.5236 | -0.1795 | 0.2851 |
fixed | NA | count_birth_order4/5 | -0.1065 | 0.08431 | -1.264 | 5632 | 0.2064 | -0.3432 | 0.1301 |
fixed | NA | count_birth_order5/5 | -0.1147 | 0.08589 | -1.335 | 5630 | 0.1818 | -0.3558 | 0.1264 |
fixed | NA | count_birth_order1/>5 | -0.06879 | 0.07534 | -0.9131 | 5623 | 0.3613 | -0.2803 | 0.1427 |
fixed | NA | count_birth_order2/>5 | 0.04887 | 0.07825 | 0.6245 | 5628 | 0.5323 | -0.1708 | 0.2685 |
fixed | NA | count_birth_order3/>5 | -0.07751 | 0.07663 | -1.011 | 5633 | 0.3119 | -0.2926 | 0.1376 |
fixed | NA | count_birth_order4/>5 | -0.0007247 | 0.07385 | -0.009813 | 5633 | 0.9922 | -0.208 | 0.2066 |
fixed | NA | count_birth_order5/>5 | -0.09299 | 0.07634 | -1.218 | 5632 | 0.2232 | -0.3073 | 0.1213 |
fixed | NA | count_birth_order>5/>5 | -0.02458 | 0.0547 | -0.4494 | 5065 | 0.6532 | -0.1781 | 0.129 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1213 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9321 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 15371 | 15444 | -7675 | 15349 | NA | NA | NA |
12 | 15373 | 15453 | -7675 | 15349 | 0.02676 | 1 | 0.8701 |
16 | 15376 | 15482 | -7672 | 15344 | 5.218 | 4 | 0.2657 |
26 | 15381 | 15553 | -7664 | 15329 | 15.32 | 10 | 0.1209 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9132 | 0.4324 | 2.112 | 5480 | 0.03473 | -0.3005 | 2.127 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.07301 | 0.049 | -1.49 | 5472 | 0.1363 | -0.2106 | 0.06455 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002181 | 0.001747 | 1.249 | 5459 | 0.2119 | -0.002722 | 0.007084 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002022 | 0.00001976 | -1.023 | 5440 | 0.3062 | -0.00007567 | 0.00003524 |
fixed | NA | male | -0.2238 | 0.02536 | -8.828 | 5483 | 1.413e-18 | -0.295 | -0.1527 |
fixed | NA | sibling_count3 | -0.04656 | 0.03761 | -1.238 | 4289 | 0.2158 | -0.1521 | 0.05901 |
fixed | NA | sibling_count4 | -0.01363 | 0.04054 | -0.3363 | 3717 | 0.7367 | -0.1274 | 0.1002 |
fixed | NA | sibling_count5 | 0.001808 | 0.04729 | 0.03824 | 3067 | 0.9695 | -0.1309 | 0.1345 |
fixed | NA | sibling_count>5 | -0.01265 | 0.04078 | -0.3103 | 2754 | 0.7564 | -0.1271 | 0.1018 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1348 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9277 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9127 | 0.4325 | 2.111 | 5479 | 0.03486 | -0.3012 | 2.127 |
fixed | NA | birth_order | 0.000456 | 0.008519 | 0.05353 | 5095 | 0.9573 | -0.02346 | 0.02437 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.07302 | 0.04901 | -1.49 | 5471 | 0.1363 | -0.2106 | 0.06455 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00218 | 0.001747 | 1.248 | 5458 | 0.212 | -0.002723 | 0.007084 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00002019 | 0.00001976 | -1.022 | 5439 | 0.3069 | -0.00007567 | 0.00003528 |
fixed | NA | male | -0.2238 | 0.02536 | -8.827 | 5482 | 1.422e-18 | -0.295 | -0.1527 |
fixed | NA | sibling_count3 | -0.04678 | 0.03784 | -1.236 | 4284 | 0.2164 | -0.153 | 0.05943 |
fixed | NA | sibling_count4 | -0.01414 | 0.04163 | -0.3396 | 3716 | 0.7342 | -0.131 | 0.1027 |
fixed | NA | sibling_count5 | 0.001006 | 0.04962 | 0.02027 | 3118 | 0.9838 | -0.1383 | 0.1403 |
fixed | NA | sibling_count>5 | -0.01433 | 0.05143 | -0.2786 | 3317 | 0.7806 | -0.1587 | 0.13 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1351 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9278 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.8882 | 0.433 | 2.051 | 5473 | 0.04029 | -0.3272 | 2.104 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.07193 | 0.04904 | -1.467 | 5466 | 0.1425 | -0.2096 | 0.06572 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.002137 | 0.001748 | 1.222 | 5453 | 0.2216 | -0.00277 | 0.007043 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001967 | 0.00001978 | -0.9946 | 5434 | 0.32 | -0.00007519 | 0.00003584 |
fixed | NA | male | -0.2233 | 0.02537 | -8.805 | 5478 | 1.733e-18 | -0.2945 | -0.1521 |
fixed | NA | sibling_count3 | -0.0543 | 0.03876 | -1.401 | 4466 | 0.1613 | -0.1631 | 0.05451 |
fixed | NA | sibling_count4 | -0.02342 | 0.04356 | -0.5376 | 4064 | 0.5909 | -0.1457 | 0.09886 |
fixed | NA | sibling_count5 | -0.001756 | 0.05226 | -0.0336 | 3536 | 0.9732 | -0.1485 | 0.1449 |
fixed | NA | sibling_count>5 | -0.016 | 0.05321 | -0.3006 | 3640 | 0.7637 | -0.1654 | 0.1334 |
fixed | NA | birth_order_nonlinear2 | 0.04845 | 0.03294 | 1.471 | 4775 | 0.1414 | -0.04401 | 0.1409 |
fixed | NA | birth_order_nonlinear3 | 0.03917 | 0.04067 | 0.9632 | 5008 | 0.3355 | -0.07498 | 0.1533 |
fixed | NA | birth_order_nonlinear4 | 0.02205 | 0.05151 | 0.428 | 5165 | 0.6687 | -0.1226 | 0.1666 |
fixed | NA | birth_order_nonlinear5 | -0.004136 | 0.06549 | -0.06317 | 5179 | 0.9496 | -0.188 | 0.1797 |
fixed | NA | birth_order_nonlinear>5 | 0.02085 | 0.06395 | 0.3261 | 5437 | 0.7444 | -0.1586 | 0.2004 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1348 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9279 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.831 | 0.4338 | 1.915 | 5463 | 0.0555 | -0.3869 | 2.049 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.06428 | 0.04913 | -1.308 | 5456 | 0.1909 | -0.2022 | 0.07365 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001883 | 0.001752 | 1.075 | 5443 | 0.2825 | -0.003034 | 0.0068 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001703 | 0.00001982 | -0.8592 | 5423 | 0.3903 | -0.00007268 | 0.00003861 |
fixed | NA | male | -0.2212 | 0.02538 | -8.718 | 5468 | 3.705e-18 | -0.2925 | -0.15 |
fixed | NA | count_birth_order2/2 | 0.005957 | 0.0577 | 0.1032 | 4832 | 0.9178 | -0.156 | 0.1679 |
fixed | NA | count_birth_order1/3 | -0.1323 | 0.0509 | -2.599 | 5466 | 0.009377 | -0.2752 | 0.01059 |
fixed | NA | count_birth_order2/3 | 0.01953 | 0.0563 | 0.3468 | 5468 | 0.7287 | -0.1385 | 0.1775 |
fixed | NA | count_birth_order3/3 | 0.03569 | 0.06196 | 0.576 | 5467 | 0.5646 | -0.1382 | 0.2096 |
fixed | NA | count_birth_order1/4 | 0.02198 | 0.06356 | 0.3458 | 5466 | 0.7295 | -0.1564 | 0.2004 |
fixed | NA | count_birth_order2/4 | -0.01268 | 0.06554 | -0.1935 | 5468 | 0.8466 | -0.1967 | 0.1713 |
fixed | NA | count_birth_order3/4 | -0.0643 | 0.06839 | -0.9402 | 5467 | 0.3472 | -0.2563 | 0.1277 |
fixed | NA | count_birth_order4/4 | 0.001813 | 0.07231 | 0.02506 | 5466 | 0.98 | -0.2012 | 0.2048 |
fixed | NA | count_birth_order1/5 | 0.08837 | 0.08671 | 1.019 | 5467 | 0.3082 | -0.155 | 0.3318 |
fixed | NA | count_birth_order2/5 | -0.07422 | 0.0942 | -0.7878 | 5468 | 0.4308 | -0.3386 | 0.1902 |
fixed | NA | count_birth_order3/5 | 0.06378 | 0.08976 | 0.7106 | 5467 | 0.4774 | -0.1882 | 0.3157 |
fixed | NA | count_birth_order4/5 | -0.01829 | 0.08662 | -0.2112 | 5467 | 0.8327 | -0.2614 | 0.2248 |
fixed | NA | count_birth_order5/5 | -0.06024 | 0.09297 | -0.6479 | 5465 | 0.5171 | -0.3212 | 0.2007 |
fixed | NA | count_birth_order1/>5 | -0.07076 | 0.08852 | -0.7993 | 5458 | 0.4241 | -0.3192 | 0.1777 |
fixed | NA | count_birth_order2/>5 | 0.09919 | 0.08581 | 1.156 | 5461 | 0.2478 | -0.1417 | 0.3401 |
fixed | NA | count_birth_order3/>5 | -0.06262 | 0.08586 | -0.7294 | 5468 | 0.4658 | -0.3036 | 0.1784 |
fixed | NA | count_birth_order4/>5 | -0.01431 | 0.08371 | -0.1709 | 5468 | 0.8643 | -0.2493 | 0.2207 |
fixed | NA | count_birth_order5/>5 | -0.01093 | 0.07712 | -0.1418 | 5468 | 0.8872 | -0.2274 | 0.2055 |
fixed | NA | count_birth_order>5/>5 | -0.01065 | 0.05681 | -0.1875 | 4727 | 0.8513 | -0.1701 | 0.1488 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1365 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9273 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 14888 | 14961 | -7433 | 14866 | NA | NA | NA |
12 | 14890 | 14970 | -7433 | 14866 | 0.002696 | 1 | 0.9586 |
16 | 14896 | 15001 | -7432 | 14864 | 2.661 | 4 | 0.6161 |
26 | 14901 | 15073 | -7424 | 14849 | 14.83 | 10 | 0.1385 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = years_of_education_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.688 | 0.1288 | -20.87 | 13921 | 2.79e-95 | -3.05 | -2.327 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2633 | 0.01224 | 21.51 | 13740 | 5.722e-101 | 0.2289 | 0.2977 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006974 | 0.0003591 | -19.42 | 13831 | 6.417e-83 | -0.007982 | -0.005966 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005177 | 0.000003294 | 15.71 | 13961 | 3.555e-55 | 0.00004252 | 0.00006102 |
fixed | NA | male | -0.02813 | 0.013 | -2.163 | 11845 | 0.03054 | -0.06464 | 0.008371 |
fixed | NA | sibling_count3 | 0.07051 | 0.03368 | 2.093 | 8872 | 0.03634 | -0.02403 | 0.1651 |
fixed | NA | sibling_count4 | 0.0338 | 0.03529 | 0.9576 | 8520 | 0.3383 | -0.06527 | 0.1329 |
fixed | NA | sibling_count5 | 0.02754 | 0.0374 | 0.7364 | 8186 | 0.4615 | -0.07745 | 0.1325 |
fixed | NA | sibling_count>5 | -0.2199 | 0.02876 | -7.648 | 8601 | 2.267e-14 | -0.3007 | -0.1392 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.6782 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6413 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.696 | 0.1288 | -20.93 | 13940 | 8.407e-96 | -3.058 | -2.335 |
fixed | NA | birth_order | 0.006501 | 0.002997 | 2.169 | 14329 | 0.03007 | -0.001911 | 0.01491 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2614 | 0.01227 | 21.3 | 13729 | 4.864e-99 | 0.2269 | 0.2958 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006884 | 0.0003615 | -19.04 | 13901 | 7.772e-80 | -0.007898 | -0.005869 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005089 | 0.00000332 | 15.33 | 14047 | 1.298e-52 | 0.00004157 | 0.00006021 |
fixed | NA | male | -0.0283 | 0.013 | -2.177 | 11831 | 0.02948 | -0.06479 | 0.008187 |
fixed | NA | sibling_count3 | 0.07026 | 0.0337 | 2.085 | 8864 | 0.03708 | -0.02433 | 0.1649 |
fixed | NA | sibling_count4 | 0.0308 | 0.03534 | 0.8716 | 8552 | 0.3835 | -0.0684 | 0.13 |
fixed | NA | sibling_count5 | 0.02083 | 0.03755 | 0.5546 | 8274 | 0.5792 | -0.08457 | 0.1262 |
fixed | NA | sibling_count>5 | -0.2435 | 0.03076 | -7.917 | 9687 | 2.696e-15 | -0.3298 | -0.1572 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.6792 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6407 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.665 | 0.1291 | -20.64 | 13948 | 3.079e-93 | -3.027 | -2.302 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2613 | 0.01227 | 21.31 | 13731 | 3.994e-99 | 0.2269 | 0.2958 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006871 | 0.0003613 | -19.02 | 13893 | 1.177e-79 | -0.007885 | -0.005857 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005046 | 0.000003321 | 15.2 | 14054 | 9.485e-52 | 0.00004114 | 0.00005979 |
fixed | NA | male | -0.02841 | 0.01299 | -2.188 | 11817 | 0.02869 | -0.06486 | 0.008038 |
fixed | NA | sibling_count3 | 0.08287 | 0.03392 | 2.443 | 9053 | 0.01458 | -0.01234 | 0.1781 |
fixed | NA | sibling_count4 | 0.05735 | 0.0358 | 1.602 | 8918 | 0.1092 | -0.04315 | 0.1579 |
fixed | NA | sibling_count5 | 0.05175 | 0.03825 | 1.353 | 8753 | 0.1761 | -0.05563 | 0.1591 |
fixed | NA | sibling_count>5 | -0.2166 | 0.03162 | -6.85 | 10296 | 7.805e-12 | -0.3054 | -0.1278 |
fixed | NA | birth_order_nonlinear2 | -0.04969 | 0.01841 | -2.698 | 11706 | 0.006979 | -0.1014 | 0.002002 |
fixed | NA | birth_order_nonlinear3 | -0.07061 | 0.02142 | -3.296 | 11239 | 0.000984 | -0.1308 | -0.01047 |
fixed | NA | birth_order_nonlinear4 | -0.08076 | 0.02452 | -3.293 | 11322 | 0.0009945 | -0.1496 | -0.01192 |
fixed | NA | birth_order_nonlinear5 | -0.02921 | 0.02787 | -1.048 | 11274 | 0.2946 | -0.1074 | 0.04902 |
fixed | NA | birth_order_nonlinear>5 | 0.0102 | 0.02471 | 0.4128 | 13717 | 0.6797 | -0.05916 | 0.07956 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.6799 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6398 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.655 | 0.1297 | -20.47 | 13969 | 8.124e-92 | -3.019 | -2.291 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.261 | 0.01227 | 21.27 | 13739 | 8.457e-99 | 0.2266 | 0.2955 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006856 | 0.0003615 | -18.96 | 13907 | 3.426e-79 | -0.007871 | -0.005841 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005029 | 0.000003325 | 15.12 | 14075 | 2.806e-51 | 0.00004096 | 0.00005963 |
fixed | NA | male | -0.02811 | 0.01299 | -2.165 | 11808 | 0.03043 | -0.06457 | 0.008342 |
fixed | NA | count_birth_order2/2 | -0.07379 | 0.03615 | -2.041 | 12452 | 0.04125 | -0.1753 | 0.02768 |
fixed | NA | count_birth_order1/3 | 0.07773 | 0.03991 | 1.948 | 12462 | 0.05148 | -0.0343 | 0.1898 |
fixed | NA | count_birth_order2/3 | 0.01959 | 0.04385 | 0.4469 | 13398 | 0.655 | -0.1035 | 0.1427 |
fixed | NA | count_birth_order3/3 | 0.004158 | 0.04807 | 0.08651 | 14043 | 0.9311 | -0.1308 | 0.1391 |
fixed | NA | count_birth_order1/4 | 0.03963 | 0.04447 | 0.8911 | 13169 | 0.3729 | -0.0852 | 0.1645 |
fixed | NA | count_birth_order2/4 | -0.01847 | 0.04706 | -0.3925 | 13682 | 0.6947 | -0.1506 | 0.1136 |
fixed | NA | count_birth_order3/4 | -0.003081 | 0.0501 | -0.0615 | 14157 | 0.951 | -0.1437 | 0.1376 |
fixed | NA | count_birth_order4/4 | -0.006753 | 0.05219 | -0.1294 | 14271 | 0.8971 | -0.1533 | 0.1398 |
fixed | NA | count_birth_order1/5 | 0.03106 | 0.05016 | 0.6191 | 13791 | 0.5359 | -0.1098 | 0.1719 |
fixed | NA | count_birth_order2/5 | 0.004568 | 0.05248 | 0.08705 | 14111 | 0.9306 | -0.1427 | 0.1519 |
fixed | NA | count_birth_order3/5 | -0.09389 | 0.05304 | -1.77 | 14194 | 0.07675 | -0.2428 | 0.05501 |
fixed | NA | count_birth_order4/5 | -0.04342 | 0.05613 | -0.7736 | 14397 | 0.4392 | -0.201 | 0.1141 |
fixed | NA | count_birth_order5/5 | 0.1147 | 0.0571 | 2.008 | 14418 | 0.04461 | -0.0456 | 0.275 |
fixed | NA | count_birth_order1/>5 | -0.2286 | 0.0397 | -5.758 | 14136 | 0.000000008705 | -0.34 | -0.1171 |
fixed | NA | count_birth_order2/>5 | -0.2492 | 0.04077 | -6.112 | 14318 | 0.000000001011 | -0.3637 | -0.1347 |
fixed | NA | count_birth_order3/>5 | -0.2759 | 0.03996 | -6.904 | 14268 | 5.255e-12 | -0.388 | -0.1637 |
fixed | NA | count_birth_order4/>5 | -0.3126 | 0.03947 | -7.919 | 14200 | 2.578e-15 | -0.4234 | -0.2018 |
fixed | NA | count_birth_order5/>5 | -0.2873 | 0.03954 | -7.266 | 14231 | 3.898e-13 | -0.3983 | -0.1763 |
fixed | NA | count_birth_order>5/>5 | -0.2149 | 0.03384 | -6.349 | 11606 | 0.0000000002245 | -0.3099 | -0.1199 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.6799 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.6397 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 36298 | 36381 | -18138 | 36276 | NA | NA | NA |
12 | 36295 | 36386 | -18136 | 36271 | 4.685 | 1 | 0.03043 |
16 | 36281 | 36402 | -18125 | 36249 | 22.33 | 4 | 0.0001724 |
26 | 36288 | 36485 | -18118 | 36236 | 13.46 | 10 | 0.1991 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.736 | 0.309 | -21.8 | 5587 | 3.473e-101 | -7.603 | -5.869 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7187 | 0.03506 | 20.5 | 5537 | 4.764e-90 | 0.6203 | 0.8171 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02238 | 0.001252 | -17.87 | 5503 | 1.784e-69 | -0.0259 | -0.01886 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002241 | 0.0000142 | 15.78 | 5486 | 6.934e-55 | 0.0001843 | 0.000264 |
fixed | NA | male | -0.07737 | 0.0178 | -4.347 | 5339 | 0.00001407 | -0.1273 | -0.02741 |
fixed | NA | sibling_count3 | 0.01365 | 0.03226 | 0.423 | 4384 | 0.6723 | -0.07692 | 0.1042 |
fixed | NA | sibling_count4 | -0.08132 | 0.03529 | -2.304 | 4151 | 0.02126 | -0.1804 | 0.01775 |
fixed | NA | sibling_count5 | -0.1649 | 0.04105 | -4.017 | 4003 | 0.0000599 | -0.2802 | -0.04969 |
fixed | NA | sibling_count>5 | -0.3901 | 0.03602 | -10.83 | 3979 | 5.93e-27 | -0.4912 | -0.289 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5155 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5677 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.749 | 0.3088 | -21.86 | 5584 | 1.094e-101 | -7.616 | -5.882 |
fixed | NA | birth_order | 0.01624 | 0.006102 | 2.662 | 5956 | 0.007783 | -0.0008834 | 0.03337 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7172 | 0.03504 | 20.47 | 5534 | 8.325e-90 | 0.6188 | 0.8155 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02234 | 0.001251 | -17.85 | 5501 | 2.566e-69 | -0.02585 | -0.01882 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002243 | 0.00001419 | 15.81 | 5480 | 4.538e-55 | 0.0001845 | 0.0002642 |
fixed | NA | male | -0.07822 | 0.01779 | -4.398 | 5334 | 0.00001114 | -0.1281 | -0.0283 |
fixed | NA | sibling_count3 | 0.004941 | 0.03243 | 0.1524 | 4398 | 0.8789 | -0.0861 | 0.09598 |
fixed | NA | sibling_count4 | -0.1021 | 0.03616 | -2.824 | 4189 | 0.004758 | -0.2036 | -0.0006304 |
fixed | NA | sibling_count5 | -0.198 | 0.04291 | -4.615 | 4127 | 0.000004046 | -0.3185 | -0.07759 |
fixed | NA | sibling_count>5 | -0.4559 | 0.04371 | -10.43 | 4521 | 3.489e-25 | -0.5786 | -0.3332 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5166 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5667 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.665 | 0.3096 | -21.53 | 5634 | 7.32e-99 | -7.533 | -5.796 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.712 | 0.03506 | 20.31 | 5568 | 1.623e-88 | 0.6136 | 0.8105 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02217 | 0.001252 | -17.71 | 5526 | 2.665e-68 | -0.02568 | -0.01865 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002228 | 0.00001419 | 15.69 | 5497 | 2.469e-54 | 0.0001829 | 0.0002626 |
fixed | NA | male | -0.07857 | 0.01776 | -4.425 | 5329 | 0.000009827 | -0.1284 | -0.02873 |
fixed | NA | sibling_count3 | 0.005269 | 0.03283 | 0.1605 | 4535 | 0.8725 | -0.0869 | 0.09743 |
fixed | NA | sibling_count4 | -0.1132 | 0.03708 | -3.054 | 4416 | 0.002272 | -0.2173 | -0.009156 |
fixed | NA | sibling_count5 | -0.2355 | 0.04429 | -5.317 | 4415 | 0.0000001104 | -0.3598 | -0.1112 |
fixed | NA | sibling_count>5 | -0.4792 | 0.04459 | -10.74 | 4663 | 1.282e-26 | -0.6043 | -0.354 |
fixed | NA | birth_order_nonlinear2 | -0.05353 | 0.02201 | -2.433 | 4629 | 0.01503 | -0.1153 | 0.008243 |
fixed | NA | birth_order_nonlinear3 | 0.02796 | 0.02736 | 1.022 | 4813 | 0.307 | -0.04886 | 0.1048 |
fixed | NA | birth_order_nonlinear4 | 0.0843 | 0.03424 | 2.462 | 5002 | 0.01385 | -0.01182 | 0.1804 |
fixed | NA | birth_order_nonlinear5 | 0.1608 | 0.04246 | 3.786 | 4749 | 0.0001547 | 0.04158 | 0.2799 |
fixed | NA | birth_order_nonlinear>5 | 0.07327 | 0.04454 | 1.645 | 5665 | 0.1 | -0.05175 | 0.1983 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5157 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5657 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.676 | 0.3105 | -21.5 | 5642 | 1.325e-98 | -7.548 | -5.804 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.713 | 0.03516 | 20.28 | 5568 | 2.752e-88 | 0.6143 | 0.8117 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02222 | 0.001256 | -17.69 | 5528 | 3.405e-68 | -0.02574 | -0.01869 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002235 | 0.00001424 | 15.69 | 5502 | 2.59e-54 | 0.0001835 | 0.0002634 |
fixed | NA | male | -0.07799 | 0.01778 | -4.386 | 5320 | 0.00001175 | -0.1279 | -0.02808 |
fixed | NA | count_birth_order2/2 | -0.03586 | 0.04032 | -0.8893 | 5082 | 0.3739 | -0.149 | 0.07733 |
fixed | NA | count_birth_order1/3 | 0.03154 | 0.03934 | 0.8017 | 5865 | 0.4228 | -0.0789 | 0.142 |
fixed | NA | count_birth_order2/3 | -0.06423 | 0.04233 | -1.517 | 6060 | 0.1292 | -0.183 | 0.05459 |
fixed | NA | count_birth_order3/3 | 0.02724 | 0.04677 | 0.5824 | 6126 | 0.5603 | -0.1041 | 0.1585 |
fixed | NA | count_birth_order1/4 | -0.1151 | 0.0475 | -2.423 | 6050 | 0.01543 | -0.2484 | 0.01825 |
fixed | NA | count_birth_order2/4 | -0.1695 | 0.04852 | -3.495 | 6118 | 0.0004782 | -0.3057 | -0.03336 |
fixed | NA | count_birth_order3/4 | -0.0516 | 0.05091 | -1.014 | 6126 | 0.3108 | -0.1945 | 0.09131 |
fixed | NA | count_birth_order4/4 | -0.03001 | 0.05286 | -0.5676 | 6123 | 0.5703 | -0.1784 | 0.1184 |
fixed | NA | count_birth_order1/5 | -0.2277 | 0.06389 | -3.564 | 6130 | 0.0003685 | -0.407 | -0.04834 |
fixed | NA | count_birth_order2/5 | -0.2326 | 0.06767 | -3.437 | 6029 | 0.0005926 | -0.4225 | -0.04262 |
fixed | NA | count_birth_order3/5 | -0.2085 | 0.06323 | -3.297 | 6079 | 0.0009821 | -0.386 | -0.03099 |
fixed | NA | count_birth_order4/5 | -0.1802 | 0.06188 | -2.912 | 6108 | 0.003603 | -0.3539 | -0.006502 |
fixed | NA | count_birth_order5/5 | -0.06835 | 0.06392 | -1.069 | 6073 | 0.285 | -0.2478 | 0.1111 |
fixed | NA | count_birth_order1/>5 | -0.5118 | 0.06239 | -8.204 | 6045 | 2.818e-16 | -0.6869 | -0.3367 |
fixed | NA | count_birth_order2/>5 | -0.5145 | 0.06185 | -8.319 | 6010 | 1.09e-16 | -0.6881 | -0.3409 |
fixed | NA | count_birth_order3/>5 | -0.4626 | 0.0607 | -7.622 | 5958 | 2.895e-14 | -0.633 | -0.2922 |
fixed | NA | count_birth_order4/>5 | -0.351 | 0.05758 | -6.095 | 5998 | 0.000000001159 | -0.5126 | -0.1893 |
fixed | NA | count_birth_order5/>5 | -0.3139 | 0.05473 | -5.734 | 6037 | 0.00000001026 | -0.4675 | -0.1602 |
fixed | NA | count_birth_order>5/>5 | -0.3993 | 0.04395 | -9.085 | 5818 | 1.393e-19 | -0.5227 | -0.2759 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5154 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5662 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 13603 | 13677 | -6790 | 13581 | NA | NA | NA |
12 | 13598 | 13678 | -6787 | 13574 | 7.074 | 1 | 0.007821 |
16 | 13581 | 13688 | -6774 | 13549 | 24.75 | 4 | 0.00005645 |
26 | 13596 | 13771 | -6772 | 13544 | 4.93 | 10 | 0.8958 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.746 | 0.3083 | -21.88 | 5626 | 6.385e-102 | -7.612 | -5.881 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7193 | 0.035 | 20.55 | 5570 | 1.483e-90 | 0.6211 | 0.8176 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02245 | 0.00125 | -17.96 | 5534 | 3.827e-70 | -0.02596 | -0.01894 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002249 | 0.00001418 | 15.85 | 5516 | 2.161e-55 | 0.000185 | 0.0002647 |
fixed | NA | male | -0.07773 | 0.01774 | -4.381 | 5374 | 0.00001204 | -0.1275 | -0.02793 |
fixed | NA | sibling_count3 | 0.0339 | 0.03494 | 0.9704 | 4519 | 0.3319 | -0.06417 | 0.132 |
fixed | NA | sibling_count4 | -0.03127 | 0.03721 | -0.8404 | 4323 | 0.4007 | -0.1357 | 0.07318 |
fixed | NA | sibling_count5 | -0.08928 | 0.04042 | -2.209 | 4164 | 0.02724 | -0.2027 | 0.02418 |
fixed | NA | sibling_count>5 | -0.2673 | 0.03522 | -7.589 | 4304 | 3.939e-14 | -0.3662 | -0.1684 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5206 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5663 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.75 | 0.3084 | -21.89 | 5623 | 5.425e-102 | -7.615 | -5.884 |
fixed | NA | birth_order | 0.003115 | 0.005405 | 0.5763 | 6116 | 0.5644 | -0.01206 | 0.01829 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7191 | 0.035 | 20.55 | 5567 | 1.658e-90 | 0.6209 | 0.8174 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02245 | 0.00125 | -17.96 | 5531 | 4.071e-70 | -0.02596 | -0.01894 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002249 | 0.00001418 | 15.86 | 5510 | 1.976e-55 | 0.0001851 | 0.0002647 |
fixed | NA | male | -0.07789 | 0.01774 | -4.39 | 5370 | 0.00001157 | -0.1277 | -0.02808 |
fixed | NA | sibling_count3 | 0.03222 | 0.03507 | 0.9189 | 4519 | 0.3582 | -0.06621 | 0.1307 |
fixed | NA | sibling_count4 | -0.03509 | 0.0378 | -0.9283 | 4329 | 0.3533 | -0.1412 | 0.07102 |
fixed | NA | sibling_count5 | -0.09522 | 0.04172 | -2.282 | 4209 | 0.02253 | -0.2123 | 0.0219 |
fixed | NA | sibling_count>5 | -0.2794 | 0.04103 | -6.809 | 4662 | 0.00000000001107 | -0.3946 | -0.1642 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.521 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5661 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.671 | 0.3092 | -21.57 | 5670 | 2.942e-99 | -7.539 | -5.803 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7127 | 0.03503 | 20.34 | 5600 | 7.838e-89 | 0.6144 | 0.8111 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02222 | 0.001251 | -17.76 | 5557 | 1.068e-68 | -0.02573 | -0.01871 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002226 | 0.00001419 | 15.68 | 5529 | 2.803e-54 | 0.0001828 | 0.0002624 |
fixed | NA | male | -0.07837 | 0.01773 | -4.421 | 5366 | 0.00001003 | -0.1281 | -0.02861 |
fixed | NA | sibling_count3 | 0.03597 | 0.03548 | 1.014 | 4641 | 0.3107 | -0.06361 | 0.1356 |
fixed | NA | sibling_count4 | -0.03978 | 0.0387 | -1.028 | 4536 | 0.304 | -0.1484 | 0.06884 |
fixed | NA | sibling_count5 | -0.1169 | 0.04304 | -2.716 | 4476 | 0.006635 | -0.2377 | 0.003922 |
fixed | NA | sibling_count>5 | -0.2918 | 0.04193 | -6.96 | 4804 | 3.865e-12 | -0.4095 | -0.1741 |
fixed | NA | birth_order_nonlinear2 | -0.05895 | 0.02256 | -2.613 | 4743 | 0.008999 | -0.1223 | 0.004373 |
fixed | NA | birth_order_nonlinear3 | -0.01423 | 0.0274 | -0.5195 | 4898 | 0.6034 | -0.09113 | 0.06267 |
fixed | NA | birth_order_nonlinear4 | 0.03769 | 0.03338 | 1.129 | 5125 | 0.2589 | -0.05601 | 0.1314 |
fixed | NA | birth_order_nonlinear5 | 0.0732 | 0.04067 | 1.8 | 4937 | 0.07195 | -0.04096 | 0.1874 |
fixed | NA | birth_order_nonlinear>5 | -0.01079 | 0.04033 | -0.2675 | 5891 | 0.7891 | -0.124 | 0.1024 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5208 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5654 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.652 | 0.3102 | -21.44 | 5684 | 3.797e-98 | -7.523 | -5.781 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7099 | 0.03512 | 20.22 | 5604 | 8.757e-88 | 0.6114 | 0.8085 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02212 | 0.001255 | -17.63 | 5564 | 9.955e-68 | -0.02564 | -0.01859 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002213 | 0.00001423 | 15.55 | 5538 | 2.102e-53 | 0.0001814 | 0.0002613 |
fixed | NA | male | -0.07904 | 0.01775 | -4.453 | 5361 | 0.000008631 | -0.1289 | -0.02922 |
fixed | NA | count_birth_order2/2 | -0.04672 | 0.0446 | -1.048 | 5245 | 0.2949 | -0.1719 | 0.07847 |
fixed | NA | count_birth_order1/3 | 0.05622 | 0.04275 | 1.315 | 5928 | 0.1886 | -0.06378 | 0.1762 |
fixed | NA | count_birth_order2/3 | -0.05503 | 0.04603 | -1.196 | 6113 | 0.2319 | -0.1842 | 0.07417 |
fixed | NA | count_birth_order3/3 | 0.04289 | 0.05079 | 0.8444 | 6182 | 0.3985 | -0.09968 | 0.1855 |
fixed | NA | count_birth_order1/4 | -0.07165 | 0.04984 | -1.438 | 6098 | 0.1506 | -0.2115 | 0.06824 |
fixed | NA | count_birth_order2/4 | -0.05084 | 0.05034 | -1.01 | 6159 | 0.3125 | -0.1921 | 0.09046 |
fixed | NA | count_birth_order3/4 | -0.06351 | 0.0545 | -1.165 | 6177 | 0.2439 | -0.2165 | 0.08946 |
fixed | NA | count_birth_order4/4 | 0.009664 | 0.0564 | 0.1713 | 6178 | 0.864 | -0.1487 | 0.168 |
fixed | NA | count_birth_order1/5 | -0.1223 | 0.05889 | -2.077 | 6177 | 0.03787 | -0.2876 | 0.04301 |
fixed | NA | count_birth_order2/5 | -0.1555 | 0.06209 | -2.504 | 6151 | 0.0123 | -0.3298 | 0.01881 |
fixed | NA | count_birth_order3/5 | -0.1429 | 0.06084 | -2.349 | 6157 | 0.01888 | -0.3137 | 0.02789 |
fixed | NA | count_birth_order4/5 | -0.09629 | 0.06301 | -1.528 | 6126 | 0.1265 | -0.2732 | 0.08058 |
fixed | NA | count_birth_order5/5 | -0.007981 | 0.06277 | -0.1271 | 6133 | 0.8988 | -0.1842 | 0.1682 |
fixed | NA | count_birth_order1/>5 | -0.2597 | 0.05562 | -4.669 | 6186 | 0.000003092 | -0.4158 | -0.1036 |
fixed | NA | count_birth_order2/>5 | -0.3699 | 0.05726 | -6.461 | 6112 | 0.0000000001124 | -0.5307 | -0.2092 |
fixed | NA | count_birth_order3/>5 | -0.2976 | 0.05583 | -5.33 | 6101 | 0.0000001018 | -0.4543 | -0.1408 |
fixed | NA | count_birth_order4/>5 | -0.2436 | 0.05381 | -4.526 | 6131 | 0.000006113 | -0.3946 | -0.09252 |
fixed | NA | count_birth_order5/>5 | -0.2379 | 0.05508 | -4.318 | 6043 | 0.00001598 | -0.3925 | -0.08324 |
fixed | NA | count_birth_order>5/>5 | -0.2999 | 0.04319 | -6.943 | 5904 | 4.247e-12 | -0.4211 | -0.1786 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.52 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5661 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 13753 | 13827 | -6866 | 13731 | NA | NA | NA |
12 | 13755 | 13836 | -6865 | 13731 | 0.3298 | 1 | 0.5658 |
16 | 13747 | 13855 | -6857 | 13715 | 16.17 | 4 | 0.002799 |
26 | 13760 | 13935 | -6854 | 13708 | 6.573 | 10 | 0.765 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.758 | 0.313 | -21.59 | 5471 | 2.78e-99 | -7.636 | -5.879 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7212 | 0.03553 | 20.3 | 5420 | 2.406e-88 | 0.6215 | 0.8209 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02248 | 0.001269 | -17.72 | 5381 | 2.687e-68 | -0.02605 | -0.01892 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002253 | 0.0000144 | 15.65 | 5360 | 5.372e-54 | 0.0001849 | 0.0002658 |
fixed | NA | male | -0.07967 | 0.018 | -4.426 | 5233 | 0.000009789 | -0.1302 | -0.02914 |
fixed | NA | sibling_count3 | 0.007354 | 0.03188 | 0.2306 | 4375 | 0.8176 | -0.08215 | 0.09685 |
fixed | NA | sibling_count4 | -0.06524 | 0.03511 | -1.858 | 4170 | 0.0632 | -0.1638 | 0.03331 |
fixed | NA | sibling_count5 | -0.1584 | 0.04224 | -3.75 | 3939 | 0.000179 | -0.277 | -0.03986 |
fixed | NA | sibling_count>5 | -0.3751 | 0.03659 | -10.25 | 3915 | 2.328e-24 | -0.4778 | -0.2724 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5174 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.568 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.769 | 0.3128 | -21.64 | 5468 | 1.04e-99 | -7.647 | -5.891 |
fixed | NA | birth_order | 0.01578 | 0.006262 | 2.52 | 5789 | 0.01177 | -0.001798 | 0.03336 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7196 | 0.03551 | 20.26 | 5418 | 4.494e-88 | 0.62 | 0.8193 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02244 | 0.001268 | -17.69 | 5380 | 3.945e-68 | -0.026 | -0.01888 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002255 | 0.00001439 | 15.67 | 5355 | 3.656e-54 | 0.0001852 | 0.0002659 |
fixed | NA | male | -0.08017 | 0.01799 | -4.457 | 5229 | 0.000008468 | -0.1307 | -0.02969 |
fixed | NA | sibling_count3 | -0.001263 | 0.03207 | -0.03938 | 4387 | 0.9686 | -0.09128 | 0.08876 |
fixed | NA | sibling_count4 | -0.08503 | 0.03598 | -2.363 | 4216 | 0.01815 | -0.186 | 0.01596 |
fixed | NA | sibling_count5 | -0.1895 | 0.04401 | -4.305 | 4050 | 0.00001708 | -0.313 | -0.06594 |
fixed | NA | sibling_count>5 | -0.4382 | 0.04436 | -9.88 | 4498 | 8.654e-23 | -0.5628 | -0.3137 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5182 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5672 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.674 | 0.3137 | -21.28 | 5520 | 1.223e-96 | -7.555 | -5.794 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7136 | 0.03554 | 20.08 | 5452 | 1.376e-86 | 0.6138 | 0.8134 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02225 | 0.001269 | -17.53 | 5405 | 5.569e-67 | -0.02581 | -0.01868 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0002238 | 0.00001439 | 15.55 | 5372 | 2.431e-53 | 0.0001834 | 0.0002642 |
fixed | NA | male | -0.08054 | 0.01796 | -4.484 | 5223 | 0.000007469 | -0.131 | -0.03012 |
fixed | NA | sibling_count3 | 0.00008121 | 0.03249 | 0.002499 | 4521 | 0.998 | -0.09113 | 0.09129 |
fixed | NA | sibling_count4 | -0.09508 | 0.03694 | -2.574 | 4436 | 0.01008 | -0.1988 | 0.008603 |
fixed | NA | sibling_count5 | -0.2215 | 0.04531 | -4.888 | 4307 | 0.000001055 | -0.3486 | -0.09428 |
fixed | NA | sibling_count>5 | -0.4607 | 0.04527 | -10.18 | 4652 | 4.53e-24 | -0.5878 | -0.3336 |
fixed | NA | birth_order_nonlinear2 | -0.05633 | 0.02197 | -2.563 | 4526 | 0.0104 | -0.118 | 0.005353 |
fixed | NA | birth_order_nonlinear3 | 0.01674 | 0.0274 | 0.611 | 4708 | 0.5412 | -0.06017 | 0.09365 |
fixed | NA | birth_order_nonlinear4 | 0.08775 | 0.03516 | 2.496 | 4842 | 0.0126 | -0.01094 | 0.1864 |
fixed | NA | birth_order_nonlinear5 | 0.1372 | 0.04421 | 3.105 | 4611 | 0.001917 | 0.01315 | 0.2613 |
fixed | NA | birth_order_nonlinear>5 | 0.07675 | 0.04577 | 1.677 | 5462 | 0.09364 | -0.05173 | 0.2052 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5176 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5664 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -6.684 | 0.3148 | -21.24 | 5529 | 2.889e-96 | -7.568 | -5.801 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.7138 | 0.03565 | 20.02 | 5456 | 4.073e-86 | 0.6137 | 0.8139 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.02226 | 0.001273 | -17.48 | 5412 | 1.261e-66 | -0.02584 | -0.01869 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000224 | 0.00001445 | 15.5 | 5382 | 4.495e-53 | 0.0001835 | 0.0002646 |
fixed | NA | male | -0.07992 | 0.01799 | -4.444 | 5212 | 0.000009023 | -0.1304 | -0.02944 |
fixed | NA | count_birth_order2/2 | -0.02734 | 0.03915 | -0.6983 | 4900 | 0.4851 | -0.1372 | 0.08256 |
fixed | NA | count_birth_order1/3 | 0.03303 | 0.03893 | 0.8485 | 5773 | 0.3962 | -0.07625 | 0.1423 |
fixed | NA | count_birth_order2/3 | -0.06894 | 0.04228 | -1.63 | 5973 | 0.1031 | -0.1876 | 0.04975 |
fixed | NA | count_birth_order3/3 | 0.008928 | 0.04599 | 0.1941 | 6010 | 0.8461 | -0.1202 | 0.138 |
fixed | NA | count_birth_order1/4 | -0.09519 | 0.04764 | -1.998 | 5963 | 0.04577 | -0.2289 | 0.03855 |
fixed | NA | count_birth_order2/4 | -0.1545 | 0.04852 | -3.184 | 6008 | 0.001461 | -0.2907 | -0.01828 |
fixed | NA | count_birth_order3/4 | -0.0412 | 0.05053 | -0.8153 | 5999 | 0.415 | -0.183 | 0.1006 |
fixed | NA | count_birth_order4/4 | 0.003472 | 0.05308 | 0.06542 | 5983 | 0.9478 | -0.1455 | 0.1525 |
fixed | NA | count_birth_order1/5 | -0.2173 | 0.06431 | -3.379 | 6011 | 0.0007323 | -0.3978 | -0.03678 |
fixed | NA | count_birth_order2/5 | -0.2431 | 0.06969 | -3.489 | 5887 | 0.0004888 | -0.4388 | -0.04751 |
fixed | NA | count_birth_order3/5 | -0.1786 | 0.06617 | -2.699 | 5938 | 0.006983 | -0.3643 | 0.007176 |
fixed | NA | count_birth_order4/5 | -0.1625 | 0.06474 | -2.509 | 5975 | 0.01212 | -0.3442 | 0.01927 |
fixed | NA | count_birth_order5/5 | -0.06279 | 0.06813 | -0.9216 | 5918 | 0.3568 | -0.254 | 0.1285 |
fixed | NA | count_birth_order1/>5 | -0.4742 | 0.06382 | -7.43 | 5906 | 1.239e-13 | -0.6534 | -0.2951 |
fixed | NA | count_birth_order2/>5 | -0.4845 | 0.06341 | -7.64 | 5868 | 2.529e-14 | -0.6625 | -0.3065 |
fixed | NA | count_birth_order3/>5 | -0.4592 | 0.06144 | -7.474 | 5834 | 8.937e-14 | -0.6316 | -0.2867 |
fixed | NA | count_birth_order4/>5 | -0.3303 | 0.06021 | -5.486 | 5791 | 0.00000004288 | -0.4993 | -0.1613 |
fixed | NA | count_birth_order5/>5 | -0.3212 | 0.05599 | -5.737 | 5896 | 0.00000001014 | -0.4784 | -0.164 |
fixed | NA | count_birth_order>5/>5 | -0.3735 | 0.04488 | -8.322 | 5726 | 1.074e-16 | -0.4995 | -0.2475 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.5172 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.5669 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 13356 | 13430 | -6667 | 13334 | NA | NA | NA |
12 | 13352 | 13432 | -6664 | 13328 | 6.342 | 1 | 0.01179 |
16 | 13338 | 13446 | -6653 | 13306 | 21.48 | 4 | 0.0002543 |
26 | 13353 | 13528 | -6651 | 13301 | 4.93 | 10 | 0.8958 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = Elementary_missed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0359 | 0.07117 | -0.5044 | 7512 | 0.614 | -0.2357 | 0.1639 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.005098 | 0.008201 | 0.6217 | 7522 | 0.5342 | -0.01792 | 0.02812 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001344 | 0.0002977 | -0.4516 | 7530 | 0.6516 | -0.0009701 | 0.0007012 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001175 | 0.00000341 | 0.3446 | 7535 | 0.7304 | -0.000008396 | 0.00001075 |
fixed | NA | male | 0.01183 | 0.004139 | 2.857 | 7537 | 0.004287 | 0.0002072 | 0.02344 |
fixed | NA | sibling_count3 | -0.004516 | 0.007623 | -0.5924 | 6593 | 0.5536 | -0.02591 | 0.01688 |
fixed | NA | sibling_count4 | 0.002375 | 0.007854 | 0.3024 | 6299 | 0.7623 | -0.01967 | 0.02442 |
fixed | NA | sibling_count5 | 0.0005693 | 0.008131 | 0.07002 | 5736 | 0.9442 | -0.02225 | 0.02339 |
fixed | NA | sibling_count>5 | 0.01343 | 0.006512 | 2.062 | 6104 | 0.03929 | -0.004854 | 0.0317 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03164 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1769 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.03567 | 0.07116 | -0.5013 | 7511 | 0.6162 | -0.2354 | 0.1641 |
fixed | NA | birth_order | 0.001618 | 0.000855 | 1.893 | 5735 | 0.05844 | -0.0007817 | 0.004018 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.004764 | 0.008202 | 0.5809 | 7522 | 0.5613 | -0.01826 | 0.02779 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001223 | 0.0002977 | -0.4107 | 7530 | 0.6813 | -0.000958 | 0.0007134 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001066 | 0.00000341 | 0.3126 | 7535 | 0.7546 | -0.000008505 | 0.00001064 |
fixed | NA | male | 0.01187 | 0.004138 | 2.869 | 7536 | 0.00413 | 0.0002562 | 0.02349 |
fixed | NA | sibling_count3 | -0.005119 | 0.007628 | -0.6711 | 6594 | 0.5022 | -0.02653 | 0.01629 |
fixed | NA | sibling_count4 | 0.0008348 | 0.007895 | 0.1057 | 6293 | 0.9158 | -0.02133 | 0.023 |
fixed | NA | sibling_count5 | -0.001974 | 0.008239 | -0.2396 | 5702 | 0.8107 | -0.0251 | 0.02115 |
fixed | NA | sibling_count>5 | 0.005909 | 0.007626 | 0.7748 | 5985 | 0.4385 | -0.0155 | 0.02732 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03155 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1769 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.03677 | 0.07132 | -0.5155 | 7517 | 0.6062 | -0.237 | 0.1634 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.005009 | 0.008207 | 0.6103 | 7523 | 0.5417 | -0.01803 | 0.02805 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001286 | 0.000298 | -0.4316 | 7530 | 0.6661 | -0.000965 | 0.0007078 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000011 | 0.000003412 | 0.3224 | 7533 | 0.7471 | -0.000008478 | 0.00001068 |
fixed | NA | male | 0.01198 | 0.00414 | 2.893 | 7532 | 0.003828 | 0.0003554 | 0.0236 |
fixed | NA | sibling_count3 | -0.004969 | 0.007769 | -0.6396 | 6710 | 0.5225 | -0.02678 | 0.01684 |
fixed | NA | sibling_count4 | 0.004068 | 0.008262 | 0.4924 | 6577 | 0.6225 | -0.01912 | 0.02726 |
fixed | NA | sibling_count5 | 0.001791 | 0.008784 | 0.2039 | 6146 | 0.8385 | -0.02287 | 0.02645 |
fixed | NA | sibling_count>5 | 0.009914 | 0.008273 | 1.198 | 6603 | 0.2309 | -0.01331 | 0.03314 |
fixed | NA | birth_order_nonlinear2 | 0.002091 | 0.006096 | 0.3431 | 7040 | 0.7316 | -0.01502 | 0.0192 |
fixed | NA | birth_order_nonlinear3 | 0.002502 | 0.007308 | 0.3424 | 7206 | 0.732 | -0.01801 | 0.02302 |
fixed | NA | birth_order_nonlinear4 | -0.01034 | 0.008412 | -1.229 | 7298 | 0.2192 | -0.03395 | 0.01328 |
fixed | NA | birth_order_nonlinear5 | 0.001859 | 0.009411 | 0.1975 | 7399 | 0.8434 | -0.02456 | 0.02828 |
fixed | NA | birth_order_nonlinear>5 | 0.009152 | 0.007986 | 1.146 | 7375 | 0.2518 | -0.01327 | 0.03157 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03137 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1769 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.04214 | 0.07141 | -0.5902 | 7507 | 0.5551 | -0.2426 | 0.1583 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.005408 | 0.008208 | 0.6588 | 7513 | 0.51 | -0.01763 | 0.02845 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001434 | 0.000298 | -0.4811 | 7520 | 0.6305 | -0.0009798 | 0.0006931 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001267 | 0.000003413 | 0.3713 | 7523 | 0.7104 | -0.000008313 | 0.00001085 |
fixed | NA | male | 0.01215 | 0.00414 | 2.935 | 7522 | 0.003347 | 0.0005293 | 0.02377 |
fixed | NA | count_birth_order2/2 | 0.007844 | 0.0116 | 0.6762 | 7052 | 0.4989 | -0.02472 | 0.0404 |
fixed | NA | count_birth_order1/3 | 0.001005 | 0.01024 | 0.09822 | 7525 | 0.9218 | -0.02773 | 0.02974 |
fixed | NA | count_birth_order2/3 | -0.003272 | 0.01139 | -0.2873 | 7527 | 0.7739 | -0.03524 | 0.0287 |
fixed | NA | count_birth_order3/3 | -0.005575 | 0.01312 | -0.425 | 7527 | 0.6709 | -0.0424 | 0.03125 |
fixed | NA | count_birth_order1/4 | 0.006385 | 0.01209 | 0.5281 | 7527 | 0.5974 | -0.02755 | 0.04032 |
fixed | NA | count_birth_order2/4 | 0.01971 | 0.01252 | 1.574 | 7527 | 0.1155 | -0.01544 | 0.05486 |
fixed | NA | count_birth_order3/4 | -0.01251 | 0.01353 | -0.9247 | 7527 | 0.3552 | -0.05049 | 0.02547 |
fixed | NA | count_birth_order4/4 | 0.002527 | 0.01402 | 0.1803 | 7527 | 0.8569 | -0.03682 | 0.04188 |
fixed | NA | count_birth_order1/5 | -0.008057 | 0.01393 | -0.5784 | 7527 | 0.563 | -0.04716 | 0.03105 |
fixed | NA | count_birth_order2/5 | 0.008299 | 0.01493 | 0.5557 | 7526 | 0.5784 | -0.03362 | 0.05022 |
fixed | NA | count_birth_order3/5 | 0.01165 | 0.01465 | 0.795 | 7526 | 0.4266 | -0.02948 | 0.05278 |
fixed | NA | count_birth_order4/5 | 0.004803 | 0.01549 | 0.3101 | 7526 | 0.7565 | -0.03868 | 0.04829 |
fixed | NA | count_birth_order5/5 | 0.001672 | 0.01482 | 0.1128 | 7526 | 0.9102 | -0.03992 | 0.04327 |
fixed | NA | count_birth_order1/>5 | 0.01773 | 0.01285 | 1.38 | 7527 | 0.1677 | -0.01834 | 0.0538 |
fixed | NA | count_birth_order2/>5 | -0.001829 | 0.01301 | -0.1406 | 7527 | 0.8882 | -0.03835 | 0.03469 |
fixed | NA | count_birth_order3/>5 | 0.03193 | 0.01249 | 2.557 | 7527 | 0.01058 | -0.003125 | 0.06698 |
fixed | NA | count_birth_order4/>5 | -0.007931 | 0.01181 | -0.6717 | 7526 | 0.5018 | -0.04107 | 0.02521 |
fixed | NA | count_birth_order5/>5 | 0.0157 | 0.01134 | 1.385 | 7526 | 0.1662 | -0.01613 | 0.04754 |
fixed | NA | count_birth_order>5/>5 | 0.02106 | 0.008272 | 2.546 | 7238 | 0.01092 | -0.002161 | 0.04428 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0319 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1768 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -4483 | -4407 | 2252 | -4505 | NA | NA | NA |
12 | -4485 | -4401 | 2254 | -4509 | 3.587 | 1 | 0.05823 |
16 | -4478 | -4367 | 2255 | -4510 | 1.743 | 4 | 0.7829 |
26 | -4472 | -4292 | 2262 | -4524 | 13.98 | 10 | 0.1738 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1442 | 0.1069 | -1.349 | 3962 | 0.1776 | -0.4443 | 0.156 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01976 | 0.01294 | 1.527 | 3962 | 0.1269 | -0.01656 | 0.05608 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007469 | 0.0004952 | -1.508 | 3962 | 0.1316 | -0.002137 | 0.0006432 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009176 | 0.000005979 | 1.535 | 3962 | 0.1249 | -0.000007608 | 0.00002596 |
fixed | NA | male | 0.006646 | 0.005295 | 1.255 | 3962 | 0.2095 | -0.008216 | 0.02151 |
fixed | NA | sibling_count3 | -0.003274 | 0.007264 | -0.4507 | 3962 | 0.6522 | -0.02366 | 0.01712 |
fixed | NA | sibling_count4 | -0.004942 | 0.008107 | -0.6095 | 3962 | 0.5422 | -0.0277 | 0.01782 |
fixed | NA | sibling_count5 | 0.002172 | 0.009593 | 0.2265 | 3962 | 0.8209 | -0.02475 | 0.0291 |
fixed | NA | sibling_count>5 | 0.02326 | 0.00863 | 2.696 | 3962 | 0.007056 | -0.0009618 | 0.04749 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1667 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.145 | 0.107 | -1.355 | 3961 | 0.1754 | -0.4454 | 0.1553 |
fixed | NA | birth_order | 0.0004245 | 0.001896 | 0.2238 | 3961 | 0.8229 | -0.004899 | 0.005748 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0198 | 0.01294 | 1.53 | 3961 | 0.1262 | -0.01653 | 0.05612 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007491 | 0.0004954 | -1.512 | 3961 | 0.1306 | -0.00214 | 0.0006415 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009215 | 0.000005983 | 1.54 | 3961 | 0.1236 | -0.000007578 | 0.00002601 |
fixed | NA | male | 0.006655 | 0.005296 | 1.257 | 3961 | 0.2089 | -0.00821 | 0.02152 |
fixed | NA | sibling_count3 | -0.003473 | 0.007319 | -0.4746 | 3961 | 0.6351 | -0.02402 | 0.01707 |
fixed | NA | sibling_count4 | -0.005406 | 0.008369 | -0.6459 | 3961 | 0.5184 | -0.0289 | 0.01809 |
fixed | NA | sibling_count5 | 0.001394 | 0.0102 | 0.1366 | 3961 | 0.8914 | -0.02725 | 0.03004 |
fixed | NA | sibling_count>5 | 0.02152 | 0.01163 | 1.85 | 3961 | 0.0644 | -0.01113 | 0.05417 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1667 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1453 | 0.1071 | -1.356 | 3957 | 0.175 | -0.446 | 0.1554 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0198 | 0.01295 | 1.529 | 3957 | 0.1263 | -0.01655 | 0.05615 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007478 | 0.0004957 | -1.509 | 3957 | 0.1315 | -0.002139 | 0.0006435 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009187 | 0.000005986 | 1.535 | 3957 | 0.125 | -0.000007617 | 0.00002599 |
fixed | NA | male | 0.006736 | 0.005298 | 1.271 | 3957 | 0.2037 | -0.008136 | 0.02161 |
fixed | NA | sibling_count3 | -0.003312 | 0.007538 | -0.4394 | 3957 | 0.6604 | -0.02447 | 0.01785 |
fixed | NA | sibling_count4 | -0.000942 | 0.008859 | -0.1063 | 3957 | 0.9153 | -0.02581 | 0.02393 |
fixed | NA | sibling_count5 | 0.007974 | 0.01095 | 0.7286 | 3957 | 0.4663 | -0.02275 | 0.0387 |
fixed | NA | sibling_count>5 | 0.02341 | 0.01232 | 1.9 | 3957 | 0.05752 | -0.01118 | 0.058 |
fixed | NA | birth_order_nonlinear2 | 0.001382 | 0.006812 | 0.2029 | 3957 | 0.8392 | -0.01774 | 0.0205 |
fixed | NA | birth_order_nonlinear3 | 0.0001446 | 0.008687 | 0.01664 | 3957 | 0.9867 | -0.02424 | 0.02453 |
fixed | NA | birth_order_nonlinear4 | -0.01699 | 0.01116 | -1.523 | 3957 | 0.128 | -0.04831 | 0.01433 |
fixed | NA | birth_order_nonlinear5 | -0.007998 | 0.01468 | -0.5448 | 3957 | 0.5859 | -0.04921 | 0.03321 |
fixed | NA | birth_order_nonlinear>5 | 0.007723 | 0.01497 | 0.5159 | 3957 | 0.606 | -0.0343 | 0.04975 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1667 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.143 | 0.1073 | -1.332 | 3947 | 0.1828 | -0.4442 | 0.1582 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0197 | 0.01297 | 1.519 | 3947 | 0.1289 | -0.01671 | 0.05612 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007376 | 0.0004966 | -1.485 | 3947 | 0.1375 | -0.002132 | 0.0006564 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000008982 | 0.000005999 | 1.497 | 3947 | 0.1344 | -0.000007858 | 0.00002582 |
fixed | NA | male | 0.006549 | 0.005306 | 1.234 | 3947 | 0.2172 | -0.008345 | 0.02144 |
fixed | NA | count_birth_order2/2 | -0.006425 | 0.01127 | -0.5701 | 3947 | 0.5686 | -0.03806 | 0.02521 |
fixed | NA | count_birth_order1/3 | -0.01274 | 0.009904 | -1.286 | 3947 | 0.1985 | -0.04054 | 0.01506 |
fixed | NA | count_birth_order2/3 | 0.001926 | 0.01084 | 0.1776 | 3947 | 0.859 | -0.02852 | 0.03237 |
fixed | NA | count_birth_order3/3 | -0.001935 | 0.01213 | -0.1595 | 3947 | 0.8733 | -0.036 | 0.03213 |
fixed | NA | count_birth_order1/4 | -0.000406 | 0.01319 | -0.03077 | 3947 | 0.9755 | -0.03744 | 0.03663 |
fixed | NA | count_birth_order2/4 | 0.002909 | 0.01367 | 0.2127 | 3947 | 0.8315 | -0.03548 | 0.04129 |
fixed | NA | count_birth_order3/4 | -0.01698 | 0.0144 | -1.179 | 3947 | 0.2386 | -0.05741 | 0.02346 |
fixed | NA | count_birth_order4/4 | -0.01695 | 0.01423 | -1.19 | 3947 | 0.2339 | -0.0569 | 0.02301 |
fixed | NA | count_birth_order1/5 | 0.005682 | 0.01916 | 0.2965 | 3947 | 0.7668 | -0.04811 | 0.05947 |
fixed | NA | count_birth_order2/5 | -0.001842 | 0.02077 | -0.08868 | 3947 | 0.9293 | -0.06015 | 0.05647 |
fixed | NA | count_birth_order3/5 | 0.004445 | 0.01888 | 0.2354 | 3947 | 0.8139 | -0.04857 | 0.05746 |
fixed | NA | count_birth_order4/5 | -0.0002872 | 0.01775 | -0.01618 | 3947 | 0.9871 | -0.05011 | 0.04954 |
fixed | NA | count_birth_order5/5 | -0.007808 | 0.01825 | -0.4279 | 3947 | 0.6687 | -0.05902 | 0.04341 |
fixed | NA | count_birth_order1/>5 | 0.04048 | 0.02442 | 1.658 | 3947 | 0.09748 | -0.02807 | 0.109 |
fixed | NA | count_birth_order2/>5 | 0.003233 | 0.02367 | 0.1366 | 3947 | 0.8913 | -0.0632 | 0.06967 |
fixed | NA | count_birth_order3/>5 | 0.04167 | 0.02177 | 1.914 | 3947 | 0.05566 | -0.01943 | 0.1028 |
fixed | NA | count_birth_order4/>5 | -0.01883 | 0.0199 | -0.9464 | 3947 | 0.344 | -0.07469 | 0.03702 |
fixed | NA | count_birth_order5/>5 | 0.01747 | 0.01754 | 0.9955 | 3947 | 0.3195 | -0.03178 | 0.06672 |
fixed | NA | count_birth_order>5/>5 | 0.02843 | 0.01179 | 2.412 | 3947 | 0.01592 | -0.004659 | 0.06152 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0000000083 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1668 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -2946 | -2877 | 1484 | -2968 | NA | NA | NA |
12 | -2944 | -2869 | 1484 | -2968 | 0.05022 | 1 | 0.8227 |
16 | -2940 | -2840 | 1486 | -2972 | 4.006 | 4 | 0.4052 |
26 | -2929 | -2765 | 1490 | -2981 | 8.27 | 10 | 0.6024 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1486 | 0.1065 | -1.395 | 4006 | 0.1631 | -0.4475 | 0.1504 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02007 | 0.01288 | 1.558 | 4006 | 0.1193 | -0.01609 | 0.05624 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007564 | 0.0004933 | -1.533 | 4006 | 0.1253 | -0.002141 | 0.0006283 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009311 | 0.000005958 | 1.563 | 4006 | 0.1182 | -0.000007413 | 0.00002604 |
fixed | NA | male | 0.006283 | 0.005263 | 1.194 | 4006 | 0.2326 | -0.00849 | 0.02106 |
fixed | NA | sibling_count3 | 0.00281 | 0.007829 | 0.3589 | 4006 | 0.7197 | -0.01917 | 0.02479 |
fixed | NA | sibling_count4 | -0.005559 | 0.008443 | -0.6585 | 4006 | 0.5103 | -0.02926 | 0.01814 |
fixed | NA | sibling_count5 | -0.005294 | 0.009292 | -0.5697 | 4006 | 0.5689 | -0.03138 | 0.02079 |
fixed | NA | sibling_count>5 | 0.01816 | 0.008216 | 2.21 | 4006 | 0.02715 | -0.004904 | 0.04122 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1666 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1523 | 0.1065 | -1.429 | 4005 | 0.153 | -0.4513 | 0.1468 |
fixed | NA | birth_order | 0.001729 | 0.001583 | 1.092 | 4005 | 0.2748 | -0.002715 | 0.006174 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02027 | 0.01289 | 1.573 | 4005 | 0.1157 | -0.0159 | 0.05644 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007663 | 0.0004934 | -1.553 | 4005 | 0.1205 | -0.002151 | 0.0006187 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009479 | 0.00000596 | 1.59 | 4005 | 0.1118 | -0.000007251 | 0.00002621 |
fixed | NA | male | 0.006291 | 0.005263 | 1.195 | 4005 | 0.232 | -0.008482 | 0.02106 |
fixed | NA | sibling_count3 | 0.00197 | 0.007866 | 0.2504 | 4005 | 0.8023 | -0.02011 | 0.02405 |
fixed | NA | sibling_count4 | -0.007413 | 0.008611 | -0.8609 | 4005 | 0.3894 | -0.03159 | 0.01676 |
fixed | NA | sibling_count5 | -0.008217 | 0.00967 | -0.8498 | 4005 | 0.3955 | -0.03536 | 0.01893 |
fixed | NA | sibling_count>5 | 0.01149 | 0.01024 | 1.122 | 4005 | 0.2619 | -0.01725 | 0.04023 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000003507 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1666 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1515 | 0.1067 | -1.42 | 4001 | 0.1556 | -0.4509 | 0.1479 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02036 | 0.0129 | 1.579 | 4001 | 0.1145 | -0.01584 | 0.05656 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007676 | 0.0004938 | -1.554 | 4001 | 0.1202 | -0.002154 | 0.0006187 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009457 | 0.000005966 | 1.585 | 4001 | 0.113 | -0.000007289 | 0.0000262 |
fixed | NA | male | 0.006342 | 0.005267 | 1.204 | 4001 | 0.2286 | -0.008443 | 0.02113 |
fixed | NA | sibling_count3 | 0.002582 | 0.008089 | 0.3193 | 4001 | 0.7495 | -0.02012 | 0.02529 |
fixed | NA | sibling_count4 | -0.004501 | 0.009063 | -0.4966 | 4001 | 0.6195 | -0.02994 | 0.02094 |
fixed | NA | sibling_count5 | -0.003395 | 0.01036 | -0.3278 | 4001 | 0.7431 | -0.03247 | 0.02568 |
fixed | NA | sibling_count>5 | 0.01573 | 0.01075 | 1.464 | 4001 | 0.1433 | -0.01444 | 0.04591 |
fixed | NA | birth_order_nonlinear2 | 0.001636 | 0.006938 | 0.2358 | 4001 | 0.8136 | -0.01784 | 0.02111 |
fixed | NA | birth_order_nonlinear3 | 0.0009229 | 0.008591 | 0.1074 | 4001 | 0.9145 | -0.02319 | 0.02504 |
fixed | NA | birth_order_nonlinear4 | -0.005306 | 0.01049 | -0.506 | 4001 | 0.6129 | -0.03474 | 0.02413 |
fixed | NA | birth_order_nonlinear5 | -0.003994 | 0.0136 | -0.2938 | 4001 | 0.7689 | -0.04216 | 0.03417 |
fixed | NA | birth_order_nonlinear>5 | 0.009254 | 0.0127 | 0.7289 | 4001 | 0.4661 | -0.02639 | 0.0449 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1666 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1472 | 0.1069 | -1.377 | 3991 | 0.1684 | -0.4471 | 0.1528 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02004 | 0.01292 | 1.552 | 3991 | 0.1208 | -0.01621 | 0.05629 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000755 | 0.0004946 | -1.527 | 3991 | 0.1269 | -0.002143 | 0.0006333 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009301 | 0.000005975 | 1.557 | 3991 | 0.1196 | -0.000007469 | 0.00002607 |
fixed | NA | male | 0.006449 | 0.005273 | 1.223 | 3991 | 0.2214 | -0.008353 | 0.02125 |
fixed | NA | count_birth_order2/2 | -0.003815 | 0.01228 | -0.3108 | 3991 | 0.756 | -0.03827 | 0.03064 |
fixed | NA | count_birth_order1/3 | -0.003669 | 0.01069 | -0.3433 | 3991 | 0.7314 | -0.03367 | 0.02633 |
fixed | NA | count_birth_order2/3 | 0.007273 | 0.0116 | 0.6268 | 3991 | 0.5308 | -0.0253 | 0.03984 |
fixed | NA | count_birth_order3/3 | 0.003067 | 0.01296 | 0.2366 | 3991 | 0.813 | -0.03332 | 0.03945 |
fixed | NA | count_birth_order1/4 | 0.0007049 | 0.01346 | 0.05236 | 3991 | 0.9582 | -0.03708 | 0.03849 |
fixed | NA | count_birth_order2/4 | 0.001997 | 0.01358 | 0.147 | 3991 | 0.8831 | -0.03612 | 0.04011 |
fixed | NA | count_birth_order3/4 | -0.02048 | 0.01513 | -1.354 | 3991 | 0.1759 | -0.06296 | 0.02199 |
fixed | NA | count_birth_order4/4 | -0.01489 | 0.01471 | -1.012 | 3991 | 0.3116 | -0.05618 | 0.0264 |
fixed | NA | count_birth_order1/5 | -0.01108 | 0.01672 | -0.6626 | 3991 | 0.5076 | -0.05802 | 0.03586 |
fixed | NA | count_birth_order2/5 | -0.005183 | 0.01899 | -0.2729 | 3991 | 0.7849 | -0.05849 | 0.04812 |
fixed | NA | count_birth_order3/5 | -0.008834 | 0.01738 | -0.5082 | 3991 | 0.6113 | -0.05763 | 0.03996 |
fixed | NA | count_birth_order4/5 | -0.008066 | 0.0178 | -0.4531 | 3991 | 0.6505 | -0.05804 | 0.04191 |
fixed | NA | count_birth_order5/5 | 0.0008635 | 0.01743 | 0.04954 | 3991 | 0.9605 | -0.04806 | 0.04979 |
fixed | NA | count_birth_order1/>5 | 0.0153 | 0.01781 | 0.8591 | 3991 | 0.3903 | -0.03469 | 0.06529 |
fixed | NA | count_birth_order2/>5 | -0.006775 | 0.01984 | -0.3415 | 3991 | 0.7328 | -0.06247 | 0.04892 |
fixed | NA | count_birth_order3/>5 | 0.04067 | 0.01842 | 2.208 | 3991 | 0.02731 | -0.01104 | 0.09237 |
fixed | NA | count_birth_order4/>5 | 0.01091 | 0.01658 | 0.6578 | 3991 | 0.5107 | -0.03564 | 0.05745 |
fixed | NA | count_birth_order5/>5 | -0.0003145 | 0.01759 | -0.01788 | 3991 | 0.9857 | -0.0497 | 0.04907 |
fixed | NA | count_birth_order>5/>5 | 0.02317 | 0.01124 | 2.062 | 3991 | 0.03928 | -0.008374 | 0.05472 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1667 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -2986 | -2917 | 1504 | -3008 | NA | NA | NA |
12 | -2985 | -2910 | 1505 | -3009 | 1.196 | 1 | 0.2742 |
16 | -2977 | -2877 | 1505 | -3009 | 0.2612 | 4 | 0.9922 |
26 | -2965 | -2802 | 1509 | -3017 | 7.849 | 10 | 0.6436 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1524 | 0.1069 | -1.425 | 3877 | 0.1543 | -0.4526 | 0.1478 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02052 | 0.01293 | 1.587 | 3877 | 0.1127 | -0.01578 | 0.05682 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007638 | 0.0004946 | -1.544 | 3877 | 0.1226 | -0.002152 | 0.0006246 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000093 | 0.000005968 | 1.558 | 3877 | 0.1193 | -0.000007453 | 0.00002605 |
fixed | NA | male | 0.004826 | 0.005319 | 0.9073 | 3877 | 0.3643 | -0.0101 | 0.01976 |
fixed | NA | sibling_count3 | -0.001595 | 0.00716 | -0.2227 | 3877 | 0.8238 | -0.02169 | 0.0185 |
fixed | NA | sibling_count4 | -0.007724 | 0.008028 | -0.9621 | 3877 | 0.3361 | -0.03026 | 0.01481 |
fixed | NA | sibling_count5 | 0.002436 | 0.009835 | 0.2477 | 3877 | 0.8044 | -0.02517 | 0.03004 |
fixed | NA | sibling_count>5 | 0.02079 | 0.008775 | 2.37 | 3877 | 0.01786 | -0.003839 | 0.04542 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1656 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1561 | 0.107 | -1.459 | 3876 | 0.1447 | -0.4565 | 0.1443 |
fixed | NA | birth_order | 0.002012 | 0.001944 | 1.035 | 3876 | 0.3008 | -0.003445 | 0.00747 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02069 | 0.01293 | 1.599 | 3876 | 0.1098 | -0.01562 | 0.05699 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007734 | 0.0004947 | -1.563 | 3876 | 0.118 | -0.002162 | 0.0006152 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000948 | 0.000005971 | 1.588 | 3876 | 0.1124 | -0.00000728 | 0.00002624 |
fixed | NA | male | 0.004883 | 0.005319 | 0.9181 | 3876 | 0.3586 | -0.01005 | 0.01981 |
fixed | NA | sibling_count3 | -0.002519 | 0.007215 | -0.3492 | 3876 | 0.727 | -0.02277 | 0.01773 |
fixed | NA | sibling_count4 | -0.00991 | 0.008301 | -1.194 | 3876 | 0.2327 | -0.03321 | 0.01339 |
fixed | NA | sibling_count5 | -0.001106 | 0.01041 | -0.1062 | 3876 | 0.9154 | -0.03034 | 0.02812 |
fixed | NA | sibling_count>5 | 0.01253 | 0.01187 | 1.056 | 3876 | 0.2912 | -0.02078 | 0.04583 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1656 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1555 | 0.1071 | -1.451 | 3872 | 0.1468 | -0.4562 | 0.1452 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02077 | 0.01294 | 1.605 | 3872 | 0.1087 | -0.01556 | 0.0571 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0007756 | 0.000495 | -1.567 | 3872 | 0.1173 | -0.002165 | 0.000614 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009493 | 0.000005975 | 1.589 | 3872 | 0.1122 | -0.00000728 | 0.00002627 |
fixed | NA | male | 0.004933 | 0.005323 | 0.9269 | 3872 | 0.3541 | -0.01001 | 0.01987 |
fixed | NA | sibling_count3 | -0.002476 | 0.007436 | -0.333 | 3872 | 0.7391 | -0.02335 | 0.0184 |
fixed | NA | sibling_count4 | -0.006352 | 0.008807 | -0.7213 | 3872 | 0.4707 | -0.03107 | 0.01837 |
fixed | NA | sibling_count5 | 0.005045 | 0.01113 | 0.4534 | 3872 | 0.6503 | -0.02619 | 0.03628 |
fixed | NA | sibling_count>5 | 0.0149 | 0.01266 | 1.177 | 3872 | 0.2394 | -0.02064 | 0.05044 |
fixed | NA | birth_order_nonlinear2 | 0.003457 | 0.006762 | 0.5112 | 3872 | 0.6092 | -0.01553 | 0.02244 |
fixed | NA | birth_order_nonlinear3 | 0.004017 | 0.008668 | 0.4635 | 3872 | 0.6431 | -0.02031 | 0.02835 |
fixed | NA | birth_order_nonlinear4 | -0.009119 | 0.01146 | -0.7957 | 3872 | 0.4263 | -0.04129 | 0.02305 |
fixed | NA | birth_order_nonlinear5 | -0.003768 | 0.0153 | -0.2462 | 3872 | 0.8055 | -0.04673 | 0.03919 |
fixed | NA | birth_order_nonlinear>5 | 0.01701 | 0.01547 | 1.1 | 3872 | 0.2716 | -0.02642 | 0.06045 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1656 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1605 | 0.1074 | -1.495 | 3862 | 0.1351 | -0.462 | 0.141 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02159 | 0.01297 | 1.664 | 3862 | 0.09624 | -0.01483 | 0.05801 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0008016 | 0.0004963 | -1.615 | 3862 | 0.1064 | -0.002195 | 0.0005916 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000009745 | 0.000005992 | 1.626 | 3862 | 0.104 | -0.000007075 | 0.00002656 |
fixed | NA | male | 0.005014 | 0.005333 | 0.9402 | 3862 | 0.3472 | -0.009956 | 0.01998 |
fixed | NA | count_birth_order2/2 | -0.004404 | 0.0109 | -0.404 | 3862 | 0.6862 | -0.035 | 0.02619 |
fixed | NA | count_birth_order1/3 | -0.01262 | 0.009776 | -1.291 | 3862 | 0.1968 | -0.04006 | 0.01482 |
fixed | NA | count_birth_order2/3 | 0.003637 | 0.01089 | 0.334 | 3862 | 0.7384 | -0.02693 | 0.03421 |
fixed | NA | count_birth_order3/3 | 0.005645 | 0.01197 | 0.4714 | 3862 | 0.6374 | -0.02797 | 0.03926 |
fixed | NA | count_birth_order1/4 | -0.004056 | 0.01325 | -0.3062 | 3862 | 0.7595 | -0.04124 | 0.03313 |
fixed | NA | count_birth_order2/4 | -0.001733 | 0.01367 | -0.1268 | 3862 | 0.8991 | -0.0401 | 0.03663 |
fixed | NA | count_birth_order3/4 | -0.01717 | 0.01406 | -1.222 | 3862 | 0.222 | -0.05662 | 0.02229 |
fixed | NA | count_birth_order4/4 | -0.01619 | 0.01435 | -1.128 | 3862 | 0.2594 | -0.05646 | 0.02409 |
fixed | NA | count_birth_order1/5 | 0.006246 | 0.01912 | 0.3266 | 3862 | 0.744 | -0.04743 | 0.05992 |
fixed | NA | count_birth_order2/5 | 0.0009551 | 0.02176 | 0.04389 | 3862 | 0.965 | -0.06014 | 0.06205 |
fixed | NA | count_birth_order3/5 | 0.009442 | 0.01987 | 0.4752 | 3862 | 0.6347 | -0.04634 | 0.06522 |
fixed | NA | count_birth_order4/5 | 0.003884 | 0.01857 | 0.2091 | 3862 | 0.8344 | -0.04826 | 0.05602 |
fixed | NA | count_birth_order5/5 | -0.01661 | 0.0193 | -0.8607 | 3862 | 0.3895 | -0.0708 | 0.03757 |
fixed | NA | count_birth_order1/>5 | 0.02319 | 0.02464 | 0.9411 | 3862 | 0.3467 | -0.04598 | 0.09237 |
fixed | NA | count_birth_order2/>5 | 0.005438 | 0.02432 | 0.2236 | 3862 | 0.8231 | -0.06283 | 0.0737 |
fixed | NA | count_birth_order3/>5 | 0.01683 | 0.02315 | 0.7271 | 3862 | 0.4672 | -0.04815 | 0.0818 |
fixed | NA | count_birth_order4/>5 | -0.01712 | 0.02153 | -0.7949 | 3862 | 0.4267 | -0.07756 | 0.04333 |
fixed | NA | count_birth_order5/>5 | 0.02131 | 0.01811 | 1.177 | 3862 | 0.2393 | -0.02952 | 0.07214 |
fixed | NA | count_birth_order>5/>5 | 0.02908 | 0.01199 | 2.425 | 3862 | 0.01534 | -0.004578 | 0.06273 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000004709 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1657 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -2935 | -2866 | 1478 | -2957 | NA | NA | NA |
12 | -2934 | -2859 | 1479 | -2958 | 1.074 | 1 | 0.3001 |
16 | -2928 | -2828 | 1480 | -2960 | 2.375 | 4 | 0.6672 |
26 | -2915 | -2752 | 1483 | -2967 | 6.831 | 10 | 0.7413 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = Elementary_worked)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07964 | 0.08885 | -0.8964 | 7460 | 0.3701 | -0.3291 | 0.1698 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00962 | 0.01022 | 0.9411 | 7478 | 0.3467 | -0.01907 | 0.03831 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003134 | 0.0003703 | -0.8464 | 7496 | 0.3974 | -0.001353 | 0.000726 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004026 | 0.00000423 | 0.9519 | 7508 | 0.3412 | -0.000007846 | 0.0000159 |
fixed | NA | male | 0.03192 | 0.005231 | 6.103 | 7480 | 0.000000001094 | 0.01724 | 0.04661 |
fixed | NA | sibling_count3 | -0.008452 | 0.009849 | -0.8582 | 6513 | 0.3908 | -0.0361 | 0.01919 |
fixed | NA | sibling_count4 | 0.00381 | 0.01018 | 0.3744 | 6259 | 0.7081 | -0.02475 | 0.03237 |
fixed | NA | sibling_count5 | 0.01119 | 0.01059 | 1.057 | 5819 | 0.2907 | -0.01853 | 0.0409 |
fixed | NA | sibling_count>5 | 0.03482 | 0.008449 | 4.122 | 6134 | 0.00003812 | 0.01111 | 0.05854 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08269 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2132 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07986 | 0.08885 | -0.8988 | 7460 | 0.3688 | -0.3293 | 0.1696 |
fixed | NA | birth_order | 0.0009563 | 0.001108 | 0.8631 | 6682 | 0.3881 | -0.002154 | 0.004066 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009444 | 0.01022 | 0.9236 | 7477 | 0.3557 | -0.01926 | 0.03815 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003064 | 0.0003704 | -0.8273 | 7496 | 0.4081 | -0.001346 | 0.0007332 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003962 | 0.00000423 | 0.9364 | 7509 | 0.3491 | -0.000007913 | 0.00001584 |
fixed | NA | male | 0.03195 | 0.005231 | 6.108 | 7479 | 0.000000001057 | 0.01727 | 0.04664 |
fixed | NA | sibling_count3 | -0.008806 | 0.009856 | -0.8934 | 6515 | 0.3717 | -0.03647 | 0.01886 |
fixed | NA | sibling_count4 | 0.002898 | 0.01023 | 0.2833 | 6262 | 0.777 | -0.02582 | 0.03161 |
fixed | NA | sibling_count5 | 0.009665 | 0.01073 | 0.9007 | 5807 | 0.3678 | -0.02046 | 0.03979 |
fixed | NA | sibling_count>5 | 0.03038 | 0.009896 | 3.069 | 6192 | 0.002154 | 0.002597 | 0.05816 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08257 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2133 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0841 | 0.08913 | -0.9436 | 7479 | 0.3454 | -0.3343 | 0.1661 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009802 | 0.01024 | 0.9574 | 7489 | 0.3384 | -0.01894 | 0.03854 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003176 | 0.0003709 | -0.8565 | 7504 | 0.3918 | -0.001359 | 0.0007234 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004062 | 0.000004236 | 0.9589 | 7514 | 0.3376 | -0.000007828 | 0.00001595 |
fixed | NA | male | 0.03209 | 0.005232 | 6.133 | 7475 | 0.000000000905 | 0.0174 | 0.04678 |
fixed | NA | sibling_count3 | -0.008324 | 0.01002 | -0.8303 | 6630 | 0.4064 | -0.03646 | 0.01982 |
fixed | NA | sibling_count4 | 0.006027 | 0.01067 | 0.5647 | 6544 | 0.5723 | -0.02393 | 0.03599 |
fixed | NA | sibling_count5 | 0.01112 | 0.01139 | 0.9759 | 6225 | 0.3291 | -0.02086 | 0.04309 |
fixed | NA | sibling_count>5 | 0.0318 | 0.01067 | 2.979 | 6720 | 0.002901 | 0.001837 | 0.06175 |
fixed | NA | birth_order_nonlinear2 | 0.006231 | 0.007625 | 0.8172 | 6954 | 0.4139 | -0.01517 | 0.02763 |
fixed | NA | birth_order_nonlinear3 | 0.0001958 | 0.009161 | 0.02138 | 7069 | 0.9829 | -0.02552 | 0.02591 |
fixed | NA | birth_order_nonlinear4 | -0.008989 | 0.01056 | -0.8511 | 7141 | 0.3947 | -0.03864 | 0.02066 |
fixed | NA | birth_order_nonlinear5 | 0.01249 | 0.01183 | 1.056 | 7243 | 0.2911 | -0.02071 | 0.04569 |
fixed | NA | birth_order_nonlinear>5 | 0.007857 | 0.01017 | 0.7724 | 7531 | 0.4399 | -0.0207 | 0.03641 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08259 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2133 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.08246 | 0.08926 | -0.9238 | 7472 | 0.3556 | -0.333 | 0.1681 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009748 | 0.01024 | 0.952 | 7480 | 0.3412 | -0.019 | 0.03849 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003177 | 0.000371 | -0.8564 | 7495 | 0.3918 | -0.001359 | 0.0007237 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004095 | 0.000004238 | 0.9664 | 7505 | 0.3339 | -0.0000078 | 0.00001599 |
fixed | NA | male | 0.03227 | 0.005234 | 6.167 | 7465 | 0.0000000007337 | 0.01758 | 0.04697 |
fixed | NA | count_birth_order2/2 | 0.00326 | 0.01454 | 0.2242 | 7097 | 0.8226 | -0.03755 | 0.04407 |
fixed | NA | count_birth_order1/3 | -0.004176 | 0.013 | -0.3212 | 7516 | 0.748 | -0.04067 | 0.03232 |
fixed | NA | count_birth_order2/3 | 0.0007817 | 0.01446 | 0.05408 | 7534 | 0.9569 | -0.0398 | 0.04136 |
fixed | NA | count_birth_order3/3 | -0.02654 | 0.01664 | -1.595 | 7537 | 0.1108 | -0.07326 | 0.02017 |
fixed | NA | count_birth_order1/4 | 0.001379 | 0.01533 | 0.08991 | 7533 | 0.9284 | -0.04167 | 0.04442 |
fixed | NA | count_birth_order2/4 | 0.01607 | 0.01589 | 1.011 | 7537 | 0.3118 | -0.02853 | 0.06068 |
fixed | NA | count_birth_order3/4 | 0.001507 | 0.01716 | 0.08783 | 7536 | 0.93 | -0.04666 | 0.04968 |
fixed | NA | count_birth_order4/4 | -0.00101 | 0.01778 | -0.05678 | 7537 | 0.9547 | -0.05093 | 0.04891 |
fixed | NA | count_birth_order1/5 | 0.02121 | 0.01767 | 1.2 | 7537 | 0.2302 | -0.0284 | 0.07082 |
fixed | NA | count_birth_order2/5 | 0.008517 | 0.01889 | 0.451 | 7527 | 0.652 | -0.0445 | 0.06153 |
fixed | NA | count_birth_order3/5 | -0.004503 | 0.01857 | -0.2426 | 7523 | 0.8084 | -0.05662 | 0.04761 |
fixed | NA | count_birth_order4/5 | 0.01404 | 0.01963 | 0.7155 | 7522 | 0.4743 | -0.04106 | 0.06914 |
fixed | NA | count_birth_order5/5 | 0.02075 | 0.01878 | 1.105 | 7533 | 0.2694 | -0.03198 | 0.07347 |
fixed | NA | count_birth_order1/>5 | 0.01348 | 0.01626 | 0.829 | 7520 | 0.4071 | -0.03217 | 0.05914 |
fixed | NA | count_birth_order2/>5 | 0.03364 | 0.01647 | 2.043 | 7520 | 0.0411 | -0.01258 | 0.07987 |
fixed | NA | count_birth_order3/>5 | 0.05796 | 0.0158 | 3.669 | 7510 | 0.0002454 | 0.01361 | 0.1023 |
fixed | NA | count_birth_order4/>5 | 0.01383 | 0.01495 | 0.9249 | 7514 | 0.355 | -0.02814 | 0.05581 |
fixed | NA | count_birth_order5/>5 | 0.04418 | 0.01434 | 3.08 | 7522 | 0.00208 | 0.00391 | 0.08444 |
fixed | NA | count_birth_order>5/>5 | 0.03869 | 0.01059 | 3.654 | 7264 | 0.0002602 | 0.008965 | 0.0684 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08253 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2133 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -891.6 | -815.4 | 456.8 | -913.6 | NA | NA | NA |
12 | -890.4 | -807.2 | 457.2 | -914.4 | 0.7467 | 1 | 0.3875 |
16 | -885.9 | -775 | 458.9 | -917.9 | 3.481 | 4 | 0.4807 |
26 | -877 | -696.8 | 464.5 | -929 | 11.14 | 10 | 0.3467 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01121 | 0.12 | 0.09338 | 3918 | 0.9256 | -0.3257 | 0.3481 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0008552 | 0.01454 | -0.05884 | 3928 | 0.9531 | -0.04166 | 0.03995 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0000577 | 0.0005569 | 0.1036 | 3939 | 0.9175 | -0.001506 | 0.001621 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001182 | 0.000006732 | -0.1755 | 3949 | 0.8607 | -0.00002008 | 0.00001772 |
fixed | NA | male | 0.02491 | 0.005955 | 4.183 | 3935 | 0.00002942 | 0.008193 | 0.04163 |
fixed | NA | sibling_count3 | 0.003041 | 0.008421 | 0.3611 | 3312 | 0.718 | -0.0206 | 0.02668 |
fixed | NA | sibling_count4 | 0.02978 | 0.00946 | 3.148 | 3099 | 0.001658 | 0.003228 | 0.05634 |
fixed | NA | sibling_count5 | 0.02227 | 0.01122 | 1.984 | 3015 | 0.04733 | -0.009237 | 0.05378 |
fixed | NA | sibling_count>5 | 0.0533 | 0.01018 | 5.234 | 2763 | 0.0000001787 | 0.02472 | 0.08189 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07007 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.175 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01518 | 0.1201 | 0.1263 | 3920 | 0.8995 | -0.322 | 0.3524 |
fixed | NA | birth_order | -0.001798 | 0.002186 | -0.8224 | 3737 | 0.4109 | -0.007934 | 0.004338 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001049 | 0.01454 | -0.07217 | 3928 | 0.9425 | -0.04186 | 0.03976 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00006671 | 0.000557 | 0.1198 | 3939 | 0.9047 | -0.001497 | 0.00163 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001341 | 0.000006735 | -0.1991 | 3948 | 0.8422 | -0.00002025 | 0.00001756 |
fixed | NA | male | 0.02488 | 0.005956 | 4.178 | 3934 | 0.00003003 | 0.008165 | 0.0416 |
fixed | NA | sibling_count3 | 0.003896 | 0.008485 | 0.4591 | 3310 | 0.6462 | -0.01992 | 0.02771 |
fixed | NA | sibling_count4 | 0.03179 | 0.00977 | 3.254 | 3089 | 0.001151 | 0.004366 | 0.05921 |
fixed | NA | sibling_count5 | 0.02563 | 0.01194 | 2.146 | 3024 | 0.03197 | -0.007897 | 0.05915 |
fixed | NA | sibling_count>5 | 0.0608 | 0.01367 | 4.448 | 2965 | 0.000008989 | 0.02243 | 0.09918 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1751 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01003 | 0.1203 | 0.0834 | 3922 | 0.9335 | -0.3277 | 0.3478 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.00082 | 0.01455 | -0.05634 | 3928 | 0.9551 | -0.04168 | 0.04004 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00005832 | 0.0005576 | 0.1046 | 3937 | 0.9167 | -0.001507 | 0.001624 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001221 | 0.000006742 | -0.181 | 3946 | 0.8563 | -0.00002015 | 0.0000177 |
fixed | NA | male | 0.02492 | 0.00596 | 4.182 | 3930 | 0.00002952 | 0.008195 | 0.04165 |
fixed | NA | sibling_count3 | 0.002344 | 0.008719 | 0.2688 | 3405 | 0.7881 | -0.02213 | 0.02682 |
fixed | NA | sibling_count4 | 0.03282 | 0.0103 | 3.186 | 3262 | 0.001456 | 0.003905 | 0.06173 |
fixed | NA | sibling_count5 | 0.02701 | 0.01274 | 2.121 | 3255 | 0.03402 | -0.008741 | 0.06276 |
fixed | NA | sibling_count>5 | 0.05584 | 0.01442 | 3.871 | 3144 | 0.0001104 | 0.01535 | 0.09633 |
fixed | NA | birth_order_nonlinear2 | 0.001738 | 0.007499 | 0.2318 | 3389 | 0.8167 | -0.01931 | 0.02279 |
fixed | NA | birth_order_nonlinear3 | 0.003074 | 0.009668 | 0.318 | 3735 | 0.7505 | -0.02406 | 0.03021 |
fixed | NA | birth_order_nonlinear4 | -0.01505 | 0.01247 | -1.206 | 3836 | 0.2277 | -0.05006 | 0.01996 |
fixed | NA | birth_order_nonlinear5 | -0.007201 | 0.01644 | -0.4379 | 3861 | 0.6615 | -0.05336 | 0.03896 |
fixed | NA | birth_order_nonlinear>5 | 0.001383 | 0.0171 | 0.0809 | 3914 | 0.9355 | -0.04662 | 0.04939 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07028 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.175 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.02475 | 0.1206 | 0.2052 | 3914 | 0.8374 | -0.3137 | 0.3632 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002739 | 0.01459 | -0.1878 | 3919 | 0.851 | -0.04368 | 0.0382 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001345 | 0.0005589 | 0.2407 | 3928 | 0.8098 | -0.001434 | 0.001703 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002188 | 0.000006758 | -0.3238 | 3937 | 0.7461 | -0.00002116 | 0.00001678 |
fixed | NA | male | 0.02456 | 0.005969 | 4.114 | 3919 | 0.00003972 | 0.0078 | 0.04131 |
fixed | NA | count_birth_order2/2 | 0.004317 | 0.01246 | 0.3465 | 3562 | 0.729 | -0.03066 | 0.03929 |
fixed | NA | count_birth_order1/3 | 0.003408 | 0.01118 | 0.3048 | 3945 | 0.7605 | -0.02798 | 0.03479 |
fixed | NA | count_birth_order2/3 | 0.006332 | 0.01223 | 0.5179 | 3947 | 0.6046 | -0.02799 | 0.04065 |
fixed | NA | count_birth_order3/3 | 0.004064 | 0.01367 | 0.2972 | 3947 | 0.7663 | -0.03432 | 0.04245 |
fixed | NA | count_birth_order1/4 | 0.03974 | 0.01488 | 2.671 | 3948 | 0.007602 | -0.00203 | 0.08151 |
fixed | NA | count_birth_order2/4 | 0.02834 | 0.0154 | 1.84 | 3940 | 0.0659 | -0.0149 | 0.07158 |
fixed | NA | count_birth_order3/4 | 0.02931 | 0.01621 | 1.808 | 3933 | 0.07065 | -0.01619 | 0.07482 |
fixed | NA | count_birth_order4/4 | 0.02599 | 0.01604 | 1.62 | 3947 | 0.1053 | -0.01904 | 0.07102 |
fixed | NA | count_birth_order1/5 | 0.00689 | 0.0216 | 0.319 | 3946 | 0.7498 | -0.05374 | 0.06753 |
fixed | NA | count_birth_order2/5 | 0.03487 | 0.02336 | 1.492 | 3913 | 0.1357 | -0.03071 | 0.1004 |
fixed | NA | count_birth_order3/5 | 0.0276 | 0.02126 | 1.298 | 3931 | 0.1943 | -0.03208 | 0.08728 |
fixed | NA | count_birth_order4/5 | 0.01066 | 0.01998 | 0.5339 | 3932 | 0.5935 | -0.04541 | 0.06674 |
fixed | NA | count_birth_order5/5 | 0.04122 | 0.02055 | 2.006 | 3943 | 0.04496 | -0.01647 | 0.09892 |
fixed | NA | count_birth_order1/>5 | 0.07669 | 0.02748 | 2.791 | 3897 | 0.005277 | -0.000436 | 0.1538 |
fixed | NA | count_birth_order2/>5 | 0.05725 | 0.02663 | 2.15 | 3898 | 0.03161 | -0.01749 | 0.132 |
fixed | NA | count_birth_order3/>5 | 0.09302 | 0.02448 | 3.799 | 3898 | 0.0001475 | 0.02429 | 0.1617 |
fixed | NA | count_birth_order4/>5 | 0.02899 | 0.02237 | 1.296 | 3894 | 0.1949 | -0.03379 | 0.09178 |
fixed | NA | count_birth_order5/>5 | 0.0316 | 0.01974 | 1.601 | 3915 | 0.1094 | -0.0238 | 0.087 |
fixed | NA | count_birth_order>5/>5 | 0.05784 | 0.01354 | 4.272 | 3737 | 0.00001987 | 0.01983 | 0.09585 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07014 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1751 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -1991 | -1922 | 1007 | -2013 | NA | NA | NA |
12 | -1990 | -1915 | 1007 | -2014 | 0.6787 | 1 | 0.41 |
16 | -1984 | -1883 | 1008 | -2016 | 1.76 | 4 | 0.7799 |
26 | -1971 | -1808 | 1012 | -2023 | 7.601 | 10 | 0.6677 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.0002828 | 0.1195 | 0.002366 | 3962 | 0.9981 | -0.3352 | 0.3358 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0006424 | 0.01447 | 0.04439 | 3972 | 0.9646 | -0.03998 | 0.04127 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000002017 | 0.0005547 | -0.003637 | 3983 | 0.9971 | -0.001559 | 0.001555 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000003936 | 0.000006707 | -0.05869 | 3993 | 0.9532 | -0.00001922 | 0.00001843 |
fixed | NA | male | 0.02545 | 0.005918 | 4.3 | 3978 | 0.00001749 | 0.008835 | 0.04206 |
fixed | NA | sibling_count3 | -0.002779 | 0.009064 | -0.3066 | 3402 | 0.7592 | -0.02822 | 0.02267 |
fixed | NA | sibling_count4 | 0.02307 | 0.009816 | 2.35 | 3263 | 0.01884 | -0.004487 | 0.05062 |
fixed | NA | sibling_count5 | 0.02523 | 0.01087 | 2.321 | 3044 | 0.02033 | -0.005278 | 0.05573 |
fixed | NA | sibling_count>5 | 0.03975 | 0.009611 | 4.136 | 3090 | 0.00003634 | 0.01277 | 0.06673 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07022 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1748 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.001055 | 0.1196 | 0.008822 | 3964 | 0.993 | -0.3347 | 0.3368 |
fixed | NA | birth_order | -0.0003297 | 0.001834 | -0.1797 | 3665 | 0.8574 | -0.005479 | 0.004819 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.000602 | 0.01448 | 0.04159 | 3972 | 0.9668 | -0.04003 | 0.04124 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0000002517 | 0.0005548 | -0.0004536 | 3982 | 0.9996 | -0.001558 | 0.001557 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000423 | 0.00000671 | -0.06305 | 3992 | 0.9497 | -0.00001926 | 0.00001841 |
fixed | NA | male | 0.02545 | 0.005918 | 4.299 | 3977 | 0.00001753 | 0.008833 | 0.04206 |
fixed | NA | sibling_count3 | -0.002616 | 0.009111 | -0.2872 | 3397 | 0.774 | -0.02819 | 0.02296 |
fixed | NA | sibling_count4 | 0.02343 | 0.01002 | 2.338 | 3242 | 0.01946 | -0.004702 | 0.05156 |
fixed | NA | sibling_count5 | 0.02579 | 0.01132 | 2.279 | 3035 | 0.02273 | -0.005975 | 0.05756 |
fixed | NA | sibling_count>5 | 0.04103 | 0.01196 | 3.43 | 3190 | 0.0006104 | 0.007455 | 0.0746 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07023 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1748 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.00532 | 0.1198 | -0.04442 | 3966 | 0.9646 | -0.3415 | 0.3309 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00107 | 0.01449 | 0.07384 | 3972 | 0.9411 | -0.0396 | 0.04174 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00001789 | 0.0005553 | -0.03221 | 3981 | 0.9743 | -0.001577 | 0.001541 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000001971 | 0.000006716 | -0.02934 | 3990 | 0.9766 | -0.00001905 | 0.00001865 |
fixed | NA | male | 0.02563 | 0.005921 | 4.329 | 3973 | 0.00001537 | 0.00901 | 0.04225 |
fixed | NA | sibling_count3 | -0.002255 | 0.009346 | -0.2413 | 3477 | 0.8093 | -0.02849 | 0.02398 |
fixed | NA | sibling_count4 | 0.0258 | 0.0105 | 2.456 | 3383 | 0.0141 | -0.003687 | 0.05529 |
fixed | NA | sibling_count5 | 0.02825 | 0.01205 | 2.344 | 3245 | 0.01913 | -0.005579 | 0.06208 |
fixed | NA | sibling_count>5 | 0.03817 | 0.01249 | 3.057 | 3382 | 0.002253 | 0.003122 | 0.07322 |
fixed | NA | birth_order_nonlinear2 | 0.00555 | 0.007641 | 0.7263 | 3474 | 0.4677 | -0.0159 | 0.027 |
fixed | NA | birth_order_nonlinear3 | -0.002217 | 0.009564 | -0.2318 | 3800 | 0.8167 | -0.02906 | 0.02463 |
fixed | NA | birth_order_nonlinear4 | -0.008889 | 0.01172 | -0.7585 | 3890 | 0.4482 | -0.04179 | 0.02401 |
fixed | NA | birth_order_nonlinear5 | 0.00004574 | 0.01522 | 0.003004 | 3917 | 0.9976 | -0.04269 | 0.04278 |
fixed | NA | birth_order_nonlinear>5 | 0.01021 | 0.01449 | 0.7042 | 3945 | 0.4813 | -0.03048 | 0.05089 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07045 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1747 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.001061 | 0.12 | 0.008841 | 3959 | 0.9929 | -0.3359 | 0.338 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0001726 | 0.01452 | 0.01189 | 3964 | 0.9905 | -0.04058 | 0.04092 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001582 | 0.0005564 | 0.02843 | 3972 | 0.9773 | -0.001546 | 0.001578 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000005898 | 0.000006729 | -0.08766 | 3981 | 0.9302 | -0.00001948 | 0.0000183 |
fixed | NA | male | 0.02548 | 0.005931 | 4.297 | 3964 | 0.00001775 | 0.008835 | 0.04213 |
fixed | NA | count_birth_order2/2 | 0.008978 | 0.01357 | 0.6614 | 3612 | 0.5084 | -0.02913 | 0.04708 |
fixed | NA | count_birth_order1/3 | 0.003922 | 0.01206 | 0.3251 | 3989 | 0.7451 | -0.02994 | 0.03779 |
fixed | NA | count_birth_order2/3 | 0.0002864 | 0.01308 | 0.02189 | 3992 | 0.9825 | -0.03643 | 0.037 |
fixed | NA | count_birth_order3/3 | -0.007098 | 0.01461 | -0.4859 | 3991 | 0.6271 | -0.0481 | 0.03391 |
fixed | NA | count_birth_order1/4 | 0.02279 | 0.01518 | 1.501 | 3992 | 0.1335 | -0.01984 | 0.06541 |
fixed | NA | count_birth_order2/4 | 0.02978 | 0.0153 | 1.946 | 3990 | 0.0517 | -0.01317 | 0.07274 |
fixed | NA | count_birth_order3/4 | 0.01887 | 0.01703 | 1.108 | 3977 | 0.2679 | -0.02893 | 0.06667 |
fixed | NA | count_birth_order4/4 | 0.03166 | 0.01658 | 1.91 | 3992 | 0.05627 | -0.01488 | 0.0782 |
fixed | NA | count_birth_order1/5 | 0.03335 | 0.01886 | 1.768 | 3992 | 0.07708 | -0.01959 | 0.08628 |
fixed | NA | count_birth_order2/5 | 0.04802 | 0.02126 | 2.259 | 3953 | 0.02394 | -0.01165 | 0.1077 |
fixed | NA | count_birth_order3/5 | 0.02118 | 0.01957 | 1.083 | 3976 | 0.279 | -0.03374 | 0.07611 |
fixed | NA | count_birth_order4/5 | 0.01393 | 0.02002 | 0.6957 | 3966 | 0.4867 | -0.04227 | 0.07012 |
fixed | NA | count_birth_order5/5 | 0.02655 | 0.01963 | 1.353 | 3986 | 0.1762 | -0.02854 | 0.08164 |
fixed | NA | count_birth_order1/>5 | 0.02823 | 0.02007 | 1.407 | 3985 | 0.1596 | -0.02811 | 0.08456 |
fixed | NA | count_birth_order2/>5 | 0.0452 | 0.02232 | 2.025 | 3953 | 0.04292 | -0.01745 | 0.1079 |
fixed | NA | count_birth_order3/>5 | 0.06224 | 0.02072 | 3.003 | 3965 | 0.002687 | 0.004069 | 0.1204 |
fixed | NA | count_birth_order4/>5 | 0.01788 | 0.01865 | 0.9585 | 3966 | 0.3379 | -0.03448 | 0.07023 |
fixed | NA | count_birth_order5/>5 | 0.04218 | 0.01978 | 2.132 | 3960 | 0.03305 | -0.01335 | 0.09772 |
fixed | NA | count_birth_order>5/>5 | 0.04944 | 0.01289 | 3.835 | 3796 | 0.0001278 | 0.01325 | 0.08564 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0702 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1749 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -2022 | -1953 | 1022 | -2044 | NA | NA | NA |
12 | -2020 | -1945 | 1022 | -2044 | 0.03257 | 1 | 0.8568 |
16 | -2015 | -1914 | 1023 | -2047 | 2.509 | 4 | 0.6429 |
26 | -2000 | -1837 | 1026 | -2052 | 5.464 | 10 | 0.8581 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01789 | 0.1209 | 0.148 | 3834 | 0.8823 | -0.3214 | 0.3572 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001561 | 0.01463 | -0.1067 | 3844 | 0.9151 | -0.04263 | 0.0395 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008934 | 0.0005601 | 0.1595 | 3855 | 0.8733 | -0.001483 | 0.001661 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001613 | 0.000006766 | -0.2384 | 3865 | 0.8116 | -0.00002061 | 0.00001738 |
fixed | NA | male | 0.02612 | 0.006023 | 4.337 | 3849 | 0.0000148 | 0.009216 | 0.04303 |
fixed | NA | sibling_count3 | 0.0007046 | 0.008364 | 0.08425 | 3225 | 0.9329 | -0.02277 | 0.02418 |
fixed | NA | sibling_count4 | 0.021 | 0.009442 | 2.224 | 3009 | 0.02622 | -0.005504 | 0.0475 |
fixed | NA | sibling_count5 | 0.02668 | 0.01162 | 2.295 | 2866 | 0.02181 | -0.005952 | 0.0593 |
fixed | NA | sibling_count>5 | 0.05476 | 0.01044 | 5.245 | 2673 | 0.0000001689 | 0.02545 | 0.08406 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07021 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1751 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.02227 | 0.121 | 0.1841 | 3836 | 0.8539 | -0.3173 | 0.3618 |
fixed | NA | birth_order | -0.002079 | 0.00225 | -0.9241 | 3712 | 0.3555 | -0.008395 | 0.004236 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001768 | 0.01463 | -0.1208 | 3844 | 0.9039 | -0.04284 | 0.0393 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009948 | 0.0005602 | 0.1776 | 3854 | 0.8591 | -0.001473 | 0.001672 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001796 | 0.000006769 | -0.2653 | 3864 | 0.7908 | -0.0000208 | 0.0000172 |
fixed | NA | male | 0.02607 | 0.006024 | 4.328 | 3848 | 0.0000154 | 0.009164 | 0.04298 |
fixed | NA | sibling_count3 | 0.001673 | 0.008429 | 0.1985 | 3222 | 0.8426 | -0.02199 | 0.02533 |
fixed | NA | sibling_count4 | 0.02331 | 0.009766 | 2.387 | 3005 | 0.01707 | -0.004107 | 0.05072 |
fixed | NA | sibling_count5 | 0.03041 | 0.0123 | 2.471 | 2887 | 0.01352 | -0.00413 | 0.06494 |
fixed | NA | sibling_count>5 | 0.06342 | 0.01403 | 4.52 | 2945 | 0.000006415 | 0.02404 | 0.1028 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07014 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1751 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.0182 | 0.1212 | 0.1502 | 3840 | 0.8806 | -0.3219 | 0.3583 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001587 | 0.01465 | -0.1083 | 3844 | 0.9137 | -0.0427 | 0.03953 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009018 | 0.0005608 | 0.1608 | 3853 | 0.8722 | -0.001484 | 0.001664 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001632 | 0.000006776 | -0.2409 | 3861 | 0.8097 | -0.00002065 | 0.00001739 |
fixed | NA | male | 0.02602 | 0.006028 | 4.317 | 3843 | 0.00001621 | 0.009102 | 0.04294 |
fixed | NA | sibling_count3 | 0.000491 | 0.008668 | 0.05664 | 3313 | 0.9548 | -0.02384 | 0.02482 |
fixed | NA | sibling_count4 | 0.02332 | 0.01032 | 2.261 | 3182 | 0.02385 | -0.005636 | 0.05228 |
fixed | NA | sibling_count5 | 0.03303 | 0.01308 | 2.526 | 3101 | 0.01159 | -0.003676 | 0.06974 |
fixed | NA | sibling_count>5 | 0.0583 | 0.01491 | 3.911 | 3135 | 0.00009367 | 0.01646 | 0.1001 |
fixed | NA | birth_order_nonlinear2 | 0.0002169 | 0.007492 | 0.02895 | 3300 | 0.9769 | -0.02081 | 0.02125 |
fixed | NA | birth_order_nonlinear3 | 0.001036 | 0.009708 | 0.1067 | 3644 | 0.915 | -0.02621 | 0.02829 |
fixed | NA | birth_order_nonlinear4 | -0.01089 | 0.01288 | -0.8453 | 3728 | 0.398 | -0.04706 | 0.02528 |
fixed | NA | birth_order_nonlinear5 | -0.019 | 0.01726 | -1.101 | 3772 | 0.271 | -0.06743 | 0.02944 |
fixed | NA | birth_order_nonlinear>5 | 0.001732 | 0.01775 | 0.09756 | 3854 | 0.9223 | -0.0481 | 0.05156 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07048 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.175 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.03478 | 0.1215 | 0.2863 | 3832 | 0.7747 | -0.3063 | 0.3758 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003973 | 0.01469 | -0.2706 | 3836 | 0.7867 | -0.0452 | 0.03725 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001861 | 0.0005623 | 0.3309 | 3845 | 0.7407 | -0.001392 | 0.001764 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002854 | 0.000006796 | -0.4199 | 3853 | 0.6746 | -0.00002193 | 0.00001622 |
fixed | NA | male | 0.02537 | 0.006038 | 4.202 | 3832 | 0.00002704 | 0.008423 | 0.04232 |
fixed | NA | count_birth_order2/2 | 0.007706 | 0.01212 | 0.6361 | 3449 | 0.5248 | -0.0263 | 0.04172 |
fixed | NA | count_birth_order1/3 | 0.004014 | 0.01111 | 0.3613 | 3859 | 0.7179 | -0.02717 | 0.0352 |
fixed | NA | count_birth_order2/3 | 0.003202 | 0.01236 | 0.2591 | 3862 | 0.7956 | -0.03148 | 0.03789 |
fixed | NA | count_birth_order3/3 | 0.002463 | 0.01358 | 0.1813 | 3862 | 0.8561 | -0.03566 | 0.04059 |
fixed | NA | count_birth_order1/4 | 0.03037 | 0.01504 | 2.02 | 3862 | 0.04345 | -0.01183 | 0.07258 |
fixed | NA | count_birth_order2/4 | 0.02255 | 0.0155 | 1.455 | 3854 | 0.1457 | -0.02095 | 0.06604 |
fixed | NA | count_birth_order3/4 | 0.0205 | 0.01592 | 1.287 | 3849 | 0.198 | -0.0242 | 0.0652 |
fixed | NA | count_birth_order4/4 | 0.02008 | 0.01627 | 1.234 | 3859 | 0.2172 | -0.02559 | 0.06575 |
fixed | NA | count_birth_order1/5 | 0.01887 | 0.0217 | 0.8697 | 3859 | 0.3845 | -0.04203 | 0.07977 |
fixed | NA | count_birth_order2/5 | 0.03535 | 0.02463 | 1.435 | 3818 | 0.1513 | -0.03379 | 0.1045 |
fixed | NA | count_birth_order3/5 | 0.03267 | 0.02251 | 1.451 | 3842 | 0.1468 | -0.03052 | 0.09586 |
fixed | NA | count_birth_order4/5 | 0.02488 | 0.02104 | 1.183 | 3842 | 0.2369 | -0.03416 | 0.08393 |
fixed | NA | count_birth_order5/5 | 0.03749 | 0.02189 | 1.713 | 3857 | 0.08683 | -0.02395 | 0.09892 |
fixed | NA | count_birth_order1/>5 | 0.09729 | 0.02792 | 3.485 | 3822 | 0.0004973 | 0.01893 | 0.1757 |
fixed | NA | count_birth_order2/>5 | 0.04167 | 0.02754 | 1.513 | 3818 | 0.1303 | -0.03564 | 0.119 |
fixed | NA | count_birth_order3/>5 | 0.09556 | 0.0262 | 3.647 | 3808 | 0.0002685 | 0.02202 | 0.1691 |
fixed | NA | count_birth_order4/>5 | 0.03713 | 0.02435 | 1.525 | 3789 | 0.1273 | -0.03121 | 0.1055 |
fixed | NA | count_birth_order5/>5 | 0.02453 | 0.0205 | 1.197 | 3829 | 0.2316 | -0.03302 | 0.08208 |
fixed | NA | count_birth_order>5/>5 | 0.06231 | 0.01387 | 4.493 | 3647 | 0.000007249 | 0.02338 | 0.1012 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.07055 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.175 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -1946 | -1877 | 984.1 | -1968 | NA | NA | NA |
12 | -1945 | -1870 | 984.5 | -1969 | 0.857 | 1 | 0.3546 |
16 | -1938 | -1838 | 985.2 | -1970 | 1.428 | 4 | 0.8393 |
26 | -1927 | -1764 | 989.3 | -1979 | 8.208 | 10 | 0.6085 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = attended_school)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9681 | 0.01706 | 56.76 | 14640 | 0 | 0.9203 | 1.016 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002032 | 0.001622 | 1.253 | 14591 | 0.2102 | -0.00252 | 0.006584 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00002256 | 0.00004725 | -0.4774 | 14484 | 0.6331 | -0.0001552 | 0.0001101 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000005908 | 0.0000004301 | -1.374 | 14359 | 0.1696 | -0.000001798 | 0.0000006165 |
fixed | NA | male | 0.0045 | 0.00183 | 2.459 | 14526 | 0.01393 | -0.0006361 | 0.009636 |
fixed | NA | sibling_count3 | -0.0003612 | 0.00372 | -0.09709 | 11178 | 0.9227 | -0.0108 | 0.01008 |
fixed | NA | sibling_count4 | -0.0006508 | 0.003832 | -0.1698 | 10302 | 0.8651 | -0.01141 | 0.01011 |
fixed | NA | sibling_count5 | 0.003564 | 0.004005 | 0.8899 | 9432 | 0.3735 | -0.007677 | 0.0148 |
fixed | NA | sibling_count>5 | -0.003767 | 0.003134 | -1.202 | 10431 | 0.2294 | -0.01256 | 0.00503 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1049 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9682 | 0.01706 | 56.77 | 14641 | 0 | 0.9204 | 1.016 |
fixed | NA | birth_order | 0.0003991 | 0.0003879 | 1.029 | 13583 | 0.3036 | -0.0006898 | 0.001488 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001915 | 0.001626 | 1.178 | 14583 | 0.2388 | -0.002648 | 0.006478 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00001828 | 0.00004743 | -0.3854 | 14442 | 0.7 | -0.0001514 | 0.0001149 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006301 | 0.0000004318 | -1.459 | 14297 | 0.1445 | -0.000001842 | 0.000000582 |
fixed | NA | male | 0.00449 | 0.00183 | 2.454 | 14525 | 0.01415 | -0.0006463 | 0.009625 |
fixed | NA | sibling_count3 | -0.0004555 | 0.003722 | -0.1224 | 11194 | 0.9026 | -0.0109 | 0.009991 |
fixed | NA | sibling_count4 | -0.0009254 | 0.003842 | -0.2409 | 10369 | 0.8096 | -0.01171 | 0.009858 |
fixed | NA | sibling_count5 | 0.003088 | 0.004032 | 0.7659 | 9548 | 0.4438 | -0.008229 | 0.0144 |
fixed | NA | sibling_count>5 | -0.005271 | 0.003458 | -1.524 | 11502 | 0.1275 | -0.01498 | 0.004436 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04003 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1049 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9654 | 0.0171 | 56.47 | 14641 | 0 | 0.9174 | 1.013 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001958 | 0.001626 | 1.204 | 14586 | 0.2286 | -0.002606 | 0.006521 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00002171 | 0.00004743 | -0.4577 | 14447 | 0.6472 | -0.0001549 | 0.0001114 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000577 | 0.0000004318 | -1.336 | 14293 | 0.1815 | -0.000001789 | 0.0000006352 |
fixed | NA | male | 0.004508 | 0.001829 | 2.464 | 14520 | 0.01373 | -0.0006267 | 0.009642 |
fixed | NA | sibling_count3 | -0.0008396 | 0.003773 | -0.2226 | 11526 | 0.8239 | -0.01143 | 0.00975 |
fixed | NA | sibling_count4 | -0.001915 | 0.003947 | -0.4851 | 11041 | 0.6276 | -0.01299 | 0.009165 |
fixed | NA | sibling_count5 | 0.002337 | 0.004181 | 0.5589 | 10434 | 0.5762 | -0.0094 | 0.01407 |
fixed | NA | sibling_count>5 | -0.005684 | 0.003629 | -1.566 | 12497 | 0.1174 | -0.01587 | 0.004504 |
fixed | NA | birth_order_nonlinear2 | 0.009478 | 0.002651 | 3.576 | 13546 | 0.0003508 | 0.002037 | 0.01692 |
fixed | NA | birth_order_nonlinear3 | 0.004998 | 0.00312 | 1.602 | 13356 | 0.1092 | -0.003761 | 0.01376 |
fixed | NA | birth_order_nonlinear4 | 0.00704 | 0.003569 | 1.972 | 13457 | 0.0486 | -0.002979 | 0.01706 |
fixed | NA | birth_order_nonlinear5 | 0.00423 | 0.00406 | 1.042 | 13457 | 0.2975 | -0.007167 | 0.01563 |
fixed | NA | birth_order_nonlinear>5 | 0.006468 | 0.003369 | 1.92 | 14708 | 0.0549 | -0.002989 | 0.01593 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04003 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1049 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9637 | 0.01717 | 56.11 | 14637 | 0 | 0.9155 | 1.012 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001951 | 0.001626 | 1.2 | 14577 | 0.2303 | -0.002614 | 0.006516 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00002194 | 0.00004745 | -0.4624 | 14434 | 0.6438 | -0.0001551 | 0.0001113 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000005714 | 0.0000004321 | -1.322 | 14273 | 0.1861 | -0.000001784 | 0.0000006415 |
fixed | NA | male | 0.004513 | 0.00183 | 2.466 | 14510 | 0.01367 | -0.0006237 | 0.00965 |
fixed | NA | count_birth_order2/2 | 0.01457 | 0.005155 | 2.826 | 13469 | 0.004716 | 0.00009923 | 0.02904 |
fixed | NA | count_birth_order1/3 | 0.003496 | 0.004912 | 0.7117 | 14558 | 0.4767 | -0.01029 | 0.01729 |
fixed | NA | count_birth_order2/3 | 0.006761 | 0.005492 | 1.231 | 14632 | 0.2184 | -0.008656 | 0.02218 |
fixed | NA | count_birth_order3/3 | 0.006183 | 0.006121 | 1.01 | 14690 | 0.3125 | -0.011 | 0.02337 |
fixed | NA | count_birth_order1/4 | -0.001403 | 0.00556 | -0.2522 | 14635 | 0.8009 | -0.01701 | 0.01421 |
fixed | NA | count_birth_order2/4 | 0.00841 | 0.005915 | 1.422 | 14664 | 0.1552 | -0.008195 | 0.02501 |
fixed | NA | count_birth_order3/4 | 0.007888 | 0.006414 | 1.23 | 14703 | 0.2188 | -0.01012 | 0.02589 |
fixed | NA | count_birth_order4/4 | 0.00767 | 0.006728 | 1.14 | 14715 | 0.2542 | -0.01121 | 0.02655 |
fixed | NA | count_birth_order1/5 | 0.003475 | 0.006362 | 0.5463 | 14690 | 0.5849 | -0.01438 | 0.02133 |
fixed | NA | count_birth_order2/5 | 0.0146 | 0.006711 | 2.175 | 14711 | 0.02966 | -0.004243 | 0.03343 |
fixed | NA | count_birth_order3/5 | 0.009876 | 0.006864 | 1.439 | 14717 | 0.1502 | -0.009391 | 0.02914 |
fixed | NA | count_birth_order4/5 | 0.01004 | 0.007349 | 1.367 | 14725 | 0.1717 | -0.01058 | 0.03067 |
fixed | NA | count_birth_order5/5 | 0.00893 | 0.007486 | 1.193 | 14725 | 0.2329 | -0.01208 | 0.02994 |
fixed | NA | count_birth_order1/>5 | -0.002407 | 0.005119 | -0.4702 | 14721 | 0.6382 | -0.01678 | 0.01196 |
fixed | NA | count_birth_order2/>5 | 0.006208 | 0.005288 | 1.174 | 14725 | 0.2405 | -0.008637 | 0.02105 |
fixed | NA | count_birth_order3/>5 | -0.0006546 | 0.005174 | -0.1265 | 14725 | 0.8993 | -0.01518 | 0.01387 |
fixed | NA | count_birth_order4/>5 | 0.003439 | 0.005098 | 0.6747 | 14725 | 0.4999 | -0.01087 | 0.01775 |
fixed | NA | count_birth_order5/>5 | 0.0002875 | 0.005118 | 0.05618 | 14725 | 0.9552 | -0.01408 | 0.01465 |
fixed | NA | count_birth_order>5/>5 | 0.002677 | 0.00402 | 0.6661 | 13473 | 0.5054 | -0.008606 | 0.01396 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04003 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1049 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -22818 | -22735 | 11420 | -22840 | NA | NA | NA |
12 | -22817 | -22726 | 11421 | -22841 | 1.058 | 1 | 0.3037 |
16 | -22822 | -22701 | 11427 | -22854 | 12.65 | 4 | 0.01311 |
26 | -22805 | -22608 | 11429 | -22857 | 3.176 | 10 | 0.977 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.011 | 0.02852 | 35.46 | 6237 | 4.527e-251 | 0.9311 | 1.091 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001947 | 0.003235 | -0.6018 | 6237 | 0.5473 | -0.01103 | 0.007135 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0000824 | 0.0001155 | 0.7134 | 6237 | 0.4756 | -0.0002418 | 0.0004066 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001031 | 0.000001309 | -0.7881 | 6237 | 0.4307 | -0.000004706 | 0.000002643 |
fixed | NA | male | 0.0001955 | 0.001662 | 0.1176 | 6237 | 0.9064 | -0.00447 | 0.004861 |
fixed | NA | sibling_count3 | -0.0003751 | 0.002516 | -0.1491 | 6237 | 0.8815 | -0.007438 | 0.006688 |
fixed | NA | sibling_count4 | -0.001316 | 0.002683 | -0.4904 | 6237 | 0.6238 | -0.008847 | 0.006216 |
fixed | NA | sibling_count5 | -0.003354 | 0.003057 | -1.097 | 6237 | 0.2725 | -0.01193 | 0.005225 |
fixed | NA | sibling_count>5 | -0.006361 | 0.002651 | -2.399 | 6237 | 0.01645 | -0.0138 | 0.001081 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.0656 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.012 | 0.02852 | 35.48 | 6236 | 2.299e-251 | 0.9318 | 1.092 |
fixed | NA | birth_order | -0.0007748 | 0.00054 | -1.435 | 6236 | 0.1514 | -0.002291 | 0.0007411 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001931 | 0.003235 | -0.5969 | 6236 | 0.5506 | -0.01101 | 0.00715 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008326 | 0.0001155 | 0.7209 | 6236 | 0.471 | -0.0002409 | 0.0004075 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000107 | 0.000001309 | -0.8174 | 6236 | 0.4137 | -0.000004745 | 0.000002604 |
fixed | NA | male | 0.0002228 | 0.001662 | 0.1341 | 6236 | 0.8933 | -0.004442 | 0.004888 |
fixed | NA | sibling_count3 | 0.00000391 | 0.00253 | 0.001546 | 6236 | 0.9988 | -0.007098 | 0.007105 |
fixed | NA | sibling_count4 | -0.0004532 | 0.002749 | -0.1648 | 6236 | 0.8691 | -0.008171 | 0.007264 |
fixed | NA | sibling_count5 | -0.001941 | 0.003211 | -0.6046 | 6236 | 0.5455 | -0.01095 | 0.007072 |
fixed | NA | sibling_count>5 | -0.003485 | 0.003324 | -1.048 | 6236 | 0.2945 | -0.01282 | 0.005846 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.0656 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.015 | 0.02855 | 35.54 | 6232 | 4.212e-252 | 0.9347 | 1.095 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002183 | 0.003236 | -0.6745 | 6232 | 0.5 | -0.01127 | 0.006901 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009152 | 0.0001155 | 0.7921 | 6232 | 0.4284 | -0.0002328 | 0.0004159 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001145 | 0.00000131 | -0.8742 | 6232 | 0.382 | -0.000004822 | 0.000002532 |
fixed | NA | male | 0.0001161 | 0.001662 | 0.06984 | 6232 | 0.9443 | -0.004549 | 0.004781 |
fixed | NA | sibling_count3 | -0.0003986 | 0.00259 | -0.1539 | 6232 | 0.8777 | -0.00767 | 0.006873 |
fixed | NA | sibling_count4 | -0.00217 | 0.002874 | -0.7549 | 6232 | 0.4503 | -0.01024 | 0.005898 |
fixed | NA | sibling_count5 | -0.00477 | 0.0034 | -1.403 | 6232 | 0.1607 | -0.01431 | 0.004774 |
fixed | NA | sibling_count>5 | -0.006043 | 0.003442 | -1.756 | 6232 | 0.07922 | -0.0157 | 0.003619 |
fixed | NA | birth_order_nonlinear2 | -0.005037 | 0.002194 | -2.296 | 6232 | 0.02171 | -0.01119 | 0.001121 |
fixed | NA | birth_order_nonlinear3 | -0.0001685 | 0.002691 | -0.06262 | 6232 | 0.9501 | -0.007723 | 0.007386 |
fixed | NA | birth_order_nonlinear4 | 0.002693 | 0.003327 | 0.8095 | 6232 | 0.4183 | -0.006646 | 0.01203 |
fixed | NA | birth_order_nonlinear5 | 0.0002744 | 0.004181 | 0.06563 | 6232 | 0.9477 | -0.01146 | 0.01201 |
fixed | NA | birth_order_nonlinear>5 | -0.004911 | 0.00408 | -1.204 | 6232 | 0.2287 | -0.01636 | 0.00654 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06558 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.014 | 0.02858 | 35.49 | 6222 | 2.077e-251 | 0.9342 | 1.095 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.00219 | 0.00324 | -0.6758 | 6222 | 0.4992 | -0.01128 | 0.006905 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009155 | 0.0001157 | 0.7913 | 6222 | 0.4288 | -0.0002332 | 0.0004163 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001146 | 0.000001312 | -0.8737 | 6222 | 0.3823 | -0.000004828 | 0.000002536 |
fixed | NA | male | 0.0001459 | 0.001662 | 0.08779 | 6222 | 0.93 | -0.004519 | 0.004811 |
fixed | NA | count_birth_order2/2 | -0.003615 | 0.003935 | -0.9188 | 6222 | 0.3582 | -0.01466 | 0.007429 |
fixed | NA | count_birth_order1/3 | -0.0004489 | 0.003422 | -0.1312 | 6222 | 0.8956 | -0.01006 | 0.009158 |
fixed | NA | count_birth_order2/3 | -0.004972 | 0.003731 | -1.333 | 6222 | 0.1827 | -0.01544 | 0.005501 |
fixed | NA | count_birth_order3/3 | 0.0009987 | 0.004173 | 0.2393 | 6222 | 0.8108 | -0.01071 | 0.01271 |
fixed | NA | count_birth_order1/4 | -0.001972 | 0.004172 | -0.4727 | 6222 | 0.6365 | -0.01368 | 0.009738 |
fixed | NA | count_birth_order2/4 | -0.005412 | 0.004322 | -1.252 | 6222 | 0.2105 | -0.01754 | 0.00672 |
fixed | NA | count_birth_order3/4 | 0.000761 | 0.00458 | 0.1662 | 6222 | 0.868 | -0.0121 | 0.01362 |
fixed | NA | count_birth_order4/4 | -0.003091 | 0.004762 | -0.6492 | 6222 | 0.5163 | -0.01646 | 0.01027 |
fixed | NA | count_birth_order1/5 | -0.005454 | 0.005692 | -0.9582 | 6222 | 0.338 | -0.02143 | 0.01052 |
fixed | NA | count_birth_order2/5 | -0.02171 | 0.006134 | -3.539 | 6222 | 0.0004039 | -0.03893 | -0.004492 |
fixed | NA | count_birth_order3/5 | 0.0004959 | 0.00569 | 0.08716 | 6222 | 0.9305 | -0.01548 | 0.01647 |
fixed | NA | count_birth_order4/5 | 0.0006201 | 0.005594 | 0.1109 | 6222 | 0.9117 | -0.01508 | 0.01632 |
fixed | NA | count_birth_order5/5 | 0.0007406 | 0.005808 | 0.1275 | 6222 | 0.8985 | -0.01556 | 0.01704 |
fixed | NA | count_birth_order1/>5 | 0.0007324 | 0.00565 | 0.1296 | 6222 | 0.8969 | -0.01513 | 0.01659 |
fixed | NA | count_birth_order2/>5 | -0.005395 | 0.005634 | -0.9577 | 6222 | 0.3383 | -0.02121 | 0.01042 |
fixed | NA | count_birth_order3/>5 | -0.01633 | 0.005546 | -2.945 | 6222 | 0.003237 | -0.0319 | -0.0007676 |
fixed | NA | count_birth_order4/>5 | 0.0004021 | 0.005225 | 0.07696 | 6222 | 0.9387 | -0.01426 | 0.01507 |
fixed | NA | count_birth_order5/>5 | -0.00845 | 0.005 | -1.69 | 6222 | 0.09108 | -0.02248 | 0.005585 |
fixed | NA | count_birth_order>5/>5 | -0.01044 | 0.003679 | -2.838 | 6222 | 0.004558 | -0.02077 | -0.0001129 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06554 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -16291 | -16217 | 8157 | -16313 | NA | NA | NA |
12 | -16291 | -16210 | 8158 | -16315 | 2.061 | 1 | 0.1511 |
16 | -16291 | -16183 | 8161 | -16323 | 7.77 | 4 | 0.1004 |
26 | -16288 | -16113 | 8170 | -16340 | 16.98 | 10 | 0.07483 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.012 | 0.02829 | 35.76 | 6295 | 4.227e-255 | 0.9322 | 1.091 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001995 | 0.003211 | -0.6213 | 6295 | 0.5344 | -0.01101 | 0.007019 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008284 | 0.0001147 | 0.7224 | 6295 | 0.4701 | -0.0002391 | 0.0004047 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001035 | 0.0000013 | -0.7966 | 6295 | 0.4257 | -0.000004684 | 0.000002613 |
fixed | NA | male | 0.0001628 | 0.001648 | 0.09879 | 6295 | 0.9213 | -0.004463 | 0.004788 |
fixed | NA | sibling_count3 | -0.0002068 | 0.002719 | -0.07605 | 6295 | 0.9394 | -0.00784 | 0.007427 |
fixed | NA | sibling_count4 | -0.00003864 | 0.002839 | -0.01361 | 6295 | 0.9891 | -0.008008 | 0.007931 |
fixed | NA | sibling_count5 | -0.001917 | 0.003027 | -0.6333 | 6295 | 0.5266 | -0.01041 | 0.006579 |
fixed | NA | sibling_count>5 | -0.00446 | 0.002648 | -1.684 | 6295 | 0.09219 | -0.01189 | 0.002974 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06532 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.012 | 0.02829 | 35.78 | 6294 | 2.301e-255 | 0.9329 | 1.092 |
fixed | NA | birth_order | -0.0006005 | 0.0004664 | -1.288 | 6294 | 0.1979 | -0.00191 | 0.0007086 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002002 | 0.003211 | -0.6233 | 6294 | 0.5331 | -0.01102 | 0.007012 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008416 | 0.0001147 | 0.7339 | 6294 | 0.463 | -0.0002377 | 0.000406 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001072 | 0.0000013 | -0.8247 | 6294 | 0.4096 | -0.000004721 | 0.000002577 |
fixed | NA | male | 0.000178 | 0.001648 | 0.108 | 6294 | 0.914 | -0.004447 | 0.004803 |
fixed | NA | sibling_count3 | 0.00008331 | 0.002729 | 0.03053 | 6294 | 0.9756 | -0.007576 | 0.007743 |
fixed | NA | sibling_count4 | 0.0006008 | 0.002882 | 0.2085 | 6294 | 0.8349 | -0.007489 | 0.008691 |
fixed | NA | sibling_count5 | -0.0009089 | 0.003126 | -0.2907 | 6294 | 0.7713 | -0.009684 | 0.007867 |
fixed | NA | sibling_count>5 | -0.002282 | 0.003142 | -0.7263 | 6294 | 0.4677 | -0.0111 | 0.006538 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000001071 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06532 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.015 | 0.02832 | 35.85 | 6290 | 2.461e-256 | 0.9359 | 1.095 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002241 | 0.003211 | -0.6979 | 6290 | 0.4853 | -0.01126 | 0.006773 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009272 | 0.0001147 | 0.8084 | 6290 | 0.4189 | -0.0002292 | 0.0004147 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001162 | 0.0000013 | -0.8934 | 6290 | 0.3717 | -0.000004812 | 0.000002488 |
fixed | NA | male | 0.00009342 | 0.001647 | 0.05671 | 6290 | 0.9548 | -0.004531 | 0.004718 |
fixed | NA | sibling_count3 | -0.0001752 | 0.002785 | -0.06292 | 6290 | 0.9498 | -0.007992 | 0.007642 |
fixed | NA | sibling_count4 | -0.0005815 | 0.002996 | -0.1941 | 6290 | 0.8461 | -0.008991 | 0.007828 |
fixed | NA | sibling_count5 | -0.003249 | 0.003294 | -0.9863 | 6290 | 0.324 | -0.0125 | 0.005998 |
fixed | NA | sibling_count>5 | -0.003948 | 0.003257 | -1.212 | 6290 | 0.2254 | -0.01309 | 0.005193 |
fixed | NA | birth_order_nonlinear2 | -0.005297 | 0.00222 | -2.386 | 6290 | 0.01706 | -0.01153 | 0.0009346 |
fixed | NA | birth_order_nonlinear3 | -0.0005044 | 0.002664 | -0.1893 | 6290 | 0.8498 | -0.007982 | 0.006974 |
fixed | NA | birth_order_nonlinear4 | 0.001782 | 0.003203 | 0.5562 | 6290 | 0.5781 | -0.00721 | 0.01077 |
fixed | NA | birth_order_nonlinear5 | 0.001802 | 0.003933 | 0.4582 | 6290 | 0.6468 | -0.009237 | 0.01284 |
fixed | NA | birth_order_nonlinear>5 | -0.005815 | 0.003619 | -1.607 | 6290 | 0.1082 | -0.01597 | 0.004344 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0000000003181 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06529 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.015 | 0.02836 | 35.79 | 6280 | 2.026e-255 | 0.9353 | 1.095 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002231 | 0.003215 | -0.694 | 6280 | 0.4877 | -0.01126 | 0.006793 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00009229 | 0.0001148 | 0.8037 | 6280 | 0.4216 | -0.0002301 | 0.0004146 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001156 | 0.000001302 | -0.8876 | 6280 | 0.3748 | -0.000004811 | 0.0000025 |
fixed | NA | male | 0.0001064 | 0.001648 | 0.06454 | 6280 | 0.9485 | -0.004519 | 0.004732 |
fixed | NA | count_birth_order2/2 | -0.004276 | 0.004292 | -0.9963 | 6280 | 0.3191 | -0.01632 | 0.007771 |
fixed | NA | count_birth_order1/3 | -0.0003683 | 0.003692 | -0.09976 | 6280 | 0.9205 | -0.01073 | 0.009996 |
fixed | NA | count_birth_order2/3 | -0.00554 | 0.004017 | -1.379 | 6280 | 0.168 | -0.01682 | 0.005737 |
fixed | NA | count_birth_order3/3 | 0.001302 | 0.004497 | 0.2896 | 6280 | 0.7722 | -0.01132 | 0.01392 |
fixed | NA | count_birth_order1/4 | -0.001762 | 0.004341 | -0.406 | 6280 | 0.6848 | -0.01395 | 0.01042 |
fixed | NA | count_birth_order2/4 | -0.001991 | 0.004433 | -0.4491 | 6280 | 0.6534 | -0.01443 | 0.01045 |
fixed | NA | count_birth_order3/4 | 0.0011 | 0.004877 | 0.2256 | 6280 | 0.8215 | -0.01259 | 0.01479 |
fixed | NA | count_birth_order4/4 | -0.003243 | 0.005046 | -0.6427 | 6280 | 0.5204 | -0.01741 | 0.01092 |
fixed | NA | count_birth_order1/5 | -0.003534 | 0.005172 | -0.6833 | 6280 | 0.4945 | -0.01805 | 0.01098 |
fixed | NA | count_birth_order2/5 | -0.01611 | 0.005572 | -2.891 | 6280 | 0.003849 | -0.03175 | -0.0004697 |
fixed | NA | count_birth_order3/5 | 0.0009379 | 0.005428 | 0.1728 | 6280 | 0.8628 | -0.0143 | 0.01618 |
fixed | NA | count_birth_order4/5 | 0.001 | 0.005696 | 0.1756 | 6280 | 0.8606 | -0.01499 | 0.01699 |
fixed | NA | count_birth_order5/5 | 0.001112 | 0.005673 | 0.196 | 6280 | 0.8446 | -0.01481 | 0.01704 |
fixed | NA | count_birth_order1/>5 | 0.001216 | 0.00493 | 0.2466 | 6280 | 0.8052 | -0.01262 | 0.01505 |
fixed | NA | count_birth_order2/>5 | -0.008076 | 0.005152 | -1.568 | 6280 | 0.117 | -0.02254 | 0.006385 |
fixed | NA | count_birth_order3/>5 | -0.01154 | 0.005022 | -2.297 | 6280 | 0.02165 | -0.02564 | 0.002561 |
fixed | NA | count_birth_order4/>5 | 0.0009338 | 0.004821 | 0.1937 | 6280 | 0.8464 | -0.0126 | 0.01447 |
fixed | NA | count_birth_order5/>5 | -0.003345 | 0.00499 | -0.6702 | 6280 | 0.5028 | -0.01735 | 0.01066 |
fixed | NA | count_birth_order>5/>5 | -0.009414 | 0.003609 | -2.609 | 6280 | 0.00911 | -0.01954 | 0.0007156 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06528 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -16498 | -16423 | 8260 | -16520 | NA | NA | NA |
12 | -16497 | -16416 | 8261 | -16521 | 1.66 | 1 | 0.1976 |
16 | -16499 | -16391 | 8266 | -16531 | 9.831 | 4 | 0.04338 |
26 | -16491 | -16315 | 8271 | -16543 | 11.8 | 10 | 0.2989 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.018 | 0.02859 | 35.61 | 6115 | 1.509e-252 | 0.9377 | 1.098 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.00255 | 0.003245 | -0.7858 | 6115 | 0.432 | -0.01166 | 0.006559 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001017 | 0.0001159 | 0.8777 | 6115 | 0.3801 | -0.0002236 | 0.000427 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000123 | 0.000001314 | -0.936 | 6115 | 0.3493 | -0.000004918 | 0.000002458 |
fixed | NA | male | -0.00009463 | 0.001664 | -0.05687 | 6115 | 0.9546 | -0.004765 | 0.004576 |
fixed | NA | sibling_count3 | -0.001208 | 0.00246 | -0.4911 | 6115 | 0.6234 | -0.008115 | 0.005698 |
fixed | NA | sibling_count4 | -0.003839 | 0.002643 | -1.452 | 6115 | 0.1464 | -0.01126 | 0.00358 |
fixed | NA | sibling_count5 | -0.003218 | 0.003094 | -1.04 | 6115 | 0.2983 | -0.0119 | 0.005466 |
fixed | NA | sibling_count>5 | -0.006981 | 0.002649 | -2.636 | 6115 | 0.008414 | -0.01442 | 0.0004534 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0000000004397 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06502 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.019 | 0.02859 | 35.62 | 6114 | 9.457e-253 | 0.9382 | 1.099 |
fixed | NA | birth_order | -0.0006737 | 0.0005522 | -1.22 | 6114 | 0.2225 | -0.002224 | 0.0008763 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002525 | 0.003245 | -0.778 | 6114 | 0.4366 | -0.01163 | 0.006584 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001021 | 0.0001159 | 0.8812 | 6114 | 0.3782 | -0.0002231 | 0.0004274 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000126 | 0.000001314 | -0.9586 | 6114 | 0.3378 | -0.000004948 | 0.000002429 |
fixed | NA | male | -0.0000827 | 0.001664 | -0.0497 | 6114 | 0.9604 | -0.004753 | 0.004588 |
fixed | NA | sibling_count3 | -0.0008808 | 0.002475 | -0.3559 | 6114 | 0.7219 | -0.007828 | 0.006067 |
fixed | NA | sibling_count4 | -0.0031 | 0.002712 | -1.143 | 6114 | 0.253 | -0.01071 | 0.004512 |
fixed | NA | sibling_count5 | -0.002043 | 0.00324 | -0.6306 | 6114 | 0.5284 | -0.01114 | 0.007051 |
fixed | NA | sibling_count>5 | -0.004499 | 0.00334 | -1.347 | 6114 | 0.178 | -0.01387 | 0.004876 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06501 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.021 | 0.02862 | 35.68 | 6110 | 1.688e-253 | 0.941 | 1.102 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002776 | 0.003246 | -0.8553 | 6110 | 0.3924 | -0.01189 | 0.006335 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001105 | 0.0001159 | 0.9533 | 6110 | 0.3405 | -0.0002149 | 0.0004359 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001342 | 0.000001315 | -1.021 | 6110 | 0.3075 | -0.000005032 | 0.000002349 |
fixed | NA | male | -0.0001589 | 0.001664 | -0.0955 | 6110 | 0.9239 | -0.004829 | 0.004511 |
fixed | NA | sibling_count3 | -0.001365 | 0.002536 | -0.5382 | 6110 | 0.5905 | -0.008485 | 0.005755 |
fixed | NA | sibling_count4 | -0.004754 | 0.002838 | -1.675 | 6110 | 0.09402 | -0.01272 | 0.003214 |
fixed | NA | sibling_count5 | -0.003792 | 0.003416 | -1.11 | 6110 | 0.267 | -0.01338 | 0.005797 |
fixed | NA | sibling_count>5 | -0.006122 | 0.003464 | -1.768 | 6110 | 0.07718 | -0.01584 | 0.0036 |
fixed | NA | birth_order_nonlinear2 | -0.004324 | 0.002171 | -1.992 | 6110 | 0.04639 | -0.01042 | 0.001769 |
fixed | NA | birth_order_nonlinear3 | 0.0001426 | 0.002671 | 0.05338 | 6110 | 0.9574 | -0.007355 | 0.00764 |
fixed | NA | birth_order_nonlinear4 | 0.00281 | 0.003394 | 0.828 | 6110 | 0.4077 | -0.006717 | 0.01234 |
fixed | NA | birth_order_nonlinear5 | -0.004068 | 0.004315 | -0.9426 | 6110 | 0.3459 | -0.01618 | 0.008045 |
fixed | NA | birth_order_nonlinear>5 | -0.004234 | 0.004176 | -1.014 | 6110 | 0.3107 | -0.01596 | 0.007488 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.065 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.021 | 0.02867 | 35.61 | 6100 | 1.551e-252 | 0.9404 | 1.101 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002721 | 0.003251 | -0.8371 | 6100 | 0.4026 | -0.01185 | 0.006403 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001088 | 0.0001161 | 0.9369 | 6100 | 0.3489 | -0.0002171 | 0.0004347 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001325 | 0.000001317 | -1.006 | 6100 | 0.3146 | -0.000005021 | 0.000002372 |
fixed | NA | male | -0.00008317 | 0.001664 | -0.04997 | 6100 | 0.9601 | -0.004755 | 0.004589 |
fixed | NA | count_birth_order2/2 | -0.004503 | 0.003796 | -1.186 | 6100 | 0.2356 | -0.01516 | 0.006153 |
fixed | NA | count_birth_order1/3 | -0.001611 | 0.003351 | -0.4808 | 6100 | 0.6307 | -0.01102 | 0.007796 |
fixed | NA | count_birth_order2/3 | -0.00631 | 0.0037 | -1.705 | 6100 | 0.0882 | -0.0167 | 0.004077 |
fixed | NA | count_birth_order3/3 | -0.0002261 | 0.004069 | -0.05556 | 6100 | 0.9557 | -0.01165 | 0.01119 |
fixed | NA | count_birth_order1/4 | -0.008884 | 0.004156 | -2.137 | 6100 | 0.0326 | -0.02055 | 0.002783 |
fixed | NA | count_birth_order2/4 | -0.006667 | 0.004294 | -1.552 | 6100 | 0.1206 | -0.01872 | 0.005387 |
fixed | NA | count_birth_order3/4 | -0.0003684 | 0.004503 | -0.08182 | 6100 | 0.9348 | -0.01301 | 0.01227 |
fixed | NA | count_birth_order4/4 | -0.004377 | 0.004758 | -0.9199 | 6100 | 0.3576 | -0.01773 | 0.008978 |
fixed | NA | count_birth_order1/5 | -0.0004467 | 0.005644 | -0.07915 | 6100 | 0.9369 | -0.01629 | 0.0154 |
fixed | NA | count_birth_order2/5 | -0.01668 | 0.006279 | -2.656 | 6100 | 0.00793 | -0.0343 | 0.0009487 |
fixed | NA | count_birth_order3/5 | -0.0006599 | 0.005896 | -0.1119 | 6100 | 0.9109 | -0.01721 | 0.01589 |
fixed | NA | count_birth_order4/5 | -0.000488 | 0.0058 | -0.08414 | 6100 | 0.9329 | -0.01677 | 0.01579 |
fixed | NA | count_birth_order5/5 | -0.008039 | 0.006139 | -1.309 | 6100 | 0.1904 | -0.02527 | 0.009193 |
fixed | NA | count_birth_order1/>5 | -0.0002868 | 0.005746 | -0.04992 | 6100 | 0.9602 | -0.01642 | 0.01584 |
fixed | NA | count_birth_order2/>5 | -0.006855 | 0.005725 | -1.197 | 6100 | 0.2312 | -0.02293 | 0.009216 |
fixed | NA | count_birth_order3/>5 | -0.01792 | 0.005558 | -3.225 | 6100 | 0.001268 | -0.03352 | -0.002321 |
fixed | NA | count_birth_order4/>5 | -0.0006839 | 0.005444 | -0.1256 | 6100 | 0.9 | -0.01597 | 0.0146 |
fixed | NA | count_birth_order5/>5 | -0.0102 | 0.005072 | -2.011 | 6100 | 0.04438 | -0.02443 | 0.004038 |
fixed | NA | count_birth_order>5/>5 | -0.01043 | 0.003711 | -2.812 | 6100 | 0.004944 | -0.02085 | -0.00001732 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.06498 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -16083 | -16009 | 8052 | -16105 | NA | NA | NA |
12 | -16082 | -16002 | 8053 | -16106 | 1.491 | 1 | 0.2221 |
16 | -16081 | -15974 | 8057 | -16113 | 6.603 | 4 | 0.1584 |
26 | -16075 | -15901 | 8064 | -16127 | 14.38 | 10 | 0.1565 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = wage_last_month_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.166 | 0.3787 | -5.72 | 5937 | 0.00000001118 | -3.23 | -1.103 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1631 | 0.03571 | 4.567 | 5923 | 0.00000505 | 0.06284 | 0.2633 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003976 | 0.001063 | -3.739 | 5911 | 0.0001865 | -0.00696 | -0.0009909 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003055 | 0.00001006 | 3.036 | 5906 | 0.002407 | 0.000002305 | 0.00005879 |
fixed | NA | male | 0.1388 | 0.02631 | 5.276 | 5982 | 0.0000001363 | 0.06498 | 0.2127 |
fixed | NA | sibling_count3 | 0.1019 | 0.05214 | 1.954 | 4767 | 0.05082 | -0.0445 | 0.2482 |
fixed | NA | sibling_count4 | 0.05405 | 0.05208 | 1.038 | 4546 | 0.2994 | -0.09213 | 0.2002 |
fixed | NA | sibling_count5 | 0.05158 | 0.05423 | 0.9512 | 4306 | 0.3415 | -0.1006 | 0.2038 |
fixed | NA | sibling_count>5 | -0.003651 | 0.04276 | -0.08539 | 4670 | 0.932 | -0.1237 | 0.1164 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2708 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.95 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.15 | 0.3789 | -5.675 | 5935 | 0.00000001457 | -3.213 | -1.086 |
fixed | NA | birth_order | 0.007971 | 0.005175 | 1.54 | 4824 | 0.1235 | -0.006554 | 0.0225 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1595 | 0.03578 | 4.457 | 5913 | 0.000008464 | 0.05903 | 0.2599 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003854 | 0.001066 | -3.615 | 5893 | 0.0003034 | -0.006846 | -0.0008609 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000294 | 0.00001009 | 2.914 | 5885 | 0.003576 | 0.000001084 | 0.00005772 |
fixed | NA | male | 0.1384 | 0.02631 | 5.26 | 5981 | 0.0000001487 | 0.06455 | 0.2123 |
fixed | NA | sibling_count3 | 0.0995 | 0.05217 | 1.907 | 4769 | 0.05654 | -0.04694 | 0.2459 |
fixed | NA | sibling_count4 | 0.04798 | 0.05223 | 0.9185 | 4568 | 0.3584 | -0.09865 | 0.1946 |
fixed | NA | sibling_count5 | 0.04152 | 0.05463 | 0.7601 | 4344 | 0.4472 | -0.1118 | 0.1949 |
fixed | NA | sibling_count>5 | -0.03363 | 0.04698 | -0.7158 | 4986 | 0.4741 | -0.1655 | 0.09824 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2729 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9493 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.148 | 0.3795 | -5.66 | 5928 | 0.00000001586 | -3.213 | -1.083 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1602 | 0.03579 | 4.475 | 5909 | 0.000007783 | 0.0597 | 0.2606 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003894 | 0.001067 | -3.65 | 5888 | 0.0002643 | -0.006889 | -0.0008995 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002995 | 0.0000101 | 2.965 | 5877 | 0.003036 | 0.000001599 | 0.0000583 |
fixed | NA | male | 0.1388 | 0.02631 | 5.274 | 5977 | 0.0000001381 | 0.06492 | 0.2127 |
fixed | NA | sibling_count3 | 0.09578 | 0.05293 | 1.809 | 4894 | 0.07044 | -0.0528 | 0.2444 |
fixed | NA | sibling_count4 | 0.03642 | 0.05393 | 0.6753 | 4841 | 0.4995 | -0.115 | 0.1878 |
fixed | NA | sibling_count5 | 0.01732 | 0.05692 | 0.3043 | 4717 | 0.7609 | -0.1425 | 0.1771 |
fixed | NA | sibling_count>5 | -0.04504 | 0.0495 | -0.9098 | 5352 | 0.3629 | -0.184 | 0.09391 |
fixed | NA | birth_order_nonlinear2 | 0.02294 | 0.03805 | 0.6028 | 5545 | 0.5467 | -0.08387 | 0.1297 |
fixed | NA | birth_order_nonlinear3 | 0.03579 | 0.04407 | 0.8122 | 5531 | 0.4167 | -0.0879 | 0.1595 |
fixed | NA | birth_order_nonlinear4 | 0.07121 | 0.04928 | 1.445 | 5595 | 0.1485 | -0.06711 | 0.2095 |
fixed | NA | birth_order_nonlinear5 | 0.1192 | 0.05594 | 2.131 | 5583 | 0.03312 | -0.03781 | 0.2762 |
fixed | NA | birth_order_nonlinear>5 | 0.0531 | 0.04599 | 1.155 | 5960 | 0.2483 | -0.07601 | 0.1822 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2737 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9492 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.12 | 0.3809 | -5.565 | 5920 | 0.0000000274 | -3.189 | -1.05 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1581 | 0.03585 | 4.409 | 5898 | 0.00001057 | 0.05743 | 0.2587 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00382 | 0.001069 | -3.574 | 5875 | 0.0003546 | -0.00682 | -0.0008196 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002915 | 0.00001012 | 2.88 | 5862 | 0.003988 | 0.0000007407 | 0.00005757 |
fixed | NA | male | 0.1379 | 0.02635 | 5.235 | 5967 | 0.0000001702 | 0.06398 | 0.2119 |
fixed | NA | count_birth_order2/2 | -0.006871 | 0.07714 | -0.08907 | 5560 | 0.929 | -0.2234 | 0.2097 |
fixed | NA | count_birth_order1/3 | 0.1024 | 0.06942 | 1.475 | 5953 | 0.1403 | -0.09247 | 0.2972 |
fixed | NA | count_birth_order2/3 | 0.08335 | 0.0791 | 1.054 | 5964 | 0.292 | -0.1387 | 0.3054 |
fixed | NA | count_birth_order3/3 | 0.1205 | 0.08859 | 1.361 | 5968 | 0.1737 | -0.1281 | 0.3692 |
fixed | NA | count_birth_order1/4 | 0.06485 | 0.07708 | 0.8413 | 5962 | 0.4002 | -0.1515 | 0.2812 |
fixed | NA | count_birth_order2/4 | 0.08698 | 0.08249 | 1.054 | 5964 | 0.2917 | -0.1446 | 0.3185 |
fixed | NA | count_birth_order3/4 | -0.04521 | 0.08657 | -0.5222 | 5967 | 0.6016 | -0.2882 | 0.1978 |
fixed | NA | count_birth_order4/4 | 0.108 | 0.09454 | 1.142 | 5968 | 0.2535 | -0.1574 | 0.3733 |
fixed | NA | count_birth_order1/5 | -0.03409 | 0.08715 | -0.3912 | 5966 | 0.6956 | -0.2787 | 0.2105 |
fixed | NA | count_birth_order2/5 | 0.1125 | 0.09623 | 1.169 | 5967 | 0.2425 | -0.1576 | 0.3826 |
fixed | NA | count_birth_order3/5 | 0.05178 | 0.09796 | 0.5285 | 5967 | 0.5971 | -0.2232 | 0.3268 |
fixed | NA | count_birth_order4/5 | 0.03552 | 0.09973 | 0.3561 | 5964 | 0.7218 | -0.2444 | 0.3155 |
fixed | NA | count_birth_order5/5 | 0.1267 | 0.1031 | 1.229 | 5966 | 0.2192 | -0.1627 | 0.4161 |
fixed | NA | count_birth_order1/>5 | -0.09157 | 0.06947 | -1.318 | 5968 | 0.1875 | -0.2866 | 0.1034 |
fixed | NA | count_birth_order2/>5 | -0.06085 | 0.07256 | -0.8386 | 5966 | 0.4017 | -0.2645 | 0.1428 |
fixed | NA | count_birth_order3/>5 | 0.0349 | 0.07161 | 0.4874 | 5965 | 0.626 | -0.1661 | 0.2359 |
fixed | NA | count_birth_order4/>5 | 0.02553 | 0.06944 | 0.3677 | 5968 | 0.7131 | -0.1694 | 0.2204 |
fixed | NA | count_birth_order5/>5 | 0.06345 | 0.07022 | 0.9035 | 5965 | 0.3663 | -0.1337 | 0.2606 |
fixed | NA | count_birth_order>5/>5 | -0.002149 | 0.05532 | -0.03884 | 5572 | 0.969 | -0.1574 | 0.1531 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2764 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9487 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16856 | 16930 | -8417 | 16834 | NA | NA | NA |
12 | 16856 | 16936 | -8416 | 16832 | 2.37 | 1 | 0.1237 |
16 | 16861 | 16968 | -8415 | 16829 | 2.788 | 4 | 0.5939 |
26 | 16875 | 17049 | -8411 | 16823 | 6.743 | 10 | 0.7495 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.967 | 0.8516 | -3.484 | 2520 | 0.0005031 | -5.357 | -0.5762 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.24 | 0.09033 | 2.656 | 2522 | 0.007946 | -0.0136 | 0.4935 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00612 | 0.003071 | -1.993 | 2524 | 0.0464 | -0.01474 | 0.002501 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005134 | 0.00003351 | 1.532 | 2526 | 0.1256 | -0.00004272 | 0.0001454 |
fixed | NA | male | 0.1734 | 0.03918 | 4.426 | 2528 | 0.00001003 | 0.06341 | 0.2833 |
fixed | NA | sibling_count3 | 0.05539 | 0.06069 | 0.9127 | 2127 | 0.3615 | -0.115 | 0.2257 |
fixed | NA | sibling_count4 | -0.05519 | 0.06241 | -0.8843 | 1977 | 0.3766 | -0.2304 | 0.12 |
fixed | NA | sibling_count5 | -0.1223 | 0.07112 | -1.72 | 1841 | 0.08567 | -0.3219 | 0.07733 |
fixed | NA | sibling_count>5 | -0.1055 | 0.06141 | -1.718 | 1733 | 0.08605 | -0.2778 | 0.0669 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1431 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9554 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.949 | 0.851 | -3.465 | 2520 | 0.0005386 | -5.338 | -0.5601 |
fixed | NA | birth_order | 0.02897 | 0.01228 | 2.359 | 2271 | 0.01839 | -0.005497 | 0.06345 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2348 | 0.09028 | 2.601 | 2521 | 0.009363 | -0.01865 | 0.4882 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005999 | 0.003069 | -1.955 | 2523 | 0.05071 | -0.01461 | 0.002615 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005109 | 0.00003348 | 1.526 | 2525 | 0.1272 | -0.00004289 | 0.0001451 |
fixed | NA | male | 0.1711 | 0.03915 | 4.371 | 2528 | 0.00001286 | 0.06124 | 0.2811 |
fixed | NA | sibling_count3 | 0.04128 | 0.06096 | 0.6772 | 2126 | 0.4983 | -0.1298 | 0.2124 |
fixed | NA | sibling_count4 | -0.08726 | 0.06386 | -1.367 | 1980 | 0.1719 | -0.2665 | 0.09198 |
fixed | NA | sibling_count5 | -0.1757 | 0.07463 | -2.355 | 1843 | 0.01865 | -0.3852 | 0.03376 |
fixed | NA | sibling_count>5 | -0.2097 | 0.07565 | -2.772 | 1785 | 0.005637 | -0.422 | 0.002683 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1526 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9531 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.933 | 0.8519 | -3.443 | 2516 | 0.0005837 | -5.325 | -0.5421 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2365 | 0.09037 | 2.617 | 2518 | 0.008922 | -0.01717 | 0.4902 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006059 | 0.003072 | -1.972 | 2520 | 0.04867 | -0.01468 | 0.002564 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000517 | 0.00003351 | 1.543 | 2522 | 0.123 | -0.00004237 | 0.0001458 |
fixed | NA | male | 0.1724 | 0.03916 | 4.402 | 2524 | 0.00001117 | 0.06247 | 0.2823 |
fixed | NA | sibling_count3 | 0.02577 | 0.06226 | 0.4139 | 2185 | 0.679 | -0.149 | 0.2005 |
fixed | NA | sibling_count4 | -0.1117 | 0.06659 | -1.678 | 2118 | 0.09355 | -0.2986 | 0.0752 |
fixed | NA | sibling_count5 | -0.1958 | 0.07894 | -2.48 | 2016 | 0.01321 | -0.4174 | 0.02579 |
fixed | NA | sibling_count>5 | -0.2197 | 0.07809 | -2.813 | 1897 | 0.004958 | -0.4389 | -0.0004703 |
fixed | NA | birth_order_nonlinear2 | 0.02232 | 0.05137 | 0.4345 | 2297 | 0.664 | -0.1219 | 0.1665 |
fixed | NA | birth_order_nonlinear3 | 0.1267 | 0.06161 | 2.057 | 2378 | 0.03981 | -0.04622 | 0.2997 |
fixed | NA | birth_order_nonlinear4 | 0.1321 | 0.07471 | 1.769 | 2427 | 0.07707 | -0.07757 | 0.3418 |
fixed | NA | birth_order_nonlinear5 | 0.0958 | 0.09391 | 1.02 | 2472 | 0.3078 | -0.1678 | 0.3594 |
fixed | NA | birth_order_nonlinear>5 | 0.1847 | 0.09213 | 2.004 | 2440 | 0.04515 | -0.07396 | 0.4433 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1585 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9525 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.924 | 0.8537 | -3.424 | 2506 | 0.000626 | -5.32 | -0.5271 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2359 | 0.09068 | 2.601 | 2508 | 0.009348 | -0.01868 | 0.4904 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006003 | 0.003083 | -1.947 | 2510 | 0.05162 | -0.01466 | 0.002651 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005074 | 0.00003364 | 1.508 | 2512 | 0.1316 | -0.00004369 | 0.0001452 |
fixed | NA | male | 0.1682 | 0.03928 | 4.281 | 2515 | 0.00001927 | 0.05791 | 0.2784 |
fixed | NA | count_birth_order2/2 | -0.01186 | 0.09694 | -0.1223 | 2306 | 0.9027 | -0.284 | 0.2603 |
fixed | NA | count_birth_order1/3 | 0.002427 | 0.08014 | 0.03029 | 2517 | 0.9758 | -0.2225 | 0.2274 |
fixed | NA | count_birth_order2/3 | 0.08795 | 0.09083 | 0.9683 | 2517 | 0.333 | -0.167 | 0.3429 |
fixed | NA | count_birth_order3/3 | 0.09969 | 0.1004 | 0.9929 | 2516 | 0.3208 | -0.1821 | 0.3815 |
fixed | NA | count_birth_order1/4 | -0.193 | 0.09389 | -2.056 | 2517 | 0.03989 | -0.4566 | 0.07052 |
fixed | NA | count_birth_order2/4 | -0.03204 | 0.09714 | -0.3299 | 2517 | 0.7415 | -0.3047 | 0.2406 |
fixed | NA | count_birth_order3/4 | 0.05193 | 0.1026 | 0.5059 | 2516 | 0.6129 | -0.2362 | 0.34 |
fixed | NA | count_birth_order4/4 | -0.03512 | 0.11 | -0.3193 | 2516 | 0.7495 | -0.3439 | 0.2736 |
fixed | NA | count_birth_order1/5 | -0.0734 | 0.127 | -0.5779 | 2517 | 0.5634 | -0.4299 | 0.2831 |
fixed | NA | count_birth_order2/5 | -0.2006 | 0.1483 | -1.353 | 2516 | 0.1762 | -0.6169 | 0.2156 |
fixed | NA | count_birth_order3/5 | -0.1334 | 0.1329 | -1.003 | 2517 | 0.3158 | -0.5065 | 0.2398 |
fixed | NA | count_birth_order4/5 | -0.06657 | 0.1264 | -0.5265 | 2516 | 0.5986 | -0.4214 | 0.2883 |
fixed | NA | count_birth_order5/5 | -0.2006 | 0.1302 | -1.54 | 2516 | 0.1236 | -0.5662 | 0.165 |
fixed | NA | count_birth_order1/>5 | -0.204 | 0.1252 | -1.629 | 2514 | 0.1034 | -0.5555 | 0.1475 |
fixed | NA | count_birth_order2/>5 | -0.4087 | 0.1263 | -3.236 | 2516 | 0.001229 | -0.7632 | -0.05415 |
fixed | NA | count_birth_order3/>5 | -0.06434 | 0.1266 | -0.5081 | 2517 | 0.6115 | -0.4198 | 0.2911 |
fixed | NA | count_birth_order4/>5 | -0.05434 | 0.1165 | -0.4663 | 2517 | 0.641 | -0.3815 | 0.2728 |
fixed | NA | count_birth_order5/>5 | -0.07096 | 0.1149 | -0.6177 | 2516 | 0.5368 | -0.3934 | 0.2515 |
fixed | NA | count_birth_order>5/>5 | -0.04591 | 0.08527 | -0.5384 | 2356 | 0.5904 | -0.2853 | 0.1934 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1652 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9515 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 7048 | 7112 | -3513 | 7026 | NA | NA | NA |
12 | 7045 | 7115 | -3510 | 7021 | 5.566 | 1 | 0.01831 |
16 | 7051 | 7144 | -3509 | 7019 | 1.971 | 4 | 0.741 |
26 | 7061 | 7213 | -3505 | 7009 | 9.311 | 10 | 0.5029 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.021 | 0.8508 | -3.551 | 2536 | 0.0003903 | -5.409 | -0.6332 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2478 | 0.09033 | 2.744 | 2537 | 0.006121 | -0.005736 | 0.5014 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006428 | 0.003071 | -2.093 | 2540 | 0.03643 | -0.01505 | 0.002192 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005481 | 0.00003351 | 1.636 | 2541 | 0.102 | -0.00003925 | 0.0001489 |
fixed | NA | male | 0.1666 | 0.03915 | 4.256 | 2545 | 0.00002155 | 0.05673 | 0.2765 |
fixed | NA | sibling_count3 | 0.03445 | 0.06704 | 0.5139 | 2194 | 0.6074 | -0.1537 | 0.2226 |
fixed | NA | sibling_count4 | 0.00218 | 0.06772 | 0.03219 | 2086 | 0.9743 | -0.1879 | 0.1923 |
fixed | NA | sibling_count5 | -0.1056 | 0.0713 | -1.481 | 1944 | 0.1387 | -0.3058 | 0.09454 |
fixed | NA | sibling_count>5 | -0.08992 | 0.06331 | -1.42 | 2003 | 0.1557 | -0.2676 | 0.0878 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1499 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9564 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.016 | 0.8506 | -3.546 | 2535 | 0.0003985 | -5.403 | -0.6284 |
fixed | NA | birth_order | 0.01776 | 0.01074 | 1.653 | 2211 | 0.09839 | -0.01239 | 0.04792 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2451 | 0.09032 | 2.714 | 2537 | 0.006698 | -0.008426 | 0.4986 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006365 | 0.00307 | -2.073 | 2539 | 0.03828 | -0.01498 | 0.002254 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005472 | 0.0000335 | 1.633 | 2541 | 0.1025 | -0.00003932 | 0.0001488 |
fixed | NA | male | 0.1651 | 0.03914 | 4.218 | 2544 | 0.00002552 | 0.05523 | 0.275 |
fixed | NA | sibling_count3 | 0.0256 | 0.06726 | 0.3806 | 2191 | 0.7036 | -0.1632 | 0.2144 |
fixed | NA | sibling_count4 | -0.01668 | 0.06869 | -0.2428 | 2080 | 0.8082 | -0.2095 | 0.1761 |
fixed | NA | sibling_count5 | -0.1356 | 0.07361 | -1.842 | 1940 | 0.06558 | -0.3422 | 0.07101 |
fixed | NA | sibling_count>5 | -0.1524 | 0.07377 | -2.066 | 1993 | 0.039 | -0.3594 | 0.0547 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1605 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9544 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.025 | 0.8511 | -3.555 | 2531 | 0.0003854 | -5.414 | -0.6363 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.247 | 0.09037 | 2.733 | 2533 | 0.006314 | -0.006665 | 0.5007 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006441 | 0.003072 | -2.097 | 2536 | 0.03612 | -0.01506 | 0.002182 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005564 | 0.00003352 | 1.66 | 2538 | 0.09702 | -0.00003844 | 0.0001497 |
fixed | NA | male | 0.1661 | 0.03914 | 4.244 | 2541 | 0.00002278 | 0.05623 | 0.276 |
fixed | NA | sibling_count3 | 0.005788 | 0.06854 | 0.08445 | 2232 | 0.9327 | -0.1866 | 0.1982 |
fixed | NA | sibling_count4 | -0.05279 | 0.07109 | -0.7426 | 2178 | 0.4578 | -0.2523 | 0.1468 |
fixed | NA | sibling_count5 | -0.167 | 0.07725 | -2.161 | 2080 | 0.03079 | -0.3838 | 0.04989 |
fixed | NA | sibling_count>5 | -0.1714 | 0.07608 | -2.254 | 2088 | 0.02433 | -0.385 | 0.04211 |
fixed | NA | birth_order_nonlinear2 | 0.05834 | 0.0521 | 1.12 | 2328 | 0.263 | -0.08792 | 0.2046 |
fixed | NA | birth_order_nonlinear3 | 0.1224 | 0.06201 | 1.974 | 2428 | 0.04852 | -0.05167 | 0.2965 |
fixed | NA | birth_order_nonlinear4 | 0.1577 | 0.07258 | 2.173 | 2452 | 0.02989 | -0.04603 | 0.3614 |
fixed | NA | birth_order_nonlinear5 | 0.07475 | 0.08919 | 0.8381 | 2485 | 0.4021 | -0.1756 | 0.3251 |
fixed | NA | birth_order_nonlinear>5 | 0.1222 | 0.08292 | 1.473 | 2441 | 0.1409 | -0.1106 | 0.3549 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1634 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9539 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.005 | 0.8535 | -3.521 | 2521 | 0.0004373 | -5.401 | -0.6095 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2466 | 0.09072 | 2.718 | 2523 | 0.006617 | -0.008097 | 0.5012 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006401 | 0.003084 | -2.075 | 2525 | 0.03805 | -0.01506 | 0.002256 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005498 | 0.00003365 | 1.634 | 2527 | 0.1024 | -0.00003948 | 0.0001495 |
fixed | NA | male | 0.1643 | 0.03928 | 4.183 | 2531 | 0.00002976 | 0.05404 | 0.2745 |
fixed | NA | count_birth_order2/2 | -0.01229 | 0.1097 | -0.112 | 2369 | 0.9108 | -0.3202 | 0.2956 |
fixed | NA | count_birth_order1/3 | -0.03131 | 0.08855 | -0.3535 | 2533 | 0.7237 | -0.2799 | 0.2173 |
fixed | NA | count_birth_order2/3 | 0.1016 | 0.09821 | 1.035 | 2533 | 0.3009 | -0.1741 | 0.3773 |
fixed | NA | count_birth_order3/3 | 0.054 | 0.1103 | 0.4897 | 2533 | 0.6244 | -0.2556 | 0.3636 |
fixed | NA | count_birth_order1/4 | -0.1062 | 0.09942 | -1.068 | 2533 | 0.2857 | -0.3852 | 0.1729 |
fixed | NA | count_birth_order2/4 | 0.06707 | 0.1002 | 0.6692 | 2533 | 0.5034 | -0.2143 | 0.3484 |
fixed | NA | count_birth_order3/4 | 0.02235 | 0.1126 | 0.1984 | 2533 | 0.8427 | -0.2938 | 0.3385 |
fixed | NA | count_birth_order4/4 | 0.02293 | 0.1206 | 0.19 | 2532 | 0.8493 | -0.3157 | 0.3616 |
fixed | NA | count_birth_order1/5 | -0.1291 | 0.116 | -1.113 | 2533 | 0.2659 | -0.4547 | 0.1965 |
fixed | NA | count_birth_order2/5 | -0.1532 | 0.1278 | -1.199 | 2532 | 0.2307 | -0.5118 | 0.2055 |
fixed | NA | count_birth_order3/5 | -0.05305 | 0.1277 | -0.4155 | 2532 | 0.6778 | -0.4115 | 0.3054 |
fixed | NA | count_birth_order4/5 | -0.03084 | 0.1287 | -0.2395 | 2531 | 0.8107 | -0.3922 | 0.3306 |
fixed | NA | count_birth_order5/5 | -0.1853 | 0.1282 | -1.446 | 2532 | 0.1484 | -0.5452 | 0.1746 |
fixed | NA | count_birth_order1/>5 | -0.2191 | 0.1105 | -1.984 | 2530 | 0.04737 | -0.5292 | 0.09091 |
fixed | NA | count_birth_order2/>5 | -0.2885 | 0.1175 | -2.456 | 2532 | 0.01411 | -0.6183 | 0.04121 |
fixed | NA | count_birth_order3/>5 | 0.006948 | 0.1182 | 0.05879 | 2533 | 0.9531 | -0.3248 | 0.3387 |
fixed | NA | count_birth_order4/>5 | 0.008072 | 0.1093 | 0.07383 | 2533 | 0.9411 | -0.2988 | 0.315 |
fixed | NA | count_birth_order5/>5 | -0.06426 | 0.1169 | -0.5495 | 2531 | 0.5827 | -0.3925 | 0.264 |
fixed | NA | count_birth_order>5/>5 | -0.07115 | 0.08545 | -0.8326 | 2414 | 0.4051 | -0.311 | 0.1687 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1732 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9527 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 7103 | 7167 | -3541 | 7081 | NA | NA | NA |
12 | 7102 | 7173 | -3539 | 7078 | 2.723 | 1 | 0.0989 |
16 | 7106 | 7200 | -3537 | 7074 | 3.99 | 4 | 0.4074 |
26 | 7119 | 7271 | -3533 | 7067 | 7.706 | 10 | 0.6575 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.95 | 0.8647 | -3.411 | 2471 | 0.0006572 | -5.377 | -0.5224 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2362 | 0.09172 | 2.575 | 2473 | 0.01007 | -0.02125 | 0.4937 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005959 | 0.003116 | -1.912 | 2475 | 0.05597 | -0.01471 | 0.002789 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004927 | 0.00003398 | 1.45 | 2477 | 0.1472 | -0.00004612 | 0.0001446 |
fixed | NA | male | 0.1752 | 0.03992 | 4.388 | 2480 | 0.00001193 | 0.06311 | 0.2872 |
fixed | NA | sibling_count3 | 0.04336 | 0.06038 | 0.7181 | 2078 | 0.4728 | -0.1261 | 0.2129 |
fixed | NA | sibling_count4 | -0.08107 | 0.06277 | -1.292 | 1918 | 0.1967 | -0.2573 | 0.09513 |
fixed | NA | sibling_count5 | -0.09708 | 0.07355 | -1.32 | 1726 | 0.187 | -0.3035 | 0.1094 |
fixed | NA | sibling_count>5 | -0.08266 | 0.06241 | -1.324 | 1639 | 0.1855 | -0.2578 | 0.09252 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.15 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9632 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.931 | 0.8643 | -3.391 | 2470 | 0.0007075 | -5.357 | -0.5047 |
fixed | NA | birth_order | 0.02467 | 0.01273 | 1.938 | 2248 | 0.05277 | -0.01107 | 0.06042 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2313 | 0.09171 | 2.523 | 2471 | 0.01171 | -0.02609 | 0.4888 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005839 | 0.003115 | -1.874 | 2474 | 0.061 | -0.01458 | 0.002906 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00004885 | 0.00003396 | 1.438 | 2476 | 0.1505 | -0.00004649 | 0.0001442 |
fixed | NA | male | 0.1739 | 0.03991 | 4.357 | 2480 | 0.0000137 | 0.06187 | 0.2859 |
fixed | NA | sibling_count3 | 0.03093 | 0.06071 | 0.5095 | 2075 | 0.6105 | -0.1395 | 0.2014 |
fixed | NA | sibling_count4 | -0.108 | 0.06429 | -1.68 | 1925 | 0.09304 | -0.2885 | 0.07243 |
fixed | NA | sibling_count5 | -0.1412 | 0.07701 | -1.834 | 1734 | 0.06688 | -0.3574 | 0.07497 |
fixed | NA | sibling_count>5 | -0.1711 | 0.07736 | -2.212 | 1731 | 0.02708 | -0.3883 | 0.04601 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1571 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9616 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.945 | 0.8651 | -3.404 | 2466 | 0.0006738 | -5.374 | -0.5167 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2361 | 0.09179 | 2.573 | 2468 | 0.01015 | -0.02152 | 0.4938 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006009 | 0.003118 | -1.927 | 2470 | 0.05408 | -0.01476 | 0.002744 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000507 | 0.000034 | 1.491 | 2473 | 0.136 | -0.00004473 | 0.0001461 |
fixed | NA | male | 0.1757 | 0.03993 | 4.402 | 2476 | 0.00001119 | 0.06367 | 0.2878 |
fixed | NA | sibling_count3 | 0.009872 | 0.06207 | 0.159 | 2135 | 0.8737 | -0.1644 | 0.1841 |
fixed | NA | sibling_count4 | -0.1259 | 0.06698 | -1.88 | 2064 | 0.06029 | -0.3139 | 0.06211 |
fixed | NA | sibling_count5 | -0.1521 | 0.08111 | -1.875 | 1911 | 0.0609 | -0.3798 | 0.07557 |
fixed | NA | sibling_count>5 | -0.1838 | 0.07992 | -2.3 | 1849 | 0.02158 | -0.4081 | 0.04056 |
fixed | NA | birth_order_nonlinear2 | 0.01217 | 0.05179 | 0.235 | 2249 | 0.8142 | -0.1332 | 0.1576 |
fixed | NA | birth_order_nonlinear3 | 0.1384 | 0.0622 | 2.225 | 2331 | 0.02614 | -0.03617 | 0.313 |
fixed | NA | birth_order_nonlinear4 | 0.05726 | 0.07794 | 0.7346 | 2369 | 0.4626 | -0.1615 | 0.276 |
fixed | NA | birth_order_nonlinear5 | 0.07804 | 0.09835 | 0.7935 | 2397 | 0.4276 | -0.198 | 0.3541 |
fixed | NA | birth_order_nonlinear>5 | 0.1773 | 0.09559 | 1.855 | 2387 | 0.0637 | -0.09099 | 0.4457 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1621 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9608 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.969 | 0.8669 | -3.426 | 2456 | 0.0006237 | -5.403 | -0.5361 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2408 | 0.09211 | 2.615 | 2458 | 0.008989 | -0.01773 | 0.4994 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.006135 | 0.003129 | -1.96 | 2460 | 0.05006 | -0.01492 | 0.002649 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005172 | 0.00003412 | 1.516 | 2462 | 0.1298 | -0.00004407 | 0.0001475 |
fixed | NA | male | 0.1726 | 0.04006 | 4.308 | 2466 | 0.00001712 | 0.06013 | 0.285 |
fixed | NA | count_birth_order2/2 | -0.07046 | 0.09561 | -0.7369 | 2240 | 0.4613 | -0.3388 | 0.1979 |
fixed | NA | count_birth_order1/3 | -0.04347 | 0.08004 | -0.5431 | 2467 | 0.5871 | -0.2681 | 0.1812 |
fixed | NA | count_birth_order2/3 | 0.06615 | 0.09109 | 0.7262 | 2468 | 0.4678 | -0.1895 | 0.3218 |
fixed | NA | count_birth_order3/3 | 0.08534 | 0.09871 | 0.8646 | 2466 | 0.3874 | -0.1917 | 0.3624 |
fixed | NA | count_birth_order1/4 | -0.2178 | 0.09523 | -2.287 | 2468 | 0.0223 | -0.4851 | 0.04955 |
fixed | NA | count_birth_order2/4 | -0.0797 | 0.09775 | -0.8153 | 2468 | 0.415 | -0.3541 | 0.1947 |
fixed | NA | count_birth_order3/4 | 0.04818 | 0.1035 | 0.4657 | 2468 | 0.6415 | -0.2423 | 0.3386 |
fixed | NA | count_birth_order4/4 | -0.1601 | 0.1133 | -1.414 | 2467 | 0.1575 | -0.478 | 0.1578 |
fixed | NA | count_birth_order1/5 | -0.08318 | 0.1309 | -0.6352 | 2468 | 0.5253 | -0.4507 | 0.2844 |
fixed | NA | count_birth_order2/5 | -0.1651 | 0.1522 | -1.085 | 2468 | 0.2782 | -0.5923 | 0.2622 |
fixed | NA | count_birth_order3/5 | -0.09123 | 0.1405 | -0.6492 | 2468 | 0.5163 | -0.4857 | 0.3032 |
fixed | NA | count_birth_order4/5 | -0.1192 | 0.1345 | -0.8861 | 2467 | 0.3756 | -0.4966 | 0.2583 |
fixed | NA | count_birth_order5/5 | -0.1676 | 0.1392 | -1.204 | 2467 | 0.2288 | -0.5584 | 0.2232 |
fixed | NA | count_birth_order1/>5 | -0.1719 | 0.1281 | -1.342 | 2465 | 0.1799 | -0.5314 | 0.1877 |
fixed | NA | count_birth_order2/>5 | -0.3917 | 0.1323 | -2.961 | 2468 | 0.003096 | -0.763 | -0.02036 |
fixed | NA | count_birth_order3/>5 | -0.06893 | 0.1285 | -0.5364 | 2468 | 0.5917 | -0.4296 | 0.2918 |
fixed | NA | count_birth_order4/>5 | -0.07846 | 0.1223 | -0.6416 | 2467 | 0.5212 | -0.4217 | 0.2648 |
fixed | NA | count_birth_order5/>5 | -0.08894 | 0.1182 | -0.7525 | 2467 | 0.4518 | -0.4207 | 0.2428 |
fixed | NA | count_birth_order>5/>5 | -0.03323 | 0.08726 | -0.3809 | 2282 | 0.7033 | -0.2782 | 0.2117 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1651 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9606 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 6958 | 7022 | -3468 | 6936 | NA | NA | NA |
12 | 6956 | 7026 | -3466 | 6932 | 3.756 | 1 | 0.05262 |
16 | 6960 | 7053 | -3464 | 6928 | 3.587 | 4 | 0.4648 |
26 | 6971 | 7123 | -3460 | 6919 | 8.955 | 10 | 0.5364 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = wage_last_year_z)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.932 | 0.3808 | -10.33 | 5912 | 8.56e-25 | -5.001 | -2.864 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.3021 | 0.03594 | 8.408 | 5904 | 5.174e-17 | 0.2013 | 0.403 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.007364 | 0.001071 | -6.873 | 5897 | 6.923e-12 | -0.01037 | -0.004357 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005769 | 0.00001015 | 5.683 | 5892 | 0.00000001388 | 0.00002919 | 0.00008618 |
fixed | NA | male | 0.1267 | 0.02642 | 4.798 | 5923 | 0.000001641 | 0.0526 | 0.2009 |
fixed | NA | sibling_count3 | 0.0766 | 0.05286 | 1.449 | 4789 | 0.1474 | -0.07179 | 0.225 |
fixed | NA | sibling_count4 | 0.04296 | 0.05286 | 0.8128 | 4611 | 0.4164 | -0.1054 | 0.1913 |
fixed | NA | sibling_count5 | 0.03471 | 0.05503 | 0.6307 | 4424 | 0.5282 | -0.1198 | 0.1892 |
fixed | NA | sibling_count>5 | -0.04989 | 0.04336 | -1.151 | 4726 | 0.2499 | -0.1716 | 0.07181 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.341 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9299 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.925 | 0.3809 | -10.3 | 5910 | 1.092e-24 | -4.994 | -2.856 |
fixed | NA | birth_order | 0.003522 | 0.005228 | 0.6737 | 5269 | 0.5005 | -0.01115 | 0.0182 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.3005 | 0.03602 | 8.344 | 5897 | 8.887e-17 | 0.1994 | 0.4016 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.007309 | 0.001075 | -6.801 | 5882 | 0.00000000001145 | -0.01033 | -0.004292 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005716 | 0.00001018 | 5.614 | 5875 | 0.00000002067 | 0.00002858 | 0.00008574 |
fixed | NA | male | 0.1265 | 0.02642 | 4.789 | 5922 | 0.000001716 | 0.05237 | 0.2007 |
fixed | NA | sibling_count3 | 0.07559 | 0.05289 | 1.429 | 4793 | 0.153 | -0.07288 | 0.2241 |
fixed | NA | sibling_count4 | 0.0403 | 0.05301 | 0.7601 | 4635 | 0.4472 | -0.1085 | 0.1891 |
fixed | NA | sibling_count5 | 0.03033 | 0.05542 | 0.5472 | 4465 | 0.5842 | -0.1252 | 0.1859 |
fixed | NA | sibling_count>5 | -0.06306 | 0.04756 | -1.326 | 5053 | 0.1849 | -0.1966 | 0.07045 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3417 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9298 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.911 | 0.3816 | -10.25 | 5903 | 1.929e-24 | -4.982 | -2.84 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.3 | 0.03603 | 8.327 | 5892 | 1.021e-16 | 0.1989 | 0.4012 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.007284 | 0.001075 | -6.773 | 5876 | 0.00000000001386 | -0.0103 | -0.004265 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005682 | 0.0000102 | 5.573 | 5867 | 0.00000002613 | 0.0000282 | 0.00008544 |
fixed | NA | male | 0.1269 | 0.02642 | 4.801 | 5919 | 0.000001614 | 0.0527 | 0.201 |
fixed | NA | sibling_count3 | 0.08191 | 0.05362 | 1.528 | 4907 | 0.1267 | -0.0686 | 0.2324 |
fixed | NA | sibling_count4 | 0.04998 | 0.05468 | 0.9141 | 4884 | 0.3607 | -0.1035 | 0.2035 |
fixed | NA | sibling_count5 | 0.02631 | 0.05763 | 0.4565 | 4795 | 0.6481 | -0.1355 | 0.1881 |
fixed | NA | sibling_count>5 | -0.06185 | 0.05001 | -1.237 | 5369 | 0.2162 | -0.2022 | 0.07853 |
fixed | NA | birth_order_nonlinear2 | -0.0194 | 0.03805 | -0.5098 | 5505 | 0.6102 | -0.1262 | 0.08742 |
fixed | NA | birth_order_nonlinear3 | -0.0268 | 0.04408 | -0.608 | 5472 | 0.5432 | -0.1505 | 0.09694 |
fixed | NA | birth_order_nonlinear4 | -0.01244 | 0.04932 | -0.2522 | 5521 | 0.8009 | -0.1509 | 0.126 |
fixed | NA | birth_order_nonlinear5 | 0.07847 | 0.05601 | 1.401 | 5489 | 0.1613 | -0.07875 | 0.2357 |
fixed | NA | birth_order_nonlinear>5 | 0.006064 | 0.04625 | 0.1311 | 5931 | 0.8957 | -0.1238 | 0.1359 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3407 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9302 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -3.899 | 0.3829 | -10.18 | 5894 | 3.712e-24 | -4.974 | -2.824 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2982 | 0.03608 | 8.265 | 5881 | 1.717e-16 | 0.1969 | 0.3995 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.007207 | 0.001077 | -6.691 | 5864 | 0.00000000002416 | -0.01023 | -0.004184 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005593 | 0.00001021 | 5.476 | 5853 | 0.00000004539 | 0.00002726 | 0.0000846 |
fixed | NA | male | 0.1262 | 0.02645 | 4.771 | 5909 | 0.00000188 | 0.05193 | 0.2004 |
fixed | NA | count_birth_order2/2 | -0.02015 | 0.07713 | -0.2613 | 5573 | 0.7939 | -0.2367 | 0.1964 |
fixed | NA | count_birth_order1/3 | 0.09485 | 0.06972 | 1.36 | 5895 | 0.1738 | -0.1009 | 0.2906 |
fixed | NA | count_birth_order2/3 | 0.03908 | 0.0799 | 0.4891 | 5916 | 0.6248 | -0.1852 | 0.2634 |
fixed | NA | count_birth_order3/3 | 0.05765 | 0.08899 | 0.6479 | 5921 | 0.5171 | -0.1921 | 0.3074 |
fixed | NA | count_birth_order1/4 | 0.1217 | 0.07784 | 1.563 | 5912 | 0.118 | -0.09681 | 0.3402 |
fixed | NA | count_birth_order2/4 | 0.02243 | 0.08287 | 0.2707 | 5916 | 0.7866 | -0.2102 | 0.2551 |
fixed | NA | count_birth_order3/4 | -0.07628 | 0.08696 | -0.8772 | 5920 | 0.3804 | -0.3204 | 0.1678 |
fixed | NA | count_birth_order4/4 | 0.04495 | 0.09473 | 0.4745 | 5921 | 0.6352 | -0.221 | 0.3109 |
fixed | NA | count_birth_order1/5 | 0.07361 | 0.08756 | 0.8407 | 5918 | 0.4006 | -0.1722 | 0.3194 |
fixed | NA | count_birth_order2/5 | 0.0388 | 0.09613 | 0.4036 | 5920 | 0.6865 | -0.231 | 0.3086 |
fixed | NA | count_birth_order3/5 | 0.03883 | 0.09843 | 0.3945 | 5919 | 0.6932 | -0.2375 | 0.3151 |
fixed | NA | count_birth_order4/5 | -0.1091 | 0.1005 | -1.086 | 5914 | 0.2777 | -0.3912 | 0.173 |
fixed | NA | count_birth_order5/5 | 0.07412 | 0.1036 | 0.7154 | 5915 | 0.4744 | -0.2167 | 0.365 |
fixed | NA | count_birth_order1/>5 | -0.1477 | 0.06989 | -2.113 | 5921 | 0.03468 | -0.3438 | 0.04854 |
fixed | NA | count_birth_order2/>5 | -0.07679 | 0.07276 | -1.055 | 5917 | 0.2913 | -0.281 | 0.1274 |
fixed | NA | count_birth_order3/>5 | -0.05401 | 0.072 | -0.7501 | 5915 | 0.4532 | -0.2561 | 0.1481 |
fixed | NA | count_birth_order4/>5 | -0.0383 | 0.0698 | -0.5487 | 5920 | 0.5832 | -0.2342 | 0.1576 |
fixed | NA | count_birth_order5/>5 | 0.02497 | 0.07063 | 0.3535 | 5915 | 0.7237 | -0.1733 | 0.2232 |
fixed | NA | count_birth_order>5/>5 | -0.05612 | 0.05586 | -1.005 | 5575 | 0.3152 | -0.2129 | 0.1007 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.3415 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9299 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 16736 | 16809 | -8357 | 16714 | NA | NA | NA |
12 | 16737 | 16818 | -8357 | 16713 | 0.4529 | 1 | 0.501 |
16 | 16742 | 16849 | -8355 | 16710 | 3.397 | 4 | 0.4938 |
26 | 16752 | 16926 | -8350 | 16700 | 10.14 | 10 | 0.4285 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.457 | 0.8887 | -6.141 | 2513 | 0.0000000009516 | -7.952 | -2.963 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4617 | 0.0944 | 4.891 | 2515 | 0.000001066 | 0.1967 | 0.7267 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01258 | 0.003215 | -3.911 | 2516 | 0.00009423 | -0.0216 | -0.003551 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001155 | 0.00003516 | 3.286 | 2517 | 0.001031 | 0.00001684 | 0.0002142 |
fixed | NA | male | 0.17 | 0.04053 | 4.196 | 2517 | 0.00002814 | 0.05628 | 0.2838 |
fixed | NA | sibling_count3 | 0.03386 | 0.06327 | 0.5352 | 2061 | 0.5926 | -0.1437 | 0.2115 |
fixed | NA | sibling_count4 | -0.04681 | 0.06518 | -0.7182 | 1914 | 0.4727 | -0.2298 | 0.1361 |
fixed | NA | sibling_count5 | -0.1543 | 0.07425 | -2.078 | 1798 | 0.03787 | -0.3627 | 0.05415 |
fixed | NA | sibling_count>5 | -0.1823 | 0.0642 | -2.84 | 1712 | 0.004566 | -0.3625 | -0.002109 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2543 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9641 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.45 | 0.8887 | -6.133 | 2512 | 0.000000001 | -7.945 | -2.956 |
fixed | NA | birth_order | 0.01116 | 0.01275 | 0.8758 | 2332 | 0.3812 | -0.02462 | 0.04695 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4598 | 0.09444 | 4.869 | 2513 | 0.000001194 | 0.1947 | 0.7249 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01253 | 0.003216 | -3.897 | 2515 | 0.0001001 | -0.02156 | -0.003504 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001155 | 0.00003516 | 3.284 | 2516 | 0.001038 | 0.00001677 | 0.0002142 |
fixed | NA | male | 0.1691 | 0.04054 | 4.171 | 2516 | 0.00003137 | 0.05529 | 0.2829 |
fixed | NA | sibling_count3 | 0.02843 | 0.06359 | 0.4472 | 2061 | 0.6548 | -0.1501 | 0.2069 |
fixed | NA | sibling_count4 | -0.05926 | 0.06673 | -0.8881 | 1922 | 0.3746 | -0.2466 | 0.128 |
fixed | NA | sibling_count5 | -0.175 | 0.07795 | -2.245 | 1808 | 0.02487 | -0.3938 | 0.04379 |
fixed | NA | sibling_count>5 | -0.2227 | 0.07907 | -2.817 | 1791 | 0.004904 | -0.4447 | -0.0007727 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2562 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9637 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.411 | 0.8892 | -6.085 | 2508 | 0.000000001346 | -7.907 | -2.915 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4567 | 0.09448 | 4.833 | 2510 | 0.000001423 | 0.1914 | 0.7219 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01242 | 0.003218 | -3.861 | 2511 | 0.0001157 | -0.02146 | -0.003392 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001143 | 0.00003518 | 3.248 | 2512 | 0.001179 | 0.0000155 | 0.000213 |
fixed | NA | male | 0.1692 | 0.04053 | 4.174 | 2512 | 0.00003095 | 0.0554 | 0.2829 |
fixed | NA | sibling_count3 | 0.01621 | 0.06489 | 0.2498 | 2123 | 0.8027 | -0.1659 | 0.1984 |
fixed | NA | sibling_count4 | -0.08453 | 0.06948 | -1.216 | 2061 | 0.2239 | -0.2796 | 0.1105 |
fixed | NA | sibling_count5 | -0.1747 | 0.08228 | -2.123 | 1980 | 0.03385 | -0.4057 | 0.05625 |
fixed | NA | sibling_count>5 | -0.2263 | 0.08151 | -2.777 | 1904 | 0.005541 | -0.4551 | 0.002451 |
fixed | NA | birth_order_nonlinear2 | 0.01137 | 0.05292 | 0.2149 | 2230 | 0.8299 | -0.1372 | 0.1599 |
fixed | NA | birth_order_nonlinear3 | 0.07625 | 0.06357 | 1.199 | 2315 | 0.2305 | -0.1022 | 0.2547 |
fixed | NA | birth_order_nonlinear4 | 0.101 | 0.07699 | 1.311 | 2364 | 0.1899 | -0.1152 | 0.3171 |
fixed | NA | birth_order_nonlinear5 | -0.07953 | 0.09654 | -0.8238 | 2417 | 0.4101 | -0.3505 | 0.1915 |
fixed | NA | birth_order_nonlinear>5 | 0.09209 | 0.09551 | 0.9642 | 2473 | 0.335 | -0.176 | 0.3602 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.262 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.962 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.375 | 0.8908 | -6.033 | 2498 | 0.000000001844 | -7.875 | -2.874 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4507 | 0.09477 | 4.756 | 2499 | 0.000002085 | 0.1847 | 0.7167 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01218 | 0.003228 | -3.774 | 2501 | 0.0001641 | -0.02124 | -0.003123 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001113 | 0.0000353 | 3.153 | 2502 | 0.001636 | 0.00001221 | 0.0002104 |
fixed | NA | male | 0.1628 | 0.04062 | 4.007 | 2502 | 0.00006336 | 0.04874 | 0.2768 |
fixed | NA | count_birth_order2/2 | 0.05057 | 0.0999 | 0.5062 | 2260 | 0.6128 | -0.2298 | 0.331 |
fixed | NA | count_birth_order1/3 | 0.008137 | 0.08297 | 0.09806 | 2501 | 0.9219 | -0.2248 | 0.241 |
fixed | NA | count_birth_order2/3 | 0.11 | 0.09415 | 1.168 | 2502 | 0.2428 | -0.1543 | 0.3743 |
fixed | NA | count_birth_order3/3 | 0.05356 | 0.1036 | 0.5168 | 2500 | 0.6054 | -0.2374 | 0.3445 |
fixed | NA | count_birth_order1/4 | -0.09397 | 0.09738 | -0.965 | 2502 | 0.3347 | -0.3673 | 0.1794 |
fixed | NA | count_birth_order2/4 | -0.06464 | 0.1005 | -0.6428 | 2502 | 0.5204 | -0.3469 | 0.2176 |
fixed | NA | count_birth_order3/4 | 0.04913 | 0.1063 | 0.4623 | 2500 | 0.6439 | -0.2492 | 0.3474 |
fixed | NA | count_birth_order4/4 | 0.0121 | 0.1135 | 0.1066 | 2498 | 0.9151 | -0.3065 | 0.3308 |
fixed | NA | count_birth_order1/5 | -0.008234 | 0.1311 | -0.06281 | 2502 | 0.9499 | -0.3763 | 0.3598 |
fixed | NA | count_birth_order2/5 | -0.1178 | 0.153 | -0.7701 | 2497 | 0.4413 | -0.5473 | 0.3116 |
fixed | NA | count_birth_order3/5 | -0.1788 | 0.1381 | -1.295 | 2500 | 0.1955 | -0.5664 | 0.2088 |
fixed | NA | count_birth_order4/5 | -0.04439 | 0.1305 | -0.3402 | 2498 | 0.7337 | -0.4106 | 0.3218 |
fixed | NA | count_birth_order5/5 | -0.3668 | 0.1344 | -2.729 | 2499 | 0.0064 | -0.744 | 0.01051 |
fixed | NA | count_birth_order1/>5 | -0.1898 | 0.1294 | -1.467 | 2502 | 0.1424 | -0.553 | 0.1733 |
fixed | NA | count_birth_order2/>5 | -0.4359 | 0.1304 | -3.343 | 2501 | 0.0008405 | -0.8019 | -0.06991 |
fixed | NA | count_birth_order3/>5 | -0.0447 | 0.1321 | -0.3384 | 2501 | 0.7351 | -0.4155 | 0.3261 |
fixed | NA | count_birth_order4/>5 | -0.1088 | 0.1208 | -0.9012 | 2496 | 0.3676 | -0.4478 | 0.2301 |
fixed | NA | count_birth_order5/>5 | -0.2063 | 0.1181 | -1.747 | 2494 | 0.08069 | -0.5377 | 0.1251 |
fixed | NA | count_birth_order>5/>5 | -0.122 | 0.0885 | -1.378 | 2360 | 0.1682 | -0.3704 | 0.1264 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2591 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9626 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 7164 | 7228 | -3571 | 7142 | NA | NA | NA |
12 | 7165 | 7235 | -3570 | 7141 | 0.7669 | 1 | 0.3812 |
16 | 7168 | 7261 | -3568 | 7136 | 4.699 | 4 | 0.3195 |
26 | 7177 | 7329 | -3563 | 7125 | 10.95 | 10 | 0.3616 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.441 | 0.8839 | -6.156 | 2529 | 0.0000000008662 | -7.922 | -2.96 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4605 | 0.09398 | 4.9 | 2530 | 0.000001019 | 0.1967 | 0.7243 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01255 | 0.003201 | -3.921 | 2532 | 0.00009034 | -0.02154 | -0.003568 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001153 | 0.00003501 | 3.292 | 2533 | 0.001008 | 0.00001698 | 0.0002135 |
fixed | NA | male | 0.1649 | 0.04032 | 4.089 | 2533 | 0.00004466 | 0.05169 | 0.278 |
fixed | NA | sibling_count3 | 0.03006 | 0.06953 | 0.4324 | 2134 | 0.6655 | -0.1651 | 0.2252 |
fixed | NA | sibling_count4 | 0.01484 | 0.07034 | 0.2109 | 2025 | 0.833 | -0.1826 | 0.2123 |
fixed | NA | sibling_count5 | -0.1237 | 0.07397 | -1.673 | 1900 | 0.09451 | -0.3314 | 0.0839 |
fixed | NA | sibling_count>5 | -0.153 | 0.06571 | -2.328 | 1970 | 0.02003 | -0.3374 | 0.0315 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2542 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.962 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.441 | 0.884 | -6.154 | 2528 | 0.0000000008751 | -7.922 | -2.959 |
fixed | NA | birth_order | 0.001754 | 0.01111 | 0.158 | 2270 | 0.8745 | -0.02942 | 0.03293 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4603 | 0.09402 | 4.896 | 2529 | 0.000001042 | 0.1964 | 0.7242 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01255 | 0.003202 | -3.919 | 2531 | 0.00009134 | -0.02154 | -0.00356 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001153 | 0.00003501 | 3.292 | 2532 | 0.001009 | 0.00001697 | 0.0002135 |
fixed | NA | male | 0.1647 | 0.04034 | 4.083 | 2532 | 0.00004582 | 0.05147 | 0.2779 |
fixed | NA | sibling_count3 | 0.02918 | 0.06976 | 0.4183 | 2132 | 0.6757 | -0.1666 | 0.225 |
fixed | NA | sibling_count4 | 0.01296 | 0.07136 | 0.1816 | 2021 | 0.8559 | -0.1874 | 0.2133 |
fixed | NA | sibling_count5 | -0.1267 | 0.07636 | -1.66 | 1899 | 0.09714 | -0.3411 | 0.08761 |
fixed | NA | sibling_count>5 | -0.1591 | 0.07655 | -2.079 | 1976 | 0.03775 | -0.374 | 0.05573 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2551 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9619 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.442 | 0.8838 | -6.157 | 2524 | 0.0000000008593 | -7.923 | -2.961 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4599 | 0.09399 | 4.893 | 2526 | 0.000001054 | 0.1961 | 0.7238 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01254 | 0.003201 | -3.916 | 2527 | 0.00009242 | -0.02152 | -0.00355 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001151 | 0.000035 | 3.289 | 2528 | 0.001018 | 0.00001688 | 0.0002134 |
fixed | NA | male | 0.1643 | 0.0403 | 4.077 | 2528 | 0.00004697 | 0.05119 | 0.2774 |
fixed | NA | sibling_count3 | 0.009383 | 0.07102 | 0.1321 | 2177 | 0.8949 | -0.19 | 0.2087 |
fixed | NA | sibling_count4 | -0.0289 | 0.07374 | -0.3919 | 2122 | 0.6952 | -0.2359 | 0.1781 |
fixed | NA | sibling_count5 | -0.1455 | 0.07999 | -1.819 | 2042 | 0.06907 | -0.37 | 0.07904 |
fixed | NA | sibling_count>5 | -0.1811 | 0.07882 | -2.297 | 2072 | 0.02169 | -0.4023 | 0.04016 |
fixed | NA | birth_order_nonlinear2 | 0.02068 | 0.05343 | 0.3871 | 2271 | 0.6987 | -0.1293 | 0.1707 |
fixed | NA | birth_order_nonlinear3 | 0.09024 | 0.06368 | 1.417 | 2376 | 0.1566 | -0.08851 | 0.269 |
fixed | NA | birth_order_nonlinear4 | 0.1398 | 0.07445 | 1.878 | 2396 | 0.06046 | -0.06915 | 0.3488 |
fixed | NA | birth_order_nonlinear5 | -0.1024 | 0.0914 | -1.121 | 2434 | 0.2625 | -0.359 | 0.1541 |
fixed | NA | birth_order_nonlinear>5 | 0.03478 | 0.08567 | 0.406 | 2463 | 0.6847 | -0.2057 | 0.2753 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2586 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9602 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.453 | 0.8868 | -6.149 | 2513 | 0.0000000009035 | -7.942 | -2.964 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4599 | 0.09439 | 4.873 | 2515 | 0.00000117 | 0.195 | 0.7249 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01251 | 0.003215 | -3.89 | 2517 | 0.0001027 | -0.02153 | -0.003483 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001146 | 0.00003516 | 3.259 | 2518 | 0.001133 | 0.0000159 | 0.0002133 |
fixed | NA | male | 0.1614 | 0.04046 | 3.989 | 2518 | 0.00006832 | 0.04781 | 0.2749 |
fixed | NA | count_birth_order2/2 | 0.03684 | 0.1127 | 0.327 | 2336 | 0.7437 | -0.2794 | 0.3531 |
fixed | NA | count_birth_order1/3 | -0.01654 | 0.09127 | -0.1812 | 2517 | 0.8562 | -0.2727 | 0.2397 |
fixed | NA | count_birth_order2/3 | 0.1026 | 0.1014 | 1.012 | 2518 | 0.3117 | -0.182 | 0.3871 |
fixed | NA | count_birth_order3/3 | 0.07168 | 0.1133 | 0.6325 | 2517 | 0.5271 | -0.2465 | 0.3898 |
fixed | NA | count_birth_order1/4 | 0.000209 | 0.1026 | 0.002036 | 2518 | 0.9984 | -0.2879 | 0.2883 |
fixed | NA | count_birth_order2/4 | 0.01402 | 0.1032 | 0.1358 | 2518 | 0.892 | -0.2758 | 0.3038 |
fixed | NA | count_birth_order3/4 | 0.02956 | 0.1166 | 0.2536 | 2516 | 0.7998 | -0.2977 | 0.3568 |
fixed | NA | count_birth_order4/4 | 0.08172 | 0.124 | 0.6593 | 2514 | 0.5098 | -0.2662 | 0.4297 |
fixed | NA | count_birth_order1/5 | -0.07394 | 0.1193 | -0.6201 | 2518 | 0.5353 | -0.4087 | 0.2608 |
fixed | NA | count_birth_order2/5 | -0.1639 | 0.1313 | -1.249 | 2515 | 0.2118 | -0.5324 | 0.2045 |
fixed | NA | count_birth_order3/5 | -0.01559 | 0.1312 | -0.1188 | 2515 | 0.9054 | -0.3838 | 0.3526 |
fixed | NA | count_birth_order4/5 | 0.03078 | 0.1323 | 0.2328 | 2512 | 0.816 | -0.3405 | 0.402 |
fixed | NA | count_birth_order5/5 | -0.3571 | 0.1317 | -2.712 | 2514 | 0.006743 | -0.7269 | 0.01258 |
fixed | NA | count_birth_order1/>5 | -0.1954 | 0.1136 | -1.72 | 2517 | 0.08555 | -0.5144 | 0.1235 |
fixed | NA | count_birth_order2/>5 | -0.2732 | 0.1208 | -2.263 | 2518 | 0.02375 | -0.6122 | 0.06575 |
fixed | NA | count_birth_order3/>5 | -0.03812 | 0.122 | -0.3126 | 2517 | 0.7546 | -0.3805 | 0.3043 |
fixed | NA | count_birth_order4/>5 | -0.03309 | 0.1126 | -0.2937 | 2516 | 0.769 | -0.3493 | 0.2831 |
fixed | NA | count_birth_order5/>5 | -0.1922 | 0.1201 | -1.6 | 2510 | 0.1097 | -0.5295 | 0.145 |
fixed | NA | count_birth_order>5/>5 | -0.1421 | 0.08825 | -1.61 | 2406 | 0.1075 | -0.3898 | 0.1056 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2591 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9609 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 7198 | 7262 | -3588 | 7176 | NA | NA | NA |
12 | 7200 | 7270 | -3588 | 7176 | 0.02429 | 1 | 0.8761 |
16 | 7200 | 7293 | -3584 | 7168 | 8.315 | 4 | 0.08069 |
26 | 7214 | 7366 | -3581 | 7162 | 5.651 | 10 | 0.8437 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.422 | 0.9015 | -6.014 | 2464 | 0.000000002078 | -7.952 | -2.891 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4572 | 0.09577 | 4.773 | 2465 | 0.000001918 | 0.1883 | 0.726 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01237 | 0.00326 | -3.794 | 2467 | 0.0001518 | -0.02152 | -0.003218 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001128 | 0.00003563 | 3.166 | 2468 | 0.001565 | 0.00001278 | 0.0002128 |
fixed | NA | male | 0.1739 | 0.04126 | 4.215 | 2468 | 0.00002588 | 0.0581 | 0.2898 |
fixed | NA | sibling_count3 | -0.003189 | 0.06289 | -0.05071 | 2016 | 0.9596 | -0.1797 | 0.1733 |
fixed | NA | sibling_count4 | -0.1003 | 0.06552 | -1.53 | 1856 | 0.1261 | -0.2842 | 0.08365 |
fixed | NA | sibling_count5 | -0.1661 | 0.07676 | -2.164 | 1689 | 0.03057 | -0.3816 | 0.04933 |
fixed | NA | sibling_count>5 | -0.1681 | 0.06519 | -2.579 | 1623 | 0.009992 | -0.3511 | 0.01486 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2569 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.972 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.415 | 0.9017 | -6.005 | 2463 | 0.000000002191 | -7.946 | -2.884 |
fixed | NA | birth_order | 0.008665 | 0.0132 | 0.6563 | 2305 | 0.5117 | -0.0284 | 0.04573 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4554 | 0.09582 | 4.753 | 2464 | 0.000002122 | 0.1864 | 0.7244 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01233 | 0.003261 | -3.78 | 2466 | 0.0001607 | -0.02148 | -0.003172 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001127 | 0.00003563 | 3.161 | 2467 | 0.001589 | 0.00001263 | 0.0002127 |
fixed | NA | male | 0.1734 | 0.04128 | 4.2 | 2467 | 0.00002758 | 0.05752 | 0.2892 |
fixed | NA | sibling_count3 | -0.007568 | 0.06326 | -0.1196 | 2014 | 0.9048 | -0.1851 | 0.17 |
fixed | NA | sibling_count4 | -0.1098 | 0.06712 | -1.635 | 1867 | 0.1021 | -0.2982 | 0.07863 |
fixed | NA | sibling_count5 | -0.1818 | 0.08039 | -2.261 | 1703 | 0.02388 | -0.4074 | 0.04389 |
fixed | NA | sibling_count>5 | -0.1994 | 0.08076 | -2.469 | 1739 | 0.01365 | -0.4261 | 0.02731 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9718 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.41 | 0.9024 | -5.996 | 2459 | 0.000000002325 | -7.943 | -2.877 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4563 | 0.09589 | 4.759 | 2461 | 0.00000206 | 0.1872 | 0.7255 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01236 | 0.003263 | -3.788 | 2462 | 0.0001554 | -0.02152 | -0.003202 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001131 | 0.00003566 | 3.171 | 2463 | 0.001537 | 0.00001299 | 0.0002132 |
fixed | NA | male | 0.174 | 0.04128 | 4.214 | 2463 | 0.00002595 | 0.0581 | 0.2899 |
fixed | NA | sibling_count3 | -0.02677 | 0.06466 | -0.4139 | 2076 | 0.679 | -0.2083 | 0.1547 |
fixed | NA | sibling_count4 | -0.1287 | 0.06985 | -1.842 | 2007 | 0.06558 | -0.3247 | 0.06738 |
fixed | NA | sibling_count5 | -0.1758 | 0.08455 | -2.079 | 1877 | 0.03777 | -0.4131 | 0.06157 |
fixed | NA | sibling_count>5 | -0.2091 | 0.08338 | -2.508 | 1859 | 0.01222 | -0.4432 | 0.02492 |
fixed | NA | birth_order_nonlinear2 | -0.0007985 | 0.0533 | -0.01498 | 2180 | 0.988 | -0.1504 | 0.1488 |
fixed | NA | birth_order_nonlinear3 | 0.09794 | 0.06412 | 1.528 | 2269 | 0.1268 | -0.08203 | 0.2779 |
fixed | NA | birth_order_nonlinear4 | 0.0248 | 0.08029 | 0.3089 | 2301 | 0.7574 | -0.2006 | 0.2502 |
fixed | NA | birth_order_nonlinear5 | -0.07846 | 0.1009 | -0.7773 | 2332 | 0.4371 | -0.3618 | 0.2049 |
fixed | NA | birth_order_nonlinear>5 | 0.1007 | 0.09905 | 1.016 | 2422 | 0.3097 | -0.1774 | 0.3787 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2667 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9694 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -5.398 | 0.9042 | -5.97 | 2448 | 0.000000002716 | -7.937 | -2.86 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.4538 | 0.09623 | 4.715 | 2450 | 0.000002547 | 0.1836 | 0.7239 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.01223 | 0.003276 | -3.734 | 2452 | 0.0001926 | -0.02143 | -0.003037 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0001112 | 0.0000358 | 3.106 | 2452 | 0.001917 | 0.00001071 | 0.0002117 |
fixed | NA | male | 0.1673 | 0.04143 | 4.04 | 2453 | 0.0000552 | 0.05106 | 0.2836 |
fixed | NA | count_birth_order2/2 | 0.01444 | 0.09844 | 0.1467 | 2189 | 0.8834 | -0.2619 | 0.2908 |
fixed | NA | count_birth_order1/3 | -0.06221 | 0.08283 | -0.751 | 2451 | 0.4527 | -0.2947 | 0.1703 |
fixed | NA | count_birth_order2/3 | 0.07763 | 0.09437 | 0.8226 | 2453 | 0.4108 | -0.1873 | 0.3425 |
fixed | NA | count_birth_order3/3 | 0.03025 | 0.1018 | 0.297 | 2450 | 0.7665 | -0.2556 | 0.3161 |
fixed | NA | count_birth_order1/4 | -0.1345 | 0.09873 | -1.362 | 2453 | 0.1734 | -0.4116 | 0.1427 |
fixed | NA | count_birth_order2/4 | -0.1646 | 0.1011 | -1.628 | 2453 | 0.1037 | -0.4485 | 0.1193 |
fixed | NA | count_birth_order3/4 | 0.02741 | 0.1071 | 0.2559 | 2451 | 0.798 | -0.2732 | 0.328 |
fixed | NA | count_birth_order4/4 | -0.08879 | 0.1173 | -0.757 | 2448 | 0.4491 | -0.418 | 0.2405 |
fixed | NA | count_birth_order1/5 | -0.002286 | 0.1351 | -0.01692 | 2453 | 0.9865 | -0.3816 | 0.377 |
fixed | NA | count_birth_order2/5 | -0.1884 | 0.157 | -1.2 | 2449 | 0.2301 | -0.629 | 0.2522 |
fixed | NA | count_birth_order3/5 | -0.1273 | 0.146 | -0.8719 | 2451 | 0.3833 | -0.5373 | 0.2826 |
fixed | NA | count_birth_order4/5 | -0.2074 | 0.1387 | -1.496 | 2448 | 0.1349 | -0.5967 | 0.1819 |
fixed | NA | count_birth_order5/5 | -0.3175 | 0.1436 | -2.211 | 2450 | 0.02713 | -0.7205 | 0.08559 |
fixed | NA | count_birth_order1/>5 | -0.1604 | 0.1323 | -1.212 | 2453 | 0.2256 | -0.5317 | 0.211 |
fixed | NA | count_birth_order2/>5 | -0.3924 | 0.1365 | -2.875 | 2451 | 0.004072 | -0.7756 | -0.009305 |
fixed | NA | count_birth_order3/>5 | -0.06706 | 0.134 | -0.5004 | 2452 | 0.6169 | -0.4432 | 0.3091 |
fixed | NA | count_birth_order4/>5 | -0.1438 | 0.1262 | -1.14 | 2447 | 0.2543 | -0.498 | 0.2103 |
fixed | NA | count_birth_order5/>5 | -0.2396 | 0.1213 | -1.974 | 2444 | 0.04845 | -0.5802 | 0.101 |
fixed | NA | count_birth_order>5/>5 | -0.1037 | 0.09056 | -1.145 | 2291 | 0.2523 | -0.3579 | 0.1505 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.261 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.9711 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 7066 | 7130 | -3522 | 7044 | NA | NA | NA |
12 | 7067 | 7137 | -3522 | 7043 | 0.4305 | 1 | 0.5117 |
16 | 7070 | 7163 | -3519 | 7038 | 4.865 | 4 | 0.3014 |
26 | 7082 | 7233 | -3515 | 7030 | 8.758 | 10 | 0.5552 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = Self_employed)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2665 | 0.095 | -2.805 | 9917 | 0.005038 | -0.5331 | 0.000174 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02362 | 0.008521 | 2.772 | 9866 | 0.005576 | -0.0002959 | 0.04754 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001646 | 0.0002393 | -0.6879 | 9765 | 0.4915 | -0.0008364 | 0.0005071 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000002153 | 0.000002126 | -0.1013 | 9648 | 0.9193 | -0.000006183 | 0.000005753 |
fixed | NA | male | -0.002977 | 0.008766 | -0.3396 | 9989 | 0.7342 | -0.02758 | 0.02163 |
fixed | NA | sibling_count3 | -0.02246 | 0.01828 | -1.229 | 7683 | 0.2192 | -0.07376 | 0.02885 |
fixed | NA | sibling_count4 | -0.01987 | 0.01844 | -1.077 | 7310 | 0.2813 | -0.07162 | 0.03189 |
fixed | NA | sibling_count5 | -0.01023 | 0.01921 | -0.5326 | 6871 | 0.5944 | -0.06417 | 0.0437 |
fixed | NA | sibling_count>5 | 0.01732 | 0.0149 | 1.162 | 7571 | 0.2452 | -0.0245 | 0.05913 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1531 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4098 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2668 | 0.09499 | -2.809 | 9915 | 0.004984 | -0.5335 | -0.0001598 |
fixed | NA | birth_order | 0.002029 | 0.001784 | 1.137 | 9196 | 0.2556 | -0.00298 | 0.007038 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02307 | 0.008535 | 2.703 | 9857 | 0.006891 | -0.0008909 | 0.04703 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001441 | 0.00024 | -0.6006 | 9731 | 0.5481 | -0.0008177 | 0.0005295 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000004013 | 0.000002132 | -0.1882 | 9599 | 0.8507 | -0.000006387 | 0.000005584 |
fixed | NA | male | -0.003007 | 0.008766 | -0.3431 | 9989 | 0.7315 | -0.02761 | 0.0216 |
fixed | NA | sibling_count3 | -0.023 | 0.01828 | -1.258 | 7695 | 0.2084 | -0.07432 | 0.02832 |
fixed | NA | sibling_count4 | -0.0211 | 0.01847 | -1.143 | 7356 | 0.2532 | -0.07295 | 0.03074 |
fixed | NA | sibling_count5 | -0.01241 | 0.01931 | -0.6426 | 6958 | 0.5205 | -0.06661 | 0.04179 |
fixed | NA | sibling_count>5 | 0.01022 | 0.01615 | 0.6328 | 8281 | 0.5269 | -0.03512 | 0.05556 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1529 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4098 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2752 | 0.09511 | -2.893 | 9918 | 0.003821 | -0.5422 | -0.008203 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02319 | 0.008541 | 2.715 | 9858 | 0.006636 | -0.0007847 | 0.04716 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001598 | 0.0002401 | -0.6657 | 9735 | 0.5056 | -0.0008336 | 0.0005141 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000001582 | 0.000002133 | -0.07415 | 9600 | 0.9409 | -0.000006145 | 0.000005829 |
fixed | NA | male | -0.003111 | 0.008765 | -0.3549 | 9984 | 0.7227 | -0.02771 | 0.02149 |
fixed | NA | sibling_count3 | -0.02462 | 0.01855 | -1.327 | 7932 | 0.1844 | -0.07669 | 0.02745 |
fixed | NA | sibling_count4 | -0.02199 | 0.01896 | -1.16 | 7793 | 0.2461 | -0.07521 | 0.03123 |
fixed | NA | sibling_count5 | -0.01296 | 0.01996 | -0.6493 | 7524 | 0.5162 | -0.06899 | 0.04307 |
fixed | NA | sibling_count>5 | 0.01309 | 0.01691 | 0.7741 | 8865 | 0.4389 | -0.03438 | 0.06055 |
fixed | NA | birth_order_nonlinear2 | 0.03823 | 0.01276 | 2.997 | 9348 | 0.002737 | 0.002419 | 0.07405 |
fixed | NA | birth_order_nonlinear3 | 0.01961 | 0.01483 | 1.322 | 9199 | 0.1861 | -0.02202 | 0.06123 |
fixed | NA | birth_order_nonlinear4 | 0.0146 | 0.01665 | 0.877 | 9276 | 0.3805 | -0.03214 | 0.06135 |
fixed | NA | birth_order_nonlinear5 | 0.01968 | 0.01874 | 1.05 | 9304 | 0.2936 | -0.03291 | 0.07227 |
fixed | NA | birth_order_nonlinear>5 | 0.02218 | 0.01558 | 1.423 | 10079 | 0.1546 | -0.02156 | 0.06591 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1529 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4097 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2834 | 0.09546 | -2.969 | 9918 | 0.002995 | -0.5514 | -0.01546 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02291 | 0.008548 | 2.68 | 9849 | 0.007384 | -0.00109 | 0.0469 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001582 | 0.0002402 | -0.6585 | 9723 | 0.5102 | -0.0008324 | 0.0005161 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000111 | 0.000002134 | -0.052 | 9586 | 0.9585 | -0.000006101 | 0.000005879 |
fixed | NA | male | -0.003372 | 0.008769 | -0.3845 | 9975 | 0.7006 | -0.02799 | 0.02124 |
fixed | NA | count_birth_order2/2 | 0.07421 | 0.02534 | 2.928 | 9275 | 0.003418 | 0.003069 | 0.1453 |
fixed | NA | count_birth_order1/3 | -0.02418 | 0.02456 | -0.9844 | 9991 | 0.3249 | -0.09311 | 0.04476 |
fixed | NA | count_birth_order2/3 | 0.03323 | 0.02722 | 1.221 | 10030 | 0.2221 | -0.04317 | 0.1096 |
fixed | NA | count_birth_order3/3 | 0.02459 | 0.02989 | 0.8229 | 10053 | 0.4106 | -0.0593 | 0.1085 |
fixed | NA | count_birth_order1/4 | 0.01501 | 0.0269 | 0.5579 | 10031 | 0.5769 | -0.0605 | 0.09051 |
fixed | NA | count_birth_order2/4 | 0.005201 | 0.02884 | 0.1804 | 10046 | 0.8569 | -0.07575 | 0.08616 |
fixed | NA | count_birth_order3/4 | -0.005191 | 0.03075 | -0.1688 | 10061 | 0.8659 | -0.0915 | 0.08111 |
fixed | NA | count_birth_order4/4 | 0.01914 | 0.03266 | 0.5862 | 10066 | 0.5578 | -0.07253 | 0.1108 |
fixed | NA | count_birth_order1/5 | 0.009117 | 0.03054 | 0.2985 | 10059 | 0.7653 | -0.07661 | 0.09484 |
fixed | NA | count_birth_order2/5 | 0.04643 | 0.03238 | 1.434 | 10065 | 0.1517 | -0.04447 | 0.1373 |
fixed | NA | count_birth_order3/5 | 0.03461 | 0.03409 | 1.015 | 10069 | 0.31 | -0.06108 | 0.1303 |
fixed | NA | count_birth_order4/5 | -0.01429 | 0.03583 | -0.3989 | 10068 | 0.69 | -0.1149 | 0.08627 |
fixed | NA | count_birth_order5/5 | 0.0102 | 0.03582 | 0.2846 | 10071 | 0.7759 | -0.09036 | 0.1107 |
fixed | NA | count_birth_order1/>5 | 0.03492 | 0.02352 | 1.485 | 10069 | 0.1377 | -0.03111 | 0.1009 |
fixed | NA | count_birth_order2/>5 | 0.05428 | 0.02449 | 2.216 | 10071 | 0.02672 | -0.01448 | 0.123 |
fixed | NA | count_birth_order3/>5 | 0.04115 | 0.02413 | 1.705 | 10071 | 0.0882 | -0.02659 | 0.1089 |
fixed | NA | count_birth_order4/>5 | 0.04521 | 0.0237 | 1.907 | 10070 | 0.05649 | -0.02132 | 0.1117 |
fixed | NA | count_birth_order5/>5 | 0.04958 | 0.02396 | 2.069 | 10071 | 0.03857 | -0.01769 | 0.1168 |
fixed | NA | count_birth_order>5/>5 | 0.04898 | 0.01941 | 2.523 | 9318 | 0.01164 | -0.005507 | 0.1035 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.153 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4097 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 11871 | 11950 | -5924 | 11849 | NA | NA | NA |
12 | 11871 | 11958 | -5924 | 11847 | 1.295 | 1 | 0.2552 |
16 | 11872 | 11987 | -5920 | 11840 | 7.919 | 4 | 0.0946 |
26 | 11883 | 12071 | -5916 | 11831 | 8.217 | 10 | 0.6077 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9428 | 0.2612 | 3.609 | 3819 | 0.0003116 | 0.2094 | 1.676 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1058 | 0.02805 | -3.773 | 3817 | 0.0001635 | -0.1846 | -0.02711 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004147 | 0.0009623 | 4.309 | 3815 | 0.00001678 | 0.001446 | 0.006848 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004614 | 0.00001056 | -4.368 | 3814 | 0.00001288 | -0.0000758 | -0.00001649 |
fixed | NA | male | -0.02367 | 0.01315 | -1.8 | 3785 | 0.0719 | -0.06057 | 0.01324 |
fixed | NA | sibling_count3 | 0.01552 | 0.02194 | 0.7075 | 3125 | 0.4793 | -0.04606 | 0.0771 |
fixed | NA | sibling_count4 | -0.02907 | 0.02271 | -1.28 | 2946 | 0.2007 | -0.09282 | 0.03469 |
fixed | NA | sibling_count5 | 0.03856 | 0.02531 | 1.524 | 2677 | 0.1277 | -0.03248 | 0.1096 |
fixed | NA | sibling_count>5 | 0.04773 | 0.02198 | 2.172 | 2660 | 0.02998 | -0.01397 | 0.1094 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1578 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3721 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9413 | 0.2613 | 3.602 | 3819 | 0.0003195 | 0.2078 | 1.675 |
fixed | NA | birth_order | -0.001447 | 0.004107 | -0.3524 | 3766 | 0.7246 | -0.01298 | 0.01008 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1055 | 0.02807 | -3.759 | 3817 | 0.0001733 | -0.1843 | -0.02671 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004138 | 0.0009626 | 4.299 | 3815 | 0.00001761 | 0.001436 | 0.00684 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004611 | 0.00001057 | -4.364 | 3813 | 0.00001308 | -0.00007577 | -0.00001645 |
fixed | NA | male | -0.02362 | 0.01315 | -1.796 | 3783 | 0.07252 | -0.06052 | 0.01329 |
fixed | NA | sibling_count3 | 0.01627 | 0.02204 | 0.7382 | 3124 | 0.4605 | -0.04561 | 0.07815 |
fixed | NA | sibling_count4 | -0.02744 | 0.02318 | -1.184 | 2948 | 0.2365 | -0.09251 | 0.03762 |
fixed | NA | sibling_count5 | 0.0412 | 0.02642 | 1.559 | 2723 | 0.119 | -0.03296 | 0.1154 |
fixed | NA | sibling_count>5 | 0.05295 | 0.02654 | 1.995 | 2828 | 0.04609 | -0.02154 | 0.1274 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.372 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9329 | 0.2617 | 3.565 | 3815 | 0.0003682 | 0.1984 | 1.667 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1051 | 0.02809 | -3.742 | 3812 | 0.0001852 | -0.184 | -0.02627 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004127 | 0.0009634 | 4.283 | 3810 | 0.00001887 | 0.001422 | 0.006831 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004607 | 0.00001058 | -4.355 | 3808 | 0.00001363 | -0.00007576 | -0.00001638 |
fixed | NA | male | -0.02352 | 0.01315 | -1.788 | 3779 | 0.07392 | -0.06044 | 0.01341 |
fixed | NA | sibling_count3 | 0.0156 | 0.02247 | 0.6942 | 3214 | 0.4876 | -0.04747 | 0.07867 |
fixed | NA | sibling_count4 | -0.02767 | 0.02398 | -1.154 | 3114 | 0.2487 | -0.09499 | 0.03965 |
fixed | NA | sibling_count5 | 0.04284 | 0.02763 | 1.55 | 2963 | 0.1212 | -0.03472 | 0.1204 |
fixed | NA | sibling_count>5 | 0.0613 | 0.02722 | 2.252 | 2955 | 0.02438 | -0.0151 | 0.1377 |
fixed | NA | birth_order_nonlinear2 | 0.01025 | 0.01727 | 0.5934 | 3368 | 0.553 | -0.03824 | 0.05874 |
fixed | NA | birth_order_nonlinear3 | 0.001374 | 0.02033 | 0.06759 | 3441 | 0.9461 | -0.0557 | 0.05845 |
fixed | NA | birth_order_nonlinear4 | -0.002639 | 0.02479 | -0.1065 | 3498 | 0.9152 | -0.07221 | 0.06693 |
fixed | NA | birth_order_nonlinear5 | -0.008891 | 0.03048 | -0.2917 | 3505 | 0.7706 | -0.09446 | 0.07668 |
fixed | NA | birth_order_nonlinear>5 | -0.02557 | 0.03043 | -0.8404 | 3817 | 0.4007 | -0.111 | 0.05985 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1581 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3722 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9316 | 0.2628 | 3.545 | 3805 | 0.000397 | 0.194 | 1.669 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1065 | 0.02821 | -3.774 | 3803 | 0.0001631 | -0.1856 | -0.02728 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004174 | 0.0009678 | 4.313 | 3801 | 0.00001652 | 0.001457 | 0.006891 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004658 | 0.00001063 | -4.383 | 3800 | 0.000012 | -0.00007642 | -0.00001675 |
fixed | NA | male | -0.02415 | 0.01318 | -1.832 | 3769 | 0.067 | -0.06115 | 0.01285 |
fixed | NA | count_birth_order2/2 | 0.05231 | 0.0336 | 1.557 | 3475 | 0.1196 | -0.04201 | 0.1466 |
fixed | NA | count_birth_order1/3 | 0.03981 | 0.02861 | 1.392 | 3792 | 0.1641 | -0.04049 | 0.1201 |
fixed | NA | count_birth_order2/3 | 0.03881 | 0.03176 | 1.222 | 3805 | 0.2218 | -0.05034 | 0.128 |
fixed | NA | count_birth_order3/3 | 0.01045 | 0.03434 | 0.3044 | 3807 | 0.7609 | -0.08594 | 0.1068 |
fixed | NA | count_birth_order1/4 | -0.008259 | 0.03285 | -0.2514 | 3802 | 0.8015 | -0.1005 | 0.08395 |
fixed | NA | count_birth_order2/4 | -0.02985 | 0.03453 | -0.8646 | 3807 | 0.3873 | -0.1268 | 0.06706 |
fixed | NA | count_birth_order3/4 | -0.01272 | 0.0362 | -0.3513 | 3804 | 0.7254 | -0.1143 | 0.08889 |
fixed | NA | count_birth_order4/4 | 0.008705 | 0.03839 | 0.2267 | 3801 | 0.8206 | -0.09907 | 0.1165 |
fixed | NA | count_birth_order1/5 | 0.05321 | 0.04307 | 1.235 | 3807 | 0.2168 | -0.06769 | 0.1741 |
fixed | NA | count_birth_order2/5 | 0.07654 | 0.04684 | 1.634 | 3790 | 0.1023 | -0.05495 | 0.208 |
fixed | NA | count_birth_order3/5 | 0.06749 | 0.04389 | 1.538 | 3795 | 0.1242 | -0.05572 | 0.1907 |
fixed | NA | count_birth_order4/5 | 0.05473 | 0.04269 | 1.282 | 3794 | 0.1999 | -0.06511 | 0.1746 |
fixed | NA | count_birth_order5/5 | 0.02978 | 0.04476 | 0.6652 | 3789 | 0.506 | -0.09587 | 0.1554 |
fixed | NA | count_birth_order1/>5 | 0.07785 | 0.04095 | 1.901 | 3804 | 0.05738 | -0.0371 | 0.1928 |
fixed | NA | count_birth_order2/>5 | 0.07465 | 0.04131 | 1.807 | 3792 | 0.07084 | -0.04131 | 0.1906 |
fixed | NA | count_birth_order3/>5 | 0.09799 | 0.04038 | 2.426 | 3787 | 0.01529 | -0.01537 | 0.2113 |
fixed | NA | count_birth_order4/>5 | 0.04506 | 0.03922 | 1.149 | 3779 | 0.2506 | -0.06502 | 0.1551 |
fixed | NA | count_birth_order5/>5 | 0.07709 | 0.03782 | 2.038 | 3785 | 0.0416 | -0.02908 | 0.1832 |
fixed | NA | count_birth_order>5/>5 | 0.04905 | 0.0296 | 1.657 | 3670 | 0.09751 | -0.03402 | 0.1321 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1579 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3725 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3908 | 3977 | -1943 | 3886 | NA | NA | NA |
12 | 3910 | 3985 | -1943 | 3886 | 0.122 | 1 | 0.7269 |
16 | 3917 | 4017 | -1942 | 3885 | 1.352 | 4 | 0.8525 |
26 | 3931 | 4094 | -1940 | 3879 | 5.638 | 10 | 0.8447 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.917 | 0.2603 | 3.523 | 3846 | 0.0004316 | 0.1864 | 1.648 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1019 | 0.02798 | -3.642 | 3843 | 0.0002737 | -0.1804 | -0.02337 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004027 | 0.0009598 | 4.196 | 3841 | 0.00002782 | 0.001333 | 0.006722 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004496 | 0.00001054 | -4.266 | 3840 | 0.00002039 | -0.00007455 | -0.00001538 |
fixed | NA | male | -0.02421 | 0.01311 | -1.847 | 3810 | 0.06483 | -0.06101 | 0.01259 |
fixed | NA | sibling_count3 | -0.006695 | 0.02405 | -0.2784 | 3201 | 0.7807 | -0.0742 | 0.06081 |
fixed | NA | sibling_count4 | -0.03614 | 0.02428 | -1.489 | 3079 | 0.1366 | -0.1043 | 0.032 |
fixed | NA | sibling_count5 | -0.008562 | 0.02563 | -0.3341 | 2892 | 0.7383 | -0.0805 | 0.06337 |
fixed | NA | sibling_count>5 | 0.0278 | 0.02245 | 1.238 | 2968 | 0.2157 | -0.03522 | 0.09082 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1587 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.372 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9174 | 0.2603 | 3.524 | 3845 | 0.0004304 | 0.1866 | 1.648 |
fixed | NA | birth_order | 0.0004435 | 0.003628 | 0.1222 | 3719 | 0.9027 | -0.009742 | 0.01063 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.102 | 0.02799 | -3.644 | 3843 | 0.0002721 | -0.1806 | -0.02342 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00403 | 0.0009601 | 4.197 | 3841 | 0.00002769 | 0.001334 | 0.006725 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004497 | 0.00001054 | -4.266 | 3839 | 0.0000204 | -0.00007456 | -0.00001538 |
fixed | NA | male | -0.02422 | 0.01311 | -1.848 | 3809 | 0.06474 | -0.06103 | 0.01258 |
fixed | NA | sibling_count3 | -0.006931 | 0.02413 | -0.2872 | 3197 | 0.7739 | -0.07466 | 0.0608 |
fixed | NA | sibling_count4 | -0.03661 | 0.02457 | -1.49 | 3071 | 0.1364 | -0.1056 | 0.03237 |
fixed | NA | sibling_count5 | -0.009323 | 0.02638 | -0.3534 | 2901 | 0.7238 | -0.08337 | 0.06472 |
fixed | NA | sibling_count>5 | 0.02623 | 0.02589 | 1.013 | 3022 | 0.311 | -0.04644 | 0.09889 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1587 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3721 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9044 | 0.2607 | 3.47 | 3841 | 0.0005271 | 0.1727 | 1.636 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1011 | 0.02801 | -3.608 | 3839 | 0.0003122 | -0.1797 | -0.02244 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003996 | 0.0009609 | 4.159 | 3836 | 0.00003269 | 0.001299 | 0.006694 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004462 | 0.00001055 | -4.229 | 3835 | 0.00002404 | -0.00007425 | -0.000015 |
fixed | NA | male | -0.02403 | 0.01312 | -1.832 | 3804 | 0.06702 | -0.06085 | 0.01279 |
fixed | NA | sibling_count3 | -0.01015 | 0.02454 | -0.4134 | 3267 | 0.6793 | -0.07903 | 0.05874 |
fixed | NA | sibling_count4 | -0.03844 | 0.02528 | -1.521 | 3196 | 0.1284 | -0.1094 | 0.03252 |
fixed | NA | sibling_count5 | -0.008874 | 0.02749 | -0.3228 | 3097 | 0.7469 | -0.08604 | 0.06829 |
fixed | NA | sibling_count>5 | 0.02904 | 0.02661 | 1.091 | 3148 | 0.2752 | -0.04564 | 0.1037 |
fixed | NA | birth_order_nonlinear2 | 0.01753 | 0.01751 | 1.001 | 3422 | 0.3169 | -0.03163 | 0.06668 |
fixed | NA | birth_order_nonlinear3 | 0.01558 | 0.02045 | 0.7616 | 3503 | 0.4464 | -0.04184 | 0.07299 |
fixed | NA | birth_order_nonlinear4 | -0.00005851 | 0.0242 | -0.002418 | 3563 | 0.9981 | -0.06799 | 0.06787 |
fixed | NA | birth_order_nonlinear5 | -0.002062 | 0.02949 | -0.06994 | 3572 | 0.9442 | -0.08484 | 0.08071 |
fixed | NA | birth_order_nonlinear>5 | 0.002764 | 0.02752 | 0.1004 | 3836 | 0.92 | -0.07449 | 0.08002 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1585 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3722 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.904 | 0.2612 | 3.46 | 3831 | 0.0005452 | 0.1707 | 1.637 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1033 | 0.02807 | -3.68 | 3829 | 0.0002365 | -0.1821 | -0.0245 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004077 | 0.0009634 | 4.233 | 3828 | 0.00002364 | 0.001373 | 0.006782 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004555 | 0.00001058 | -4.305 | 3827 | 0.00001715 | -0.00007526 | -0.00001585 |
fixed | NA | male | -0.02482 | 0.01313 | -1.89 | 3795 | 0.05884 | -0.06169 | 0.01205 |
fixed | NA | count_birth_order2/2 | 0.07947 | 0.03699 | 2.148 | 3581 | 0.03176 | -0.02437 | 0.1833 |
fixed | NA | count_birth_order1/3 | 0.02032 | 0.0316 | 0.643 | 3818 | 0.5202 | -0.06838 | 0.109 |
fixed | NA | count_birth_order2/3 | 0.04303 | 0.03437 | 1.252 | 3830 | 0.2107 | -0.05345 | 0.1395 |
fixed | NA | count_birth_order3/3 | -0.015 | 0.03778 | -0.3971 | 3833 | 0.6913 | -0.121 | 0.09104 |
fixed | NA | count_birth_order1/4 | 0.005795 | 0.03435 | 0.1687 | 3825 | 0.866 | -0.09063 | 0.1022 |
fixed | NA | count_birth_order2/4 | -0.0307 | 0.03584 | -0.8566 | 3832 | 0.3917 | -0.1313 | 0.0699 |
fixed | NA | count_birth_order3/4 | -0.0108 | 0.03917 | -0.2758 | 3830 | 0.7827 | -0.1207 | 0.09914 |
fixed | NA | count_birth_order4/4 | -0.006404 | 0.04181 | -0.1532 | 3827 | 0.8783 | -0.1238 | 0.111 |
fixed | NA | count_birth_order1/5 | 0.01609 | 0.04117 | 0.3908 | 3833 | 0.6959 | -0.09947 | 0.1316 |
fixed | NA | count_birth_order2/5 | 0.01692 | 0.04276 | 0.3957 | 3831 | 0.6924 | -0.1031 | 0.1369 |
fixed | NA | count_birth_order3/5 | 0.01622 | 0.04352 | 0.3728 | 3825 | 0.7093 | -0.1059 | 0.1384 |
fixed | NA | count_birth_order4/5 | 0.01776 | 0.04424 | 0.4013 | 3818 | 0.6882 | -0.1064 | 0.1419 |
fixed | NA | count_birth_order5/5 | 0.02105 | 0.04457 | 0.4723 | 3817 | 0.6367 | -0.104 | 0.1461 |
fixed | NA | count_birth_order1/>5 | 0.03557 | 0.03723 | 0.9554 | 3832 | 0.3394 | -0.06894 | 0.1401 |
fixed | NA | count_birth_order2/>5 | 0.04765 | 0.03933 | 1.211 | 3824 | 0.2258 | -0.06276 | 0.1581 |
fixed | NA | count_birth_order3/>5 | 0.1171 | 0.03789 | 3.092 | 3824 | 0.002004 | 0.01079 | 0.2235 |
fixed | NA | count_birth_order4/>5 | 0.03739 | 0.03695 | 1.012 | 3821 | 0.3117 | -0.06634 | 0.1411 |
fixed | NA | count_birth_order5/>5 | 0.03913 | 0.03908 | 1.001 | 3808 | 0.3167 | -0.07056 | 0.1488 |
fixed | NA | count_birth_order>5/>5 | 0.05174 | 0.02961 | 1.747 | 3707 | 0.08067 | -0.03138 | 0.1349 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3723 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3939 | 4008 | -1958 | 3917 | NA | NA | NA |
12 | 3941 | 4016 | -1958 | 3917 | 0.01549 | 1 | 0.901 |
16 | 3947 | 4047 | -1958 | 3915 | 1.543 | 4 | 0.8189 |
26 | 3955 | 4118 | -1952 | 3903 | 11.8 | 10 | 0.2988 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9712 | 0.2646 | 3.67 | 3751 | 0.0002462 | 0.2283 | 1.714 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.11 | 0.02846 | -3.864 | 3749 | 0.0001135 | -0.1898 | -0.03008 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004334 | 0.0009771 | 4.435 | 3746 | 0.000009468 | 0.001591 | 0.007076 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004871 | 0.00001074 | -4.536 | 3745 | 0.000005926 | -0.00007886 | -0.00001856 |
fixed | NA | male | -0.02276 | 0.0133 | -1.711 | 3715 | 0.08719 | -0.0601 | 0.01458 |
fixed | NA | sibling_count3 | 0.02252 | 0.02157 | 1.044 | 3069 | 0.2966 | -0.03803 | 0.08307 |
fixed | NA | sibling_count4 | -0.02657 | 0.02265 | -1.173 | 2884 | 0.2409 | -0.09016 | 0.03702 |
fixed | NA | sibling_count5 | 0.03133 | 0.02594 | 1.208 | 2547 | 0.2273 | -0.04149 | 0.1042 |
fixed | NA | sibling_count>5 | 0.04105 | 0.02217 | 1.852 | 2545 | 0.06416 | -0.02117 | 0.1033 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.16 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3726 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9698 | 0.2647 | 3.663 | 3751 | 0.0002524 | 0.2267 | 1.713 |
fixed | NA | birth_order | -0.001067 | 0.004238 | -0.2517 | 3715 | 0.8013 | -0.01296 | 0.01083 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1097 | 0.02848 | -3.851 | 3749 | 0.0001198 | -0.1896 | -0.02972 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004326 | 0.0009776 | 4.425 | 3747 | 0.000009919 | 0.001582 | 0.00707 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.00001074 | -4.531 | 3745 | 0.000006041 | -0.00007883 | -0.00001852 |
fixed | NA | male | -0.02275 | 0.0133 | -1.71 | 3713 | 0.0874 | -0.06009 | 0.0146 |
fixed | NA | sibling_count3 | 0.02308 | 0.02169 | 1.064 | 3067 | 0.2874 | -0.03781 | 0.08397 |
fixed | NA | sibling_count4 | -0.02539 | 0.02314 | -1.097 | 2891 | 0.2725 | -0.09034 | 0.03955 |
fixed | NA | sibling_count5 | 0.03322 | 0.02704 | 1.229 | 2589 | 0.2193 | -0.04268 | 0.1091 |
fixed | NA | sibling_count>5 | 0.0449 | 0.02695 | 1.666 | 2763 | 0.09583 | -0.03075 | 0.1205 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1602 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3725 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9616 | 0.2651 | 3.628 | 3747 | 0.0002899 | 0.2175 | 1.706 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1091 | 0.0285 | -3.828 | 3744 | 0.0001314 | -0.1891 | -0.02909 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00431 | 0.0009784 | 4.405 | 3742 | 0.00001088 | 0.001563 | 0.007056 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004859 | 0.00001075 | -4.519 | 3740 | 0.000006417 | -0.00007877 | -0.0000184 |
fixed | NA | male | -0.02281 | 0.01331 | -1.713 | 3710 | 0.08675 | -0.06018 | 0.01456 |
fixed | NA | sibling_count3 | 0.02313 | 0.02213 | 1.045 | 3157 | 0.296 | -0.039 | 0.08526 |
fixed | NA | sibling_count4 | -0.02585 | 0.02394 | -1.08 | 3054 | 0.2803 | -0.09306 | 0.04136 |
fixed | NA | sibling_count5 | 0.03196 | 0.02818 | 1.134 | 2816 | 0.2569 | -0.04715 | 0.1111 |
fixed | NA | sibling_count>5 | 0.05248 | 0.02768 | 1.896 | 2897 | 0.05807 | -0.02522 | 0.1302 |
fixed | NA | birth_order_nonlinear2 | 0.004606 | 0.01724 | 0.2672 | 3285 | 0.7893 | -0.04378 | 0.05299 |
fixed | NA | birth_order_nonlinear3 | -0.001029 | 0.02041 | -0.0504 | 3362 | 0.9598 | -0.05831 | 0.05626 |
fixed | NA | birth_order_nonlinear4 | 0.001722 | 0.02559 | 0.06727 | 3422 | 0.9464 | -0.07012 | 0.07357 |
fixed | NA | birth_order_nonlinear5 | 0.003465 | 0.03152 | 0.1099 | 3399 | 0.9125 | -0.08503 | 0.09196 |
fixed | NA | birth_order_nonlinear>5 | -0.02943 | 0.03147 | -0.9352 | 3747 | 0.3498 | -0.1178 | 0.05891 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1602 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3727 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9503 | 0.266 | 3.573 | 3737 | 0.000358 | 0.2036 | 1.697 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1092 | 0.0286 | -3.819 | 3735 | 0.0001361 | -0.1895 | -0.02895 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004316 | 0.0009823 | 4.394 | 3733 | 0.00001143 | 0.001559 | 0.007073 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.0000108 | -4.507 | 3732 | 0.000006766 | -0.00007898 | -0.00001836 |
fixed | NA | male | -0.0234 | 0.01334 | -1.754 | 3699 | 0.07946 | -0.06083 | 0.01404 |
fixed | NA | count_birth_order2/2 | 0.0426 | 0.03271 | 1.302 | 3378 | 0.193 | -0.04923 | 0.1344 |
fixed | NA | count_birth_order1/3 | 0.04535 | 0.0282 | 1.608 | 3724 | 0.1078 | -0.0338 | 0.1245 |
fixed | NA | count_birth_order2/3 | 0.04406 | 0.03134 | 1.406 | 3738 | 0.1598 | -0.0439 | 0.132 |
fixed | NA | count_birth_order3/3 | 0.01164 | 0.03353 | 0.3472 | 3738 | 0.7285 | -0.08249 | 0.1058 |
fixed | NA | count_birth_order1/4 | -0.008358 | 0.03305 | -0.2528 | 3736 | 0.8004 | -0.1011 | 0.08443 |
fixed | NA | count_birth_order2/4 | -0.04096 | 0.03452 | -1.187 | 3739 | 0.2355 | -0.1379 | 0.05594 |
fixed | NA | count_birth_order3/4 | -0.01007 | 0.03618 | -0.2784 | 3735 | 0.7807 | -0.1116 | 0.09147 |
fixed | NA | count_birth_order4/4 | 0.02124 | 0.03901 | 0.5443 | 3731 | 0.5862 | -0.08827 | 0.1307 |
fixed | NA | count_birth_order1/5 | 0.0574 | 0.04322 | 1.328 | 3739 | 0.1842 | -0.06392 | 0.1787 |
fixed | NA | count_birth_order2/5 | 0.07243 | 0.04845 | 1.495 | 3715 | 0.1351 | -0.06358 | 0.2084 |
fixed | NA | count_birth_order3/5 | 0.0487 | 0.04642 | 1.049 | 3719 | 0.2941 | -0.08159 | 0.179 |
fixed | NA | count_birth_order4/5 | 0.03821 | 0.04477 | 0.8534 | 3722 | 0.3935 | -0.08747 | 0.1639 |
fixed | NA | count_birth_order5/5 | 0.0122 | 0.04712 | 0.2589 | 3717 | 0.7957 | -0.1201 | 0.1445 |
fixed | NA | count_birth_order1/>5 | 0.05652 | 0.0421 | 1.342 | 3735 | 0.1795 | -0.06166 | 0.1747 |
fixed | NA | count_birth_order2/>5 | 0.05222 | 0.04261 | 1.225 | 3719 | 0.2205 | -0.06739 | 0.1718 |
fixed | NA | count_birth_order3/>5 | 0.09224 | 0.04079 | 2.261 | 3719 | 0.02382 | -0.02227 | 0.2067 |
fixed | NA | count_birth_order4/>5 | 0.03775 | 0.04057 | 0.9304 | 3703 | 0.3522 | -0.07614 | 0.1516 |
fixed | NA | count_birth_order5/>5 | 0.0893 | 0.0384 | 2.326 | 3713 | 0.02009 | -0.01849 | 0.1971 |
fixed | NA | count_birth_order>5/>5 | 0.0354 | 0.0301 | 1.176 | 3588 | 0.2396 | -0.04908 | 0.1199 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1598 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3729 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3861 | 3930 | -1919 | 3839 | NA | NA | NA |
12 | 3863 | 3938 | -1919 | 3839 | 0.06169 | 1 | 0.8038 |
16 | 3870 | 3969 | -1919 | 3838 | 1.332 | 4 | 0.856 |
26 | 3882 | 4044 | -1915 | 3830 | 8.08 | 10 | 0.6211 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Category_Casual worker in agriculture`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.06852 | 0.03525 | 1.944 | 9844 | 0.05195 | -0.03043 | 0.1675 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.004585 | 0.003161 | -1.45 | 9771 | 0.147 | -0.01346 | 0.004289 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001275 | 0.00008876 | 1.437 | 9635 | 0.1508 | -0.0001216 | 0.0003767 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000009703 | 0.0000007884 | -1.231 | 9480 | 0.2185 | -0.000003184 | 0.000001243 |
fixed | NA | male | 0.0003999 | 0.003258 | 0.1228 | 9985 | 0.9023 | -0.008744 | 0.009544 |
fixed | NA | sibling_count3 | -0.00296 | 0.006763 | -0.4378 | 7181 | 0.6616 | -0.02194 | 0.01602 |
fixed | NA | sibling_count4 | 0.005901 | 0.00682 | 0.8653 | 6742 | 0.3869 | -0.01324 | 0.02504 |
fixed | NA | sibling_count5 | -0.002795 | 0.007104 | -0.3935 | 6243 | 0.694 | -0.02274 | 0.01714 |
fixed | NA | sibling_count>5 | 0.008566 | 0.005512 | 1.554 | 7041 | 0.1202 | -0.006905 | 0.02404 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05392 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1531 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.06862 | 0.03525 | 1.947 | 9843 | 0.05159 | -0.03032 | 0.1676 |
fixed | NA | birth_order | -0.0009169 | 0.0006614 | -1.386 | 8785 | 0.1657 | -0.002773 | 0.0009396 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.004333 | 0.003167 | -1.368 | 9760 | 0.1712 | -0.01322 | 0.004555 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001183 | 0.00008901 | 1.329 | 9591 | 0.1837 | -0.0001315 | 0.0003682 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008869 | 0.0000007907 | -1.122 | 9419 | 0.262 | -0.000003107 | 0.000001333 |
fixed | NA | male | 0.0004145 | 0.003257 | 0.1273 | 9983 | 0.8987 | -0.008729 | 0.009558 |
fixed | NA | sibling_count3 | -0.00271 | 0.006766 | -0.4005 | 7190 | 0.6888 | -0.0217 | 0.01628 |
fixed | NA | sibling_count4 | 0.006467 | 0.006833 | 0.9464 | 6790 | 0.344 | -0.01271 | 0.02565 |
fixed | NA | sibling_count5 | -0.001804 | 0.007141 | -0.2526 | 6335 | 0.8006 | -0.02185 | 0.01824 |
fixed | NA | sibling_count>5 | 0.01179 | 0.005981 | 1.971 | 7847 | 0.04878 | -0.005001 | 0.02858 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05405 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.153 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.0684 | 0.03531 | 1.937 | 9847 | 0.05273 | -0.0307 | 0.1675 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.004322 | 0.00317 | -1.364 | 9763 | 0.1727 | -0.01322 | 0.004576 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001208 | 0.00008907 | 1.357 | 9596 | 0.1749 | -0.0001292 | 0.0003709 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000009306 | 0.0000007912 | -1.176 | 9420 | 0.2396 | -0.000003152 | 0.00000129 |
fixed | NA | male | 0.0004062 | 0.003258 | 0.1247 | 9979 | 0.9008 | -0.008739 | 0.009552 |
fixed | NA | sibling_count3 | -0.002613 | 0.006868 | -0.3805 | 7465 | 0.7036 | -0.02189 | 0.01667 |
fixed | NA | sibling_count4 | 0.007246 | 0.007019 | 1.032 | 7292 | 0.302 | -0.01246 | 0.02695 |
fixed | NA | sibling_count5 | -0.001002 | 0.007388 | -0.1356 | 6974 | 0.8921 | -0.02174 | 0.01974 |
fixed | NA | sibling_count>5 | 0.01129 | 0.006267 | 1.801 | 8560 | 0.07178 | -0.006306 | 0.02888 |
fixed | NA | birth_order_nonlinear2 | -0.00616 | 0.004749 | -1.297 | 9156 | 0.1946 | -0.01949 | 0.007169 |
fixed | NA | birth_order_nonlinear3 | -0.003442 | 0.00552 | -0.6236 | 8982 | 0.5329 | -0.01894 | 0.01205 |
fixed | NA | birth_order_nonlinear4 | -0.008114 | 0.006198 | -1.309 | 9085 | 0.1905 | -0.02551 | 0.009284 |
fixed | NA | birth_order_nonlinear5 | -0.006216 | 0.006973 | -0.8915 | 9127 | 0.3727 | -0.02579 | 0.01336 |
fixed | NA | birth_order_nonlinear>5 | -0.006247 | 0.005788 | -1.079 | 10081 | 0.2805 | -0.02249 | 0.01 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05398 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1531 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.07183 | 0.03542 | 2.028 | 9850 | 0.0426 | -0.0276 | 0.1713 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.004317 | 0.003172 | -1.361 | 9752 | 0.1735 | -0.01322 | 0.004586 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001217 | 0.0000891 | 1.366 | 9583 | 0.1721 | -0.0001284 | 0.0003718 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000009483 | 0.0000007913 | -1.198 | 9403 | 0.2308 | -0.00000317 | 0.000001273 |
fixed | NA | male | 0.0003518 | 0.003259 | 0.1079 | 9970 | 0.914 | -0.008797 | 0.0095 |
fixed | NA | count_birth_order2/2 | -0.01611 | 0.009432 | -1.708 | 9035 | 0.08768 | -0.04258 | 0.01037 |
fixed | NA | count_birth_order1/3 | -0.007027 | 0.009116 | -0.7708 | 9982 | 0.4408 | -0.03262 | 0.01856 |
fixed | NA | count_birth_order2/3 | -0.006682 | 0.0101 | -0.6613 | 10024 | 0.5084 | -0.03505 | 0.02168 |
fixed | NA | count_birth_order3/3 | -0.01617 | 0.0111 | -1.457 | 10049 | 0.1452 | -0.04732 | 0.01498 |
fixed | NA | count_birth_order1/4 | -0.007734 | 0.009987 | -0.7744 | 10027 | 0.4387 | -0.03577 | 0.0203 |
fixed | NA | count_birth_order2/4 | -0.003666 | 0.01071 | -0.3423 | 10042 | 0.7321 | -0.03372 | 0.02639 |
fixed | NA | count_birth_order3/4 | 0.01068 | 0.01142 | 0.935 | 10059 | 0.3498 | -0.02137 | 0.04272 |
fixed | NA | count_birth_order4/4 | 0.00423 | 0.01213 | 0.3488 | 10064 | 0.7273 | -0.02981 | 0.03827 |
fixed | NA | count_birth_order1/5 | 0.002099 | 0.01134 | 0.1851 | 10058 | 0.8531 | -0.02973 | 0.03393 |
fixed | NA | count_birth_order2/5 | -0.01472 | 0.01203 | -1.224 | 10064 | 0.2208 | -0.04848 | 0.01903 |
fixed | NA | count_birth_order3/5 | -0.02292 | 0.01266 | -1.81 | 10069 | 0.07029 | -0.05845 | 0.01262 |
fixed | NA | count_birth_order4/5 | 0.003402 | 0.01331 | 0.2556 | 10069 | 0.7982 | -0.03395 | 0.04076 |
fixed | NA | count_birth_order5/5 | -0.01578 | 0.0133 | -1.186 | 10071 | 0.2356 | -0.05313 | 0.02156 |
fixed | NA | count_birth_order1/>5 | 0.007944 | 0.008735 | 0.9094 | 10069 | 0.3632 | -0.01658 | 0.03246 |
fixed | NA | count_birth_order2/>5 | 0.004563 | 0.009098 | 0.5016 | 10071 | 0.616 | -0.02097 | 0.0301 |
fixed | NA | count_birth_order3/>5 | 0.007596 | 0.008963 | 0.8475 | 10071 | 0.3967 | -0.01756 | 0.03275 |
fixed | NA | count_birth_order4/>5 | -0.008504 | 0.008802 | -0.9661 | 10070 | 0.334 | -0.03321 | 0.0162 |
fixed | NA | count_birth_order5/>5 | 0.002768 | 0.008901 | 0.311 | 10071 | 0.7558 | -0.02222 | 0.02775 |
fixed | NA | count_birth_order>5/>5 | 0.001264 | 0.007196 | 0.1757 | 9110 | 0.8605 | -0.01894 | 0.02146 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05386 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1531 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -8128 | -8049 | 4075 | -8150 | NA | NA | NA |
12 | -8128 | -8041 | 4076 | -8152 | 1.92 | 1 | 0.1659 |
16 | -8121 | -8005 | 4076 | -8153 | 0.7708 | 4 | 0.9423 |
26 | -8114 | -7926 | 4083 | -8166 | 13.04 | 10 | 0.2216 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01952 | 0.07867 | 0.2481 | 3803 | 0.804 | -0.2013 | 0.2404 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001255 | 0.008445 | 0.1486 | 3791 | 0.8819 | -0.02245 | 0.02496 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001097 | 0.0002896 | -0.3787 | 3781 | 0.7049 | -0.0009227 | 0.0007033 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001805 | 0.000003179 | 0.5676 | 3774 | 0.5703 | -0.00000712 | 0.00001073 |
fixed | NA | male | 0.003915 | 0.003952 | 0.9909 | 3702 | 0.3218 | -0.007177 | 0.01501 |
fixed | NA | sibling_count3 | -0.005883 | 0.006687 | -0.8798 | 2731 | 0.3791 | -0.02465 | 0.01289 |
fixed | NA | sibling_count4 | 0.0002679 | 0.006935 | 0.03863 | 2527 | 0.9692 | -0.0192 | 0.01974 |
fixed | NA | sibling_count5 | -0.007085 | 0.007746 | -0.9147 | 2239 | 0.3605 | -0.02883 | 0.01466 |
fixed | NA | sibling_count>5 | 0.01689 | 0.006728 | 2.51 | 2229 | 0.01213 | -0.001997 | 0.03578 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05521 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1091 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.02063 | 0.07869 | 0.2622 | 3804 | 0.7932 | -0.2003 | 0.2415 |
fixed | NA | birth_order | 0.0009961 | 0.001241 | 0.803 | 3794 | 0.422 | -0.002486 | 0.004478 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001006 | 0.008451 | 0.119 | 3795 | 0.9053 | -0.02272 | 0.02473 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001032 | 0.0002898 | -0.3563 | 3784 | 0.7216 | -0.0009166 | 0.0007101 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001779 | 0.00000318 | 0.5595 | 3775 | 0.5759 | -0.000007146 | 0.0000107 |
fixed | NA | male | 0.003886 | 0.003952 | 0.9833 | 3702 | 0.3255 | -0.007208 | 0.01498 |
fixed | NA | sibling_count3 | -0.006403 | 0.006718 | -0.953 | 2736 | 0.3407 | -0.02526 | 0.01246 |
fixed | NA | sibling_count4 | -0.0008584 | 0.007075 | -0.1213 | 2539 | 0.9034 | -0.02072 | 0.019 |
fixed | NA | sibling_count5 | -0.008934 | 0.00808 | -1.106 | 2304 | 0.269 | -0.03162 | 0.01375 |
fixed | NA | sibling_count>5 | 0.01326 | 0.008107 | 1.635 | 2458 | 0.1022 | -0.009501 | 0.03601 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05515 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1091 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.02295 | 0.07878 | 0.2913 | 3800 | 0.7709 | -0.1982 | 0.2441 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0008336 | 0.008454 | 0.0986 | 3788 | 0.9215 | -0.0229 | 0.02456 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0000993 | 0.0002899 | -0.3425 | 3777 | 0.732 | -0.0009131 | 0.0007145 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001774 | 0.000003182 | 0.5574 | 3768 | 0.5773 | -0.000007159 | 0.00001071 |
fixed | NA | male | 0.003896 | 0.003953 | 0.9856 | 3697 | 0.3244 | -0.0072 | 0.01499 |
fixed | NA | sibling_count3 | -0.005982 | 0.006841 | -0.8744 | 2856 | 0.382 | -0.02519 | 0.01322 |
fixed | NA | sibling_count4 | -0.0002267 | 0.007308 | -0.03102 | 2746 | 0.9753 | -0.02074 | 0.02029 |
fixed | NA | sibling_count5 | -0.00734 | 0.008432 | -0.8706 | 2585 | 0.3841 | -0.03101 | 0.01633 |
fixed | NA | sibling_count>5 | 0.01131 | 0.008306 | 1.361 | 2609 | 0.1736 | -0.01201 | 0.03462 |
fixed | NA | birth_order_nonlinear2 | 0.002468 | 0.005159 | 0.4784 | 3041 | 0.6324 | -0.01201 | 0.01695 |
fixed | NA | birth_order_nonlinear3 | 0.0001147 | 0.006077 | 0.01887 | 3134 | 0.9849 | -0.01694 | 0.01717 |
fixed | NA | birth_order_nonlinear4 | 0.001705 | 0.007413 | 0.23 | 3210 | 0.8181 | -0.0191 | 0.02251 |
fixed | NA | birth_order_nonlinear5 | -0.0005972 | 0.009118 | -0.06549 | 3207 | 0.9478 | -0.02619 | 0.025 |
fixed | NA | birth_order_nonlinear>5 | 0.0157 | 0.009163 | 1.713 | 3794 | 0.0868 | -0.01002 | 0.04141 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05527 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1091 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.02181 | 0.07903 | 0.276 | 3792 | 0.7826 | -0.2 | 0.2436 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001327 | 0.008482 | 0.1565 | 3782 | 0.8756 | -0.02248 | 0.02514 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001173 | 0.0002909 | -0.4032 | 3773 | 0.6868 | -0.000934 | 0.0006994 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000199 | 0.000003194 | 0.6231 | 3766 | 0.5333 | -0.000006976 | 0.00001096 |
fixed | NA | male | 0.003913 | 0.003957 | 0.989 | 3692 | 0.3227 | -0.007193 | 0.01502 |
fixed | NA | count_birth_order2/2 | -0.007885 | 0.01004 | -0.785 | 3256 | 0.4325 | -0.03608 | 0.02031 |
fixed | NA | count_birth_order1/3 | -0.01161 | 0.008624 | -1.346 | 3766 | 0.1784 | -0.03582 | 0.0126 |
fixed | NA | count_birth_order2/3 | -0.009642 | 0.009564 | -1.008 | 3802 | 0.3134 | -0.03649 | 0.0172 |
fixed | NA | count_birth_order3/3 | -0.001103 | 0.01033 | -0.1067 | 3807 | 0.915 | -0.03011 | 0.02791 |
fixed | NA | count_birth_order1/4 | 0.001448 | 0.009895 | 0.1463 | 3796 | 0.8837 | -0.02633 | 0.02922 |
fixed | NA | count_birth_order2/4 | -0.001238 | 0.01039 | -0.1191 | 3807 | 0.9052 | -0.03041 | 0.02793 |
fixed | NA | count_birth_order3/4 | -0.0139 | 0.01089 | -1.277 | 3798 | 0.2019 | -0.04446 | 0.01666 |
fixed | NA | count_birth_order4/4 | 0.002229 | 0.01154 | 0.1931 | 3792 | 0.8469 | -0.03018 | 0.03464 |
fixed | NA | count_birth_order1/5 | -0.009352 | 0.01296 | -0.7215 | 3806 | 0.4706 | -0.04573 | 0.02703 |
fixed | NA | count_birth_order2/5 | -0.01508 | 0.01408 | -1.071 | 3760 | 0.2842 | -0.05459 | 0.02443 |
fixed | NA | count_birth_order3/5 | -0.01413 | 0.01319 | -1.071 | 3774 | 0.2844 | -0.05115 | 0.0229 |
fixed | NA | count_birth_order4/5 | 0.002559 | 0.01283 | 0.1994 | 3773 | 0.842 | -0.03346 | 0.03858 |
fixed | NA | count_birth_order5/5 | -0.01591 | 0.01345 | -1.183 | 3763 | 0.2371 | -0.05366 | 0.02185 |
fixed | NA | count_birth_order1/>5 | -0.00645 | 0.01232 | -0.5237 | 3793 | 0.6005 | -0.04102 | 0.02812 |
fixed | NA | count_birth_order2/>5 | 0.03205 | 0.01241 | 2.582 | 3757 | 0.00986 | -0.002793 | 0.06689 |
fixed | NA | count_birth_order3/>5 | 0.01239 | 0.01213 | 1.022 | 3748 | 0.3071 | -0.02166 | 0.04645 |
fixed | NA | count_birth_order4/>5 | -0.003848 | 0.01178 | -0.3267 | 3732 | 0.7439 | -0.03691 | 0.02921 |
fixed | NA | count_birth_order5/>5 | 0.01032 | 0.01136 | 0.9085 | 3749 | 0.3637 | -0.02157 | 0.04222 |
fixed | NA | count_birth_order>5/>5 | 0.02363 | 0.008944 | 2.642 | 3613 | 0.008276 | -0.001476 | 0.04874 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05466 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1093 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -5280 | -5211 | 2651 | -5302 | NA | NA | NA |
12 | -5279 | -5203 | 2651 | -5303 | 0.6479 | 1 | 0.4209 |
16 | -5274 | -5174 | 2653 | -5306 | 3.207 | 4 | 0.5238 |
26 | -5268 | -5106 | 2660 | -5320 | 14.78 | 10 | 0.1402 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01131 | 0.0782 | 0.1446 | 3830 | 0.885 | -0.2082 | 0.2308 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002056 | 0.008402 | 0.2447 | 3819 | 0.8067 | -0.02153 | 0.02564 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001338 | 0.0002882 | -0.4642 | 3809 | 0.6425 | -0.0009428 | 0.0006753 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002068 | 0.000003165 | 0.6536 | 3802 | 0.5134 | -0.000006815 | 0.00001095 |
fixed | NA | male | 0.003961 | 0.003931 | 1.007 | 3729 | 0.3138 | -0.007075 | 0.015 |
fixed | NA | sibling_count3 | -0.003733 | 0.007306 | -0.5109 | 2825 | 0.6094 | -0.02424 | 0.01677 |
fixed | NA | sibling_count4 | -0.002881 | 0.007382 | -0.3903 | 2681 | 0.6964 | -0.0236 | 0.01784 |
fixed | NA | sibling_count5 | -0.005224 | 0.007806 | -0.6693 | 2471 | 0.5034 | -0.02714 | 0.01669 |
fixed | NA | sibling_count>5 | 0.00942 | 0.006833 | 1.379 | 2566 | 0.1682 | -0.009761 | 0.0286 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05499 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1089 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01302 | 0.07819 | 0.1665 | 3831 | 0.8678 | -0.2065 | 0.2325 |
fixed | NA | birth_order | 0.001766 | 0.001094 | 1.613 | 3737 | 0.1068 | -0.001307 | 0.004838 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001647 | 0.008404 | 0.1959 | 3822 | 0.8447 | -0.02194 | 0.02524 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001235 | 0.0002882 | -0.4285 | 3812 | 0.6683 | -0.0009326 | 0.0006856 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002037 | 0.000003164 | 0.6439 | 3803 | 0.5197 | -0.000006845 | 0.00001092 |
fixed | NA | male | 0.003919 | 0.003931 | 0.997 | 3730 | 0.3188 | -0.007115 | 0.01495 |
fixed | NA | sibling_count3 | -0.004682 | 0.007326 | -0.6391 | 2826 | 0.5228 | -0.02525 | 0.01588 |
fixed | NA | sibling_count4 | -0.004751 | 0.007469 | -0.6361 | 2677 | 0.5248 | -0.02572 | 0.01622 |
fixed | NA | sibling_count5 | -0.00828 | 0.008028 | -1.031 | 2492 | 0.3025 | -0.03082 | 0.01426 |
fixed | NA | sibling_count>5 | 0.00311 | 0.00787 | 0.3951 | 2663 | 0.6928 | -0.01898 | 0.0252 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0548 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.109 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01294 | 0.07828 | 0.1654 | 3828 | 0.8687 | -0.2068 | 0.2327 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.001859 | 0.008409 | 0.2211 | 3817 | 0.825 | -0.02174 | 0.02546 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001321 | 0.0002884 | -0.4581 | 3807 | 0.6469 | -0.0009418 | 0.0006775 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000215 | 0.000003167 | 0.6788 | 3799 | 0.4973 | -0.00000674 | 0.00001104 |
fixed | NA | male | 0.003953 | 0.003932 | 1.005 | 3726 | 0.3148 | -0.007085 | 0.01499 |
fixed | NA | sibling_count3 | -0.003594 | 0.007444 | -0.4828 | 2922 | 0.6293 | -0.02449 | 0.0173 |
fixed | NA | sibling_count4 | -0.002937 | 0.007673 | -0.3828 | 2839 | 0.7019 | -0.02447 | 0.0186 |
fixed | NA | sibling_count5 | -0.006432 | 0.008351 | -0.7703 | 2731 | 0.4412 | -0.02987 | 0.01701 |
fixed | NA | sibling_count>5 | 0.00298 | 0.008078 | 0.3689 | 2818 | 0.7122 | -0.0197 | 0.02565 |
fixed | NA | birth_order_nonlinear2 | 0.002136 | 0.005222 | 0.409 | 3118 | 0.6826 | -0.01252 | 0.01679 |
fixed | NA | birth_order_nonlinear3 | -0.001164 | 0.006104 | -0.1907 | 3223 | 0.8488 | -0.0183 | 0.01597 |
fixed | NA | birth_order_nonlinear4 | 0.0004516 | 0.007227 | 0.06249 | 3307 | 0.9502 | -0.01983 | 0.02074 |
fixed | NA | birth_order_nonlinear5 | 0.006838 | 0.008807 | 0.7765 | 3312 | 0.4375 | -0.01788 | 0.03156 |
fixed | NA | birth_order_nonlinear>5 | 0.01633 | 0.008275 | 1.974 | 3843 | 0.0485 | -0.006897 | 0.03956 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05469 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1091 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01009 | 0.07847 | 0.1286 | 3820 | 0.8977 | -0.2102 | 0.2304 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002548 | 0.008429 | 0.3022 | 3811 | 0.7625 | -0.02111 | 0.02621 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001574 | 0.0002892 | -0.5441 | 3803 | 0.5864 | -0.0009693 | 0.0006545 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002441 | 0.000003177 | 0.7684 | 3797 | 0.4423 | -0.000006476 | 0.00001136 |
fixed | NA | male | 0.003936 | 0.003938 | 0.9995 | 3720 | 0.3176 | -0.007119 | 0.01499 |
fixed | NA | count_birth_order2/2 | -0.007212 | 0.01106 | -0.6522 | 3418 | 0.5143 | -0.03825 | 0.02383 |
fixed | NA | count_birth_order1/3 | -0.008172 | 0.009511 | -0.8592 | 3794 | 0.3903 | -0.03487 | 0.01853 |
fixed | NA | count_birth_order2/3 | -0.009063 | 0.01034 | -0.8768 | 3825 | 0.3807 | -0.03808 | 0.01995 |
fixed | NA | count_birth_order3/3 | 0.001455 | 0.01135 | 0.1282 | 3833 | 0.898 | -0.03042 | 0.03333 |
fixed | NA | count_birth_order1/4 | 0.0004717 | 0.01034 | 0.04564 | 3814 | 0.9636 | -0.02854 | 0.02948 |
fixed | NA | count_birth_order2/4 | -0.007483 | 0.01077 | -0.6945 | 3832 | 0.4874 | -0.03773 | 0.02276 |
fixed | NA | count_birth_order3/4 | -0.01528 | 0.01176 | -1.298 | 3826 | 0.1942 | -0.0483 | 0.01775 |
fixed | NA | count_birth_order4/4 | -0.001979 | 0.01256 | -0.1576 | 3818 | 0.8748 | -0.03722 | 0.03326 |
fixed | NA | count_birth_order1/5 | -0.01023 | 0.01238 | -0.8266 | 3833 | 0.4085 | -0.04497 | 0.02451 |
fixed | NA | count_birth_order2/5 | -0.007519 | 0.01284 | -0.5854 | 3826 | 0.5583 | -0.04357 | 0.02853 |
fixed | NA | count_birth_order3/5 | -0.0147 | 0.01307 | -1.125 | 3812 | 0.2606 | -0.05138 | 0.02198 |
fixed | NA | count_birth_order4/5 | 0.00125 | 0.01328 | 0.09417 | 3794 | 0.925 | -0.03602 | 0.03852 |
fixed | NA | count_birth_order5/5 | -0.007193 | 0.01338 | -0.5377 | 3795 | 0.5908 | -0.04474 | 0.03035 |
fixed | NA | count_birth_order1/>5 | -0.0104 | 0.01119 | -0.9288 | 3833 | 0.3531 | -0.04181 | 0.02102 |
fixed | NA | count_birth_order2/>5 | 0.02034 | 0.01181 | 1.723 | 3804 | 0.08504 | -0.01281 | 0.05349 |
fixed | NA | count_birth_order3/>5 | -0.0001227 | 0.01137 | -0.01078 | 3808 | 0.9914 | -0.03205 | 0.03181 |
fixed | NA | count_birth_order4/>5 | -0.007947 | 0.01109 | -0.7164 | 3803 | 0.4738 | -0.03908 | 0.02319 |
fixed | NA | count_birth_order5/>5 | 0.009955 | 0.01172 | 0.8491 | 3772 | 0.3959 | -0.02295 | 0.04286 |
fixed | NA | count_birth_order>5/>5 | 0.01644 | 0.008933 | 1.84 | 3643 | 0.06586 | -0.008639 | 0.04151 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05419 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1092 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -5331 | -5262 | 2676 | -5353 | NA | NA | NA |
12 | -5332 | -5256 | 2678 | -5356 | 2.611 | 1 | 0.1061 |
16 | -5326 | -5226 | 2679 | -5358 | 2.522 | 4 | 0.6408 |
26 | -5318 | -5155 | 2685 | -5370 | 11.59 | 10 | 0.3135 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.001325 | 0.07952 | -0.01666 | 3737 | 0.9867 | -0.2246 | 0.2219 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.003218 | 0.008549 | 0.3765 | 3726 | 0.7066 | -0.02078 | 0.02722 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001742 | 0.0002935 | -0.5934 | 3716 | 0.5529 | -0.0009979 | 0.0006496 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000248 | 0.000003225 | 0.7689 | 3709 | 0.442 | -0.000006574 | 0.00001153 |
fixed | NA | male | 0.003577 | 0.003991 | 0.8963 | 3640 | 0.3702 | -0.007625 | 0.01478 |
fixed | NA | sibling_count3 | -0.003884 | 0.006553 | -0.5927 | 2720 | 0.5534 | -0.02228 | 0.01451 |
fixed | NA | sibling_count4 | 0.002849 | 0.006893 | 0.4133 | 2508 | 0.6794 | -0.0165 | 0.0222 |
fixed | NA | sibling_count5 | -0.00005811 | 0.007916 | -0.007341 | 2150 | 0.9941 | -0.02228 | 0.02216 |
fixed | NA | sibling_count>5 | 0.01903 | 0.006764 | 2.814 | 2154 | 0.004938 | 0.00004676 | 0.03802 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05496 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1093 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0002167 | 0.07955 | -0.002724 | 3738 | 0.9978 | -0.2235 | 0.2231 |
fixed | NA | birth_order | 0.000822 | 0.001276 | 0.644 | 3738 | 0.5196 | -0.002761 | 0.004405 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002991 | 0.008557 | 0.3496 | 3729 | 0.7267 | -0.02103 | 0.02701 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001681 | 0.0002936 | -0.5724 | 3719 | 0.5671 | -0.0009924 | 0.0006562 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000245 | 0.000003226 | 0.7596 | 3710 | 0.4475 | -0.000006605 | 0.00001151 |
fixed | NA | male | 0.003571 | 0.003991 | 0.8946 | 3640 | 0.371 | -0.007633 | 0.01477 |
fixed | NA | sibling_count3 | -0.004323 | 0.006588 | -0.6561 | 2722 | 0.5118 | -0.02282 | 0.01417 |
fixed | NA | sibling_count4 | 0.001934 | 0.007037 | 0.2748 | 2524 | 0.7835 | -0.01782 | 0.02169 |
fixed | NA | sibling_count5 | -0.001542 | 0.008244 | -0.187 | 2206 | 0.8517 | -0.02468 | 0.0216 |
fixed | NA | sibling_count>5 | 0.01604 | 0.008204 | 1.955 | 2429 | 0.05067 | -0.006988 | 0.03907 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05492 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1093 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.004456 | 0.07962 | 0.05596 | 3734 | 0.9554 | -0.219 | 0.228 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002493 | 0.008558 | 0.2913 | 3723 | 0.7708 | -0.02153 | 0.02652 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001531 | 0.0002937 | -0.5212 | 3713 | 0.6023 | -0.0009776 | 0.0006714 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002327 | 0.000003228 | 0.721 | 3705 | 0.4709 | -0.000006733 | 0.00001139 |
fixed | NA | male | 0.00353 | 0.003992 | 0.8844 | 3637 | 0.3766 | -0.007675 | 0.01474 |
fixed | NA | sibling_count3 | -0.003619 | 0.006713 | -0.5391 | 2841 | 0.5898 | -0.02246 | 0.01522 |
fixed | NA | sibling_count4 | 0.001897 | 0.007268 | 0.261 | 2725 | 0.7941 | -0.01851 | 0.0223 |
fixed | NA | sibling_count5 | -0.0000944 | 0.008571 | -0.01101 | 2461 | 0.9912 | -0.02415 | 0.02397 |
fixed | NA | sibling_count>5 | 0.01416 | 0.008412 | 1.684 | 2583 | 0.09233 | -0.009448 | 0.03778 |
fixed | NA | birth_order_nonlinear2 | 0.003759 | 0.00514 | 0.7312 | 2983 | 0.4647 | -0.01067 | 0.01819 |
fixed | NA | birth_order_nonlinear3 | -0.001207 | 0.00609 | -0.1982 | 3082 | 0.8429 | -0.0183 | 0.01589 |
fixed | NA | birth_order_nonlinear4 | 0.006397 | 0.007642 | 0.837 | 3157 | 0.4027 | -0.01506 | 0.02785 |
fixed | NA | birth_order_nonlinear5 | -0.004586 | 0.009411 | -0.4873 | 3113 | 0.6261 | -0.031 | 0.02183 |
fixed | NA | birth_order_nonlinear>5 | 0.01514 | 0.009452 | 1.602 | 3721 | 0.1093 | -0.01139 | 0.04167 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05481 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1094 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.001525 | 0.07984 | 0.0191 | 3727 | 0.9848 | -0.2226 | 0.2257 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.003193 | 0.008584 | 0.372 | 3717 | 0.7099 | -0.0209 | 0.02729 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001795 | 0.0002947 | -0.6092 | 3709 | 0.5424 | -0.001007 | 0.0006477 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002647 | 0.000003239 | 0.817 | 3702 | 0.414 | -0.000006447 | 0.00001174 |
fixed | NA | male | 0.003806 | 0.003996 | 0.9523 | 3629 | 0.341 | -0.007412 | 0.01502 |
fixed | NA | count_birth_order2/2 | -0.00583 | 0.009763 | -0.5971 | 3160 | 0.5505 | -0.03324 | 0.02158 |
fixed | NA | count_birth_order1/3 | -0.008914 | 0.008482 | -1.051 | 3703 | 0.2933 | -0.03272 | 0.01489 |
fixed | NA | count_birth_order2/3 | -0.006944 | 0.009415 | -0.7375 | 3738 | 0.4609 | -0.03337 | 0.01949 |
fixed | NA | count_birth_order3/3 | 0.001039 | 0.01007 | 0.1032 | 3738 | 0.9178 | -0.02723 | 0.0293 |
fixed | NA | count_birth_order1/4 | 0.005042 | 0.009935 | 0.5075 | 3732 | 0.6118 | -0.02284 | 0.03293 |
fixed | NA | count_birth_order2/4 | 0.001827 | 0.01037 | 0.1762 | 3738 | 0.8602 | -0.02728 | 0.03093 |
fixed | NA | count_birth_order3/4 | -0.01081 | 0.01086 | -0.9954 | 3729 | 0.3196 | -0.04129 | 0.01967 |
fixed | NA | count_birth_order4/4 | 0.005862 | 0.01171 | 0.5008 | 3719 | 0.6165 | -0.02699 | 0.03872 |
fixed | NA | count_birth_order1/5 | -0.005219 | 0.01298 | -0.4021 | 3739 | 0.6877 | -0.04165 | 0.03122 |
fixed | NA | count_birth_order2/5 | -0.001872 | 0.01453 | -0.1289 | 3679 | 0.8975 | -0.04265 | 0.03891 |
fixed | NA | count_birth_order3/5 | -0.009697 | 0.01392 | -0.6966 | 3689 | 0.4861 | -0.04877 | 0.02938 |
fixed | NA | count_birth_order4/5 | 0.01645 | 0.01343 | 1.225 | 3699 | 0.2207 | -0.02124 | 0.05414 |
fixed | NA | count_birth_order5/5 | -0.01244 | 0.01413 | -0.8801 | 3688 | 0.3789 | -0.0521 | 0.02723 |
fixed | NA | count_birth_order1/>5 | -0.003465 | 0.01264 | -0.2742 | 3722 | 0.7839 | -0.03893 | 0.032 |
fixed | NA | count_birth_order2/>5 | 0.03849 | 0.01278 | 3.012 | 3682 | 0.00261 | 0.002623 | 0.07436 |
fixed | NA | count_birth_order3/>5 | 0.01002 | 0.01223 | 0.8194 | 3686 | 0.4126 | -0.02432 | 0.04436 |
fixed | NA | count_birth_order4/>5 | 0.006257 | 0.01216 | 0.5146 | 3651 | 0.6069 | -0.02788 | 0.04039 |
fixed | NA | count_birth_order5/>5 | 0.009081 | 0.01151 | 0.7888 | 3678 | 0.4303 | -0.02324 | 0.0414 |
fixed | NA | count_birth_order>5/>5 | 0.02622 | 0.009074 | 2.889 | 3535 | 0.003887 | 0.0007449 | 0.05169 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05436 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1095 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -5181 | -5113 | 2602 | -5203 | NA | NA | NA |
12 | -5180 | -5105 | 2602 | -5204 | 0.4171 | 1 | 0.5184 |
16 | -5177 | -5077 | 2604 | -5209 | 4.736 | 4 | 0.3155 |
26 | -5171 | -5009 | 2611 | -5223 | 14.04 | 10 | 0.171 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Category_Casual worker not in agriculture`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2572 | 0.05886 | 4.37 | 9890 | 0.00001256 | 0.09198 | 0.4224 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01623 | 0.00528 | -3.074 | 9831 | 0.002114 | -0.03105 | -0.001412 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003827 | 0.0001483 | 2.581 | 9715 | 0.009866 | -0.00003352 | 0.0007989 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002755 | 0.000001317 | -2.092 | 9579 | 0.03649 | -0.000006453 | 0.0000009423 |
fixed | NA | male | 0.06204 | 0.00543 | 11.43 | 9970 | 4.752e-30 | 0.0468 | 0.07729 |
fixed | NA | sibling_count3 | 0.002887 | 0.01133 | 0.2549 | 7371 | 0.7988 | -0.02891 | 0.03469 |
fixed | NA | sibling_count4 | -0.006908 | 0.01143 | -0.6044 | 6971 | 0.5456 | -0.03899 | 0.02517 |
fixed | NA | sibling_count5 | -0.001617 | 0.01191 | -0.1358 | 6507 | 0.892 | -0.03505 | 0.03182 |
fixed | NA | sibling_count>5 | -0.007001 | 0.009233 | -0.7582 | 7251 | 0.4483 | -0.03292 | 0.01892 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.09542 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2537 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2572 | 0.05886 | 4.37 | 9889 | 0.00001255 | 0.09199 | 0.4224 |
fixed | NA | birth_order | -0.0001545 | 0.001106 | -0.1397 | 9078 | 0.8889 | -0.003259 | 0.00295 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01619 | 0.005289 | -3.061 | 9821 | 0.002211 | -0.03103 | -0.001344 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003811 | 0.0001487 | 2.563 | 9676 | 0.0104 | -0.0000363 | 0.0007985 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002741 | 0.000001321 | -2.075 | 9523 | 0.03805 | -0.00000645 | 0.0000009678 |
fixed | NA | male | 0.06205 | 0.00543 | 11.43 | 9968 | 4.761e-30 | 0.0468 | 0.07729 |
fixed | NA | sibling_count3 | 0.002928 | 0.01133 | 0.2583 | 7381 | 0.7962 | -0.02888 | 0.03474 |
fixed | NA | sibling_count4 | -0.006814 | 0.01145 | -0.5951 | 7017 | 0.5518 | -0.03895 | 0.02533 |
fixed | NA | sibling_count5 | -0.00145 | 0.01197 | -0.1212 | 6596 | 0.9036 | -0.03505 | 0.03215 |
fixed | NA | sibling_count>5 | -0.00646 | 0.01001 | -0.6453 | 8025 | 0.5187 | -0.03456 | 0.02164 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.09546 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2537 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2574 | 0.05896 | 4.367 | 9892 | 0.00001275 | 0.09194 | 0.4229 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0162 | 0.005294 | -3.06 | 9823 | 0.002222 | -0.03106 | -0.001338 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003819 | 0.0001488 | 2.567 | 9680 | 0.01028 | -0.00003575 | 0.0007996 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002754 | 0.000001322 | -2.083 | 9524 | 0.0373 | -0.000006465 | 0.0000009577 |
fixed | NA | male | 0.06205 | 0.005432 | 11.42 | 9965 | 4.87e-30 | 0.04681 | 0.0773 |
fixed | NA | sibling_count3 | 0.003057 | 0.0115 | 0.2658 | 7639 | 0.7904 | -0.02923 | 0.03534 |
fixed | NA | sibling_count4 | -0.006794 | 0.01176 | -0.578 | 7490 | 0.5633 | -0.03979 | 0.0262 |
fixed | NA | sibling_count5 | -0.0008552 | 0.01238 | -0.0691 | 7200 | 0.9449 | -0.0356 | 0.03389 |
fixed | NA | sibling_count>5 | -0.006345 | 0.01048 | -0.6053 | 8677 | 0.545 | -0.03577 | 0.02308 |
fixed | NA | birth_order_nonlinear2 | -0.00146 | 0.007906 | -0.1847 | 9227 | 0.8535 | -0.02365 | 0.02073 |
fixed | NA | birth_order_nonlinear3 | -0.001161 | 0.009188 | -0.1263 | 9055 | 0.8995 | -0.02695 | 0.02463 |
fixed | NA | birth_order_nonlinear4 | -0.0003736 | 0.01032 | -0.03621 | 9142 | 0.9711 | -0.02934 | 0.02859 |
fixed | NA | birth_order_nonlinear5 | -0.004592 | 0.01161 | -0.3955 | 9173 | 0.6925 | -0.03718 | 0.02799 |
fixed | NA | birth_order_nonlinear>5 | -0.0009382 | 0.009655 | -0.09716 | 10078 | 0.9226 | -0.02804 | 0.02617 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.09536 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2537 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2538 | 0.05915 | 4.291 | 9894 | 0.00001795 | 0.08778 | 0.4198 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01604 | 0.005297 | -3.028 | 9813 | 0.002465 | -0.03091 | -0.001173 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000377 | 0.0001488 | 2.533 | 9667 | 0.01133 | -0.00004083 | 0.0007948 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000002706 | 0.000001322 | -2.046 | 9508 | 0.04074 | -0.000006418 | 0.000001006 |
fixed | NA | male | 0.06207 | 0.005433 | 11.42 | 9955 | 4.852e-30 | 0.04682 | 0.07732 |
fixed | NA | count_birth_order2/2 | 0.004305 | 0.0157 | 0.2742 | 9148 | 0.7839 | -0.03976 | 0.04837 |
fixed | NA | count_birth_order1/3 | 0.008432 | 0.01522 | 0.5541 | 9975 | 0.5795 | -0.03428 | 0.05115 |
fixed | NA | count_birth_order2/3 | 0.00825 | 0.01686 | 0.4892 | 10021 | 0.6247 | -0.03909 | 0.05559 |
fixed | NA | count_birth_order3/3 | -0.008015 | 0.01852 | -0.4328 | 10049 | 0.6652 | -0.06 | 0.04397 |
fixed | NA | count_birth_order1/4 | -0.0248 | 0.01667 | -1.488 | 10023 | 0.1368 | -0.07159 | 0.02198 |
fixed | NA | count_birth_order2/4 | 0.007322 | 0.01787 | 0.4098 | 10041 | 0.682 | -0.04284 | 0.05748 |
fixed | NA | count_birth_order3/4 | 0.01171 | 0.01905 | 0.6149 | 10059 | 0.5386 | -0.04176 | 0.06519 |
fixed | NA | count_birth_order4/4 | -0.009058 | 0.02023 | -0.4477 | 10065 | 0.6544 | -0.06586 | 0.04774 |
fixed | NA | count_birth_order1/5 | -0.01351 | 0.01892 | -0.7138 | 10057 | 0.4754 | -0.06662 | 0.03961 |
fixed | NA | count_birth_order2/5 | -0.01094 | 0.02006 | -0.5453 | 10064 | 0.5856 | -0.06726 | 0.04538 |
fixed | NA | count_birth_order3/5 | 0.02642 | 0.02112 | 1.251 | 10069 | 0.2109 | -0.03286 | 0.08571 |
fixed | NA | count_birth_order4/5 | 0.01116 | 0.0222 | 0.5028 | 10068 | 0.6151 | -0.05115 | 0.07347 |
fixed | NA | count_birth_order5/5 | -0.006309 | 0.02219 | -0.2843 | 10071 | 0.7762 | -0.06861 | 0.05599 |
fixed | NA | count_birth_order1/>5 | 0.01452 | 0.01457 | 0.9961 | 10069 | 0.3192 | -0.02639 | 0.05543 |
fixed | NA | count_birth_order2/>5 | -0.01502 | 0.01518 | -0.9897 | 10071 | 0.3224 | -0.05762 | 0.02758 |
fixed | NA | count_birth_order3/>5 | -0.01649 | 0.01495 | -1.103 | 10071 | 0.2701 | -0.05846 | 0.02548 |
fixed | NA | count_birth_order4/>5 | -0.005982 | 0.01468 | -0.4074 | 10070 | 0.6837 | -0.0472 | 0.03524 |
fixed | NA | count_birth_order5/>5 | -0.007781 | 0.01485 | -0.524 | 10071 | 0.6003 | -0.04946 | 0.0339 |
fixed | NA | count_birth_order>5/>5 | -0.005229 | 0.01203 | -0.4346 | 9195 | 0.6638 | -0.039 | 0.02854 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.09533 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2537 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 2203 | 2282 | -1090 | 2181 | NA | NA | NA |
12 | 2205 | 2291 | -1090 | 2181 | 0.01918 | 1 | 0.8899 |
16 | 2213 | 2328 | -1090 | 2181 | 0.1667 | 4 | 0.9967 |
26 | 2218 | 2406 | -1083 | 2166 | 14.27 | 10 | 0.1609 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5278 | 0.1723 | 3.064 | 3822 | 0.002199 | 0.04427 | 1.011 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04411 | 0.0185 | -2.385 | 3822 | 0.01715 | -0.09604 | 0.007814 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00134 | 0.0006347 | 2.111 | 3822 | 0.03487 | -0.000442 | 0.003121 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001395 | 0.000006968 | -2.001 | 3822 | 0.04541 | -0.0000335 | 0.000005613 |
fixed | NA | male | 0.04766 | 0.008681 | 5.49 | 3804 | 0.00000004281 | 0.02329 | 0.07202 |
fixed | NA | sibling_count3 | -0.005651 | 0.01432 | -0.3946 | 3064 | 0.6932 | -0.04585 | 0.03455 |
fixed | NA | sibling_count4 | 0.009222 | 0.0148 | 0.6229 | 2846 | 0.5334 | -0.03233 | 0.05078 |
fixed | NA | sibling_count5 | -0.01576 | 0.01645 | -0.9578 | 2523 | 0.3383 | -0.06194 | 0.03043 |
fixed | NA | sibling_count>5 | 0.02188 | 0.01429 | 1.531 | 2492 | 0.1258 | -0.01823 | 0.06199 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08695 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2512 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5268 | 0.1723 | 3.058 | 3821 | 0.002247 | 0.04316 | 1.01 |
fixed | NA | birth_order | -0.00116 | 0.002699 | -0.4297 | 3683 | 0.6675 | -0.008735 | 0.006416 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04386 | 0.01851 | -2.37 | 3821 | 0.01785 | -0.09582 | 0.008095 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001333 | 0.0006349 | 2.1 | 3821 | 0.03576 | -0.0004486 | 0.003116 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001393 | 0.000006969 | -1.999 | 3821 | 0.04569 | -0.00003349 | 0.000005631 |
fixed | NA | male | 0.04769 | 0.008682 | 5.493 | 3802 | 0.00000004207 | 0.02332 | 0.07206 |
fixed | NA | sibling_count3 | -0.005053 | 0.01439 | -0.3512 | 3064 | 0.7255 | -0.04545 | 0.03534 |
fixed | NA | sibling_count4 | 0.01051 | 0.01511 | 0.6959 | 2846 | 0.4865 | -0.03189 | 0.05292 |
fixed | NA | sibling_count5 | -0.01363 | 0.01718 | -0.7934 | 2567 | 0.4276 | -0.06187 | 0.0346 |
fixed | NA | sibling_count>5 | 0.02605 | 0.01727 | 1.508 | 2653 | 0.1316 | -0.02244 | 0.07454 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08704 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2512 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5254 | 0.1725 | 3.046 | 3817 | 0.002338 | 0.04115 | 1.01 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0439 | 0.01852 | -2.37 | 3817 | 0.01782 | -0.09589 | 0.008089 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001338 | 0.0006353 | 2.106 | 3817 | 0.03531 | -0.0004457 | 0.003121 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001404 | 0.000006975 | -2.013 | 3817 | 0.04416 | -0.00003362 | 0.000005537 |
fixed | NA | male | 0.04763 | 0.008685 | 5.484 | 3798 | 0.00000004422 | 0.02325 | 0.07201 |
fixed | NA | sibling_count3 | -0.001229 | 0.01468 | -0.08376 | 3161 | 0.9333 | -0.04243 | 0.03997 |
fixed | NA | sibling_count4 | 0.01619 | 0.01565 | 1.035 | 3031 | 0.3009 | -0.02774 | 0.06013 |
fixed | NA | sibling_count5 | -0.00553 | 0.01801 | -0.3071 | 2835 | 0.7588 | -0.05608 | 0.04502 |
fixed | NA | sibling_count>5 | 0.03521 | 0.01774 | 1.985 | 2798 | 0.04725 | -0.01458 | 0.08499 |
fixed | NA | birth_order_nonlinear2 | 0.0003386 | 0.01147 | 0.02952 | 3348 | 0.9764 | -0.03186 | 0.03253 |
fixed | NA | birth_order_nonlinear3 | -0.01783 | 0.01349 | -1.322 | 3441 | 0.1864 | -0.05569 | 0.02004 |
fixed | NA | birth_order_nonlinear4 | -0.01307 | 0.01643 | -0.7954 | 3512 | 0.4264 | -0.0592 | 0.03306 |
fixed | NA | birth_order_nonlinear5 | -0.01722 | 0.02021 | -0.8518 | 3529 | 0.3944 | -0.07394 | 0.03951 |
fixed | NA | birth_order_nonlinear>5 | -0.01704 | 0.02005 | -0.8501 | 3809 | 0.3953 | -0.07332 | 0.03924 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08715 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2512 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5537 | 0.1731 | 3.199 | 3807 | 0.00139 | 0.06784 | 1.04 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04629 | 0.01858 | -2.491 | 3807 | 0.01279 | -0.09845 | 0.005878 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001425 | 0.0006377 | 2.234 | 3807 | 0.02552 | -0.0003652 | 0.003215 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001505 | 0.000007003 | -2.15 | 3807 | 0.03163 | -0.00003471 | 0.000004602 |
fixed | NA | male | 0.04776 | 0.008695 | 5.492 | 3788 | 0.00000004224 | 0.02335 | 0.07216 |
fixed | NA | count_birth_order2/2 | -0.02316 | 0.02227 | -1.04 | 3430 | 0.2985 | -0.08567 | 0.03935 |
fixed | NA | count_birth_order1/3 | -0.01659 | 0.01882 | -0.8817 | 3797 | 0.378 | -0.06942 | 0.03623 |
fixed | NA | count_birth_order2/3 | 0.002044 | 0.02091 | 0.09778 | 3806 | 0.9221 | -0.05664 | 0.06073 |
fixed | NA | count_birth_order3/3 | -0.0255 | 0.02262 | -1.127 | 3807 | 0.2596 | -0.08898 | 0.03799 |
fixed | NA | count_birth_order1/4 | -0.0171 | 0.02162 | -0.7912 | 3804 | 0.4289 | -0.07779 | 0.04358 |
fixed | NA | count_birth_order2/4 | 0.01951 | 0.02274 | 0.858 | 3807 | 0.391 | -0.04431 | 0.08333 |
fixed | NA | count_birth_order3/4 | 0.004401 | 0.02385 | 0.1845 | 3805 | 0.8536 | -0.06255 | 0.07135 |
fixed | NA | count_birth_order4/4 | 0.006849 | 0.0253 | 0.2707 | 3803 | 0.7866 | -0.06417 | 0.07787 |
fixed | NA | count_birth_order1/5 | -0.0173 | 0.02837 | -0.6099 | 3807 | 0.5419 | -0.09693 | 0.06232 |
fixed | NA | count_birth_order2/5 | -0.008308 | 0.03089 | -0.269 | 3797 | 0.7879 | -0.095 | 0.07839 |
fixed | NA | count_birth_order3/5 | -0.03295 | 0.02893 | -1.139 | 3799 | 0.2549 | -0.1142 | 0.04827 |
fixed | NA | count_birth_order4/5 | -0.03155 | 0.02815 | -1.121 | 3798 | 0.2624 | -0.1106 | 0.04746 |
fixed | NA | count_birth_order5/5 | -0.02164 | 0.02952 | -0.7332 | 3794 | 0.4635 | -0.1045 | 0.06121 |
fixed | NA | count_birth_order1/>5 | 0.07584 | 0.02698 | 2.811 | 3807 | 0.00496 | 0.0001135 | 0.1516 |
fixed | NA | count_birth_order2/>5 | 0.01185 | 0.02723 | 0.4352 | 3801 | 0.6634 | -0.06459 | 0.0883 |
fixed | NA | count_birth_order3/>5 | -0.007979 | 0.02663 | -0.2996 | 3796 | 0.7645 | -0.08273 | 0.06677 |
fixed | NA | count_birth_order4/>5 | 0.007473 | 0.02587 | 0.2889 | 3790 | 0.7727 | -0.06513 | 0.08008 |
fixed | NA | count_birth_order5/>5 | 0.004793 | 0.02494 | 0.1922 | 3793 | 0.8476 | -0.06522 | 0.0748 |
fixed | NA | count_birth_order>5/>5 | 0.01042 | 0.01941 | 0.5368 | 3614 | 0.5915 | -0.04407 | 0.0649 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08705 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2512 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 715.1 | 783.9 | -346.6 | 693.1 | NA | NA | NA |
12 | 716.9 | 791.9 | -346.5 | 692.9 | 0.1845 | 1 | 0.6675 |
16 | 722.4 | 822.4 | -345.2 | 690.4 | 2.501 | 4 | 0.6444 |
26 | 731 | 893.5 | -339.5 | 679 | 11.45 | 10 | 0.3232 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5216 | 0.1714 | 3.044 | 3848 | 0.00235 | 0.04061 | 1.003 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04348 | 0.01842 | -2.36 | 3848 | 0.01831 | -0.09518 | 0.008228 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001321 | 0.0006321 | 2.09 | 3848 | 0.03669 | -0.0004533 | 0.003095 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001375 | 0.000006941 | -1.98 | 3848 | 0.04774 | -0.00003323 | 0.000005739 |
fixed | NA | male | 0.04835 | 0.008643 | 5.595 | 3829 | 0.00000002367 | 0.02409 | 0.07262 |
fixed | NA | sibling_count3 | -0.01324 | 0.01568 | -0.8443 | 3150 | 0.3986 | -0.05725 | 0.03078 |
fixed | NA | sibling_count4 | -0.005395 | 0.01581 | -0.3412 | 3004 | 0.7329 | -0.04977 | 0.03898 |
fixed | NA | sibling_count5 | 0.008151 | 0.01666 | 0.4892 | 2775 | 0.6247 | -0.03862 | 0.05492 |
fixed | NA | sibling_count>5 | 0.01342 | 0.01461 | 0.9192 | 2856 | 0.3581 | -0.02757 | 0.05442 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08703 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2509 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5211 | 0.1714 | 3.041 | 3847 | 0.002376 | 0.04004 | 1.002 |
fixed | NA | birth_order | -0.0006892 | 0.002377 | -0.2899 | 3595 | 0.7719 | -0.007362 | 0.005984 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04334 | 0.01843 | -2.352 | 3847 | 0.01873 | -0.09507 | 0.008387 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001318 | 0.0006322 | 2.084 | 3847 | 0.03719 | -0.0004569 | 0.003093 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001374 | 0.000006942 | -1.979 | 3847 | 0.04784 | -0.00003323 | 0.000005745 |
fixed | NA | male | 0.04837 | 0.008644 | 5.596 | 3828 | 0.00000002354 | 0.0241 | 0.07264 |
fixed | NA | sibling_count3 | -0.01288 | 0.01573 | -0.8184 | 3146 | 0.4132 | -0.05704 | 0.03129 |
fixed | NA | sibling_count4 | -0.004677 | 0.016 | -0.2923 | 2994 | 0.7701 | -0.0496 | 0.04025 |
fixed | NA | sibling_count5 | 0.00933 | 0.01715 | 0.544 | 2782 | 0.5865 | -0.03882 | 0.05748 |
fixed | NA | sibling_count>5 | 0.01586 | 0.01685 | 0.9413 | 2895 | 0.3466 | -0.03144 | 0.06315 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0871 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2509 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5174 | 0.1715 | 3.017 | 3843 | 0.002572 | 0.03597 | 0.9988 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04304 | 0.01843 | -2.335 | 3843 | 0.01959 | -0.09478 | 0.008697 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001309 | 0.0006324 | 2.069 | 3843 | 0.0386 | -0.0004667 | 0.003084 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000137 | 0.000006945 | -1.973 | 3843 | 0.04859 | -0.0000332 | 0.000005794 |
fixed | NA | male | 0.04827 | 0.008643 | 5.585 | 3823 | 0.000000025 | 0.02401 | 0.07254 |
fixed | NA | sibling_count3 | -0.008033 | 0.01601 | -0.5018 | 3218 | 0.6158 | -0.05297 | 0.03691 |
fixed | NA | sibling_count4 | 0.004259 | 0.01648 | 0.2584 | 3129 | 0.7961 | -0.042 | 0.05052 |
fixed | NA | sibling_count5 | 0.01848 | 0.01791 | 1.032 | 2998 | 0.3021 | -0.03178 | 0.06874 |
fixed | NA | sibling_count>5 | 0.02776 | 0.01734 | 1.602 | 3038 | 0.1094 | -0.0209 | 0.07643 |
fixed | NA | birth_order_nonlinear2 | 0.001952 | 0.0116 | 0.1683 | 3403 | 0.8663 | -0.03061 | 0.03451 |
fixed | NA | birth_order_nonlinear3 | -0.02108 | 0.01354 | -1.558 | 3505 | 0.1194 | -0.05908 | 0.01691 |
fixed | NA | birth_order_nonlinear4 | -0.0265 | 0.01601 | -1.655 | 3578 | 0.09792 | -0.07142 | 0.01843 |
fixed | NA | birth_order_nonlinear5 | -0.002944 | 0.0195 | -0.151 | 3594 | 0.88 | -0.05768 | 0.05179 |
fixed | NA | birth_order_nonlinear>5 | -0.01788 | 0.01808 | -0.989 | 3809 | 0.3227 | -0.06864 | 0.03287 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08779 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2506 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5206 | 0.1719 | 3.028 | 3833 | 0.002478 | 0.03799 | 1.003 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04292 | 0.01848 | -2.323 | 3833 | 0.02023 | -0.09478 | 0.008943 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00131 | 0.0006341 | 2.066 | 3833 | 0.03888 | -0.0004698 | 0.00309 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001377 | 0.000006966 | -1.977 | 3833 | 0.04816 | -0.00003332 | 0.000005785 |
fixed | NA | male | 0.04851 | 0.008658 | 5.603 | 3814 | 0.00000002261 | 0.0242 | 0.07281 |
fixed | NA | count_birth_order2/2 | -0.0166 | 0.02448 | -0.6779 | 3541 | 0.4979 | -0.08531 | 0.05212 |
fixed | NA | count_birth_order1/3 | -0.02012 | 0.02077 | -0.9688 | 3824 | 0.3327 | -0.07841 | 0.03818 |
fixed | NA | count_birth_order2/3 | -0.003152 | 0.0226 | -0.1394 | 3831 | 0.8891 | -0.0666 | 0.06029 |
fixed | NA | count_birth_order3/3 | -0.03641 | 0.02486 | -1.465 | 3833 | 0.1431 | -0.1062 | 0.03337 |
fixed | NA | count_birth_order1/4 | -0.02499 | 0.02258 | -1.107 | 3828 | 0.2685 | -0.08839 | 0.0384 |
fixed | NA | count_birth_order2/4 | 0.008599 | 0.02357 | 0.3648 | 3833 | 0.7153 | -0.05757 | 0.07477 |
fixed | NA | count_birth_order3/4 | -0.01663 | 0.02578 | -0.6451 | 3831 | 0.5189 | -0.08901 | 0.05574 |
fixed | NA | count_birth_order4/4 | -0.006556 | 0.02753 | -0.2381 | 3829 | 0.8118 | -0.08384 | 0.07072 |
fixed | NA | count_birth_order1/5 | 0.01083 | 0.02708 | 0.3998 | 3833 | 0.6893 | -0.0652 | 0.08685 |
fixed | NA | count_birth_order2/5 | 0.01599 | 0.02815 | 0.5683 | 3832 | 0.5699 | -0.06301 | 0.095 |
fixed | NA | count_birth_order3/5 | 0.01195 | 0.02866 | 0.417 | 3828 | 0.6767 | -0.06849 | 0.09239 |
fixed | NA | count_birth_order4/5 | -0.01794 | 0.02915 | -0.6154 | 3823 | 0.5383 | -0.09975 | 0.06388 |
fixed | NA | count_birth_order5/5 | -0.01009 | 0.02936 | -0.3437 | 3822 | 0.7311 | -0.09251 | 0.07232 |
fixed | NA | count_birth_order1/>5 | 0.04959 | 0.02449 | 2.025 | 3831 | 0.04292 | -0.01915 | 0.1183 |
fixed | NA | count_birth_order2/>5 | 0.01055 | 0.0259 | 0.4072 | 3830 | 0.6838 | -0.06216 | 0.08326 |
fixed | NA | count_birth_order3/>5 | -0.01746 | 0.02495 | -0.6998 | 3829 | 0.4841 | -0.0875 | 0.05258 |
fixed | NA | count_birth_order4/>5 | -0.01776 | 0.02434 | -0.7295 | 3826 | 0.4657 | -0.08608 | 0.05057 |
fixed | NA | count_birth_order5/>5 | 0.03147 | 0.02575 | 1.222 | 3817 | 0.2217 | -0.04081 | 0.1038 |
fixed | NA | count_birth_order>5/>5 | 0.00355 | 0.01941 | 0.1829 | 3667 | 0.8549 | -0.05092 | 0.05802 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08629 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2511 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 711.8 | 780.7 | -344.9 | 689.8 | NA | NA | NA |
12 | 713.7 | 788.8 | -344.9 | 689.7 | 0.08395 | 1 | 0.772 |
16 | 716.2 | 816.4 | -342.1 | 684.2 | 5.493 | 4 | 0.2404 |
26 | 726.6 | 889.3 | -337.3 | 674.6 | 9.669 | 10 | 0.47 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5159 | 0.1741 | 2.964 | 3754 | 0.003058 | 0.02728 | 1.004 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04311 | 0.01872 | -2.303 | 3754 | 0.02134 | -0.09566 | 0.009439 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001318 | 0.0006429 | 2.05 | 3754 | 0.04042 | -0.0004865 | 0.003123 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001381 | 0.000007066 | -1.955 | 3754 | 0.05066 | -0.00003365 | 0.00000602 |
fixed | NA | male | 0.04962 | 0.008764 | 5.662 | 3736 | 0.00000001612 | 0.02502 | 0.07422 |
fixed | NA | sibling_count3 | -0.007423 | 0.01403 | -0.5289 | 3020 | 0.5969 | -0.04682 | 0.03197 |
fixed | NA | sibling_count4 | 0.003436 | 0.01471 | 0.2335 | 2796 | 0.8154 | -0.03786 | 0.04473 |
fixed | NA | sibling_count5 | -0.02066 | 0.01679 | -1.23 | 2393 | 0.2187 | -0.06779 | 0.02647 |
fixed | NA | sibling_count>5 | 0.02131 | 0.01435 | 1.485 | 2381 | 0.1376 | -0.01896 | 0.06159 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08655 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2514 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5148 | 0.1741 | 2.956 | 3753 | 0.003131 | 0.02602 | 1.003 |
fixed | NA | birth_order | -0.0009926 | 0.002778 | -0.3573 | 3637 | 0.7209 | -0.008791 | 0.006805 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04287 | 0.01874 | -2.288 | 3753 | 0.02219 | -0.09546 | 0.009723 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001312 | 0.0006432 | 2.04 | 3753 | 0.04146 | -0.0004936 | 0.003117 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001379 | 0.000007067 | -1.951 | 3753 | 0.05111 | -0.00003363 | 0.000006048 |
fixed | NA | male | 0.04963 | 0.008765 | 5.662 | 3735 | 0.00000001612 | 0.02502 | 0.07423 |
fixed | NA | sibling_count3 | -0.006901 | 0.01411 | -0.4891 | 3018 | 0.6248 | -0.04651 | 0.03271 |
fixed | NA | sibling_count4 | 0.004525 | 0.01502 | 0.3012 | 2801 | 0.7633 | -0.03765 | 0.0467 |
fixed | NA | sibling_count5 | -0.01889 | 0.01751 | -1.079 | 2434 | 0.2806 | -0.06803 | 0.03025 |
fixed | NA | sibling_count>5 | 0.02488 | 0.01747 | 1.424 | 2596 | 0.1547 | -0.02418 | 0.07393 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08661 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2514 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5132 | 0.1743 | 2.944 | 3749 | 0.003264 | 0.02381 | 1.003 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04284 | 0.01875 | -2.285 | 3749 | 0.02236 | -0.09546 | 0.009784 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001315 | 0.0006437 | 2.044 | 3749 | 0.04106 | -0.0004914 | 0.003122 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001392 | 0.000007074 | -1.968 | 3749 | 0.04918 | -0.00003378 | 0.000005938 |
fixed | NA | male | 0.04953 | 0.00877 | 5.648 | 3731 | 0.00000001749 | 0.02491 | 0.07414 |
fixed | NA | sibling_count3 | -0.004327 | 0.01441 | -0.3003 | 3115 | 0.764 | -0.04478 | 0.03612 |
fixed | NA | sibling_count4 | 0.009017 | 0.01557 | 0.5791 | 2982 | 0.5626 | -0.03469 | 0.05272 |
fixed | NA | sibling_count5 | -0.01119 | 0.01828 | -0.6119 | 2684 | 0.5407 | -0.06251 | 0.04013 |
fixed | NA | sibling_count>5 | 0.0347 | 0.01797 | 1.931 | 2747 | 0.0536 | -0.01574 | 0.08513 |
fixed | NA | birth_order_nonlinear2 | -0.001036 | 0.01143 | -0.09066 | 3280 | 0.9278 | -0.03312 | 0.03104 |
fixed | NA | birth_order_nonlinear3 | -0.01195 | 0.01352 | -0.8841 | 3375 | 0.3767 | -0.0499 | 0.02599 |
fixed | NA | birth_order_nonlinear4 | -0.01326 | 0.01694 | -0.7827 | 3451 | 0.4339 | -0.06081 | 0.03429 |
fixed | NA | birth_order_nonlinear5 | -0.02167 | 0.02087 | -1.038 | 3436 | 0.2992 | -0.08026 | 0.03692 |
fixed | NA | birth_order_nonlinear>5 | -0.01784 | 0.02069 | -0.8624 | 3743 | 0.3885 | -0.07592 | 0.04023 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08642 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2516 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5353 | 0.1748 | 3.062 | 3739 | 0.002214 | 0.04459 | 1.026 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04495 | 0.0188 | -2.391 | 3739 | 0.01685 | -0.09773 | 0.007822 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001394 | 0.0006457 | 2.158 | 3739 | 0.03097 | -0.0004189 | 0.003206 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001485 | 0.000007099 | -2.092 | 3739 | 0.03653 | -0.00003478 | 0.000005077 |
fixed | NA | male | 0.04938 | 0.00878 | 5.625 | 3720 | 0.00000001994 | 0.02474 | 0.07403 |
fixed | NA | count_birth_order2/2 | -0.0126 | 0.02165 | -0.5819 | 3342 | 0.5607 | -0.07338 | 0.04818 |
fixed | NA | count_birth_order1/3 | -0.0158 | 0.01851 | -0.8535 | 3730 | 0.3934 | -0.06774 | 0.03615 |
fixed | NA | count_birth_order2/3 | 0.0005413 | 0.02059 | 0.02629 | 3739 | 0.979 | -0.05725 | 0.05833 |
fixed | NA | count_birth_order3/3 | -0.01806 | 0.02204 | -0.8195 | 3738 | 0.4125 | -0.07993 | 0.04381 |
fixed | NA | count_birth_order1/4 | -0.01388 | 0.02171 | -0.6392 | 3736 | 0.5227 | -0.0748 | 0.04705 |
fixed | NA | count_birth_order2/4 | 0.01046 | 0.02269 | 0.461 | 3739 | 0.6448 | -0.05323 | 0.07414 |
fixed | NA | count_birth_order3/4 | 0.00654 | 0.02379 | 0.275 | 3736 | 0.7834 | -0.06023 | 0.07331 |
fixed | NA | count_birth_order4/4 | -0.001575 | 0.02566 | -0.06138 | 3734 | 0.9511 | -0.07359 | 0.07044 |
fixed | NA | count_birth_order1/5 | -0.02303 | 0.0284 | -0.811 | 3739 | 0.4174 | -0.1027 | 0.05668 |
fixed | NA | count_birth_order2/5 | 0.007691 | 0.03189 | 0.2412 | 3726 | 0.8094 | -0.08181 | 0.0972 |
fixed | NA | count_birth_order3/5 | -0.03383 | 0.03054 | -1.108 | 3727 | 0.2681 | -0.1196 | 0.0519 |
fixed | NA | count_birth_order4/5 | -0.04271 | 0.02946 | -1.45 | 3728 | 0.1471 | -0.1254 | 0.03997 |
fixed | NA | count_birth_order5/5 | -0.02514 | 0.03101 | -0.8108 | 3725 | 0.4176 | -0.1122 | 0.0619 |
fixed | NA | count_birth_order1/>5 | 0.08574 | 0.02768 | 3.098 | 3739 | 0.001963 | 0.008051 | 0.1634 |
fixed | NA | count_birth_order2/>5 | -0.0053 | 0.02803 | -0.189 | 3732 | 0.8501 | -0.08399 | 0.07339 |
fixed | NA | count_birth_order3/>5 | 0.003049 | 0.02684 | 0.1136 | 3730 | 0.9096 | -0.07229 | 0.07839 |
fixed | NA | count_birth_order4/>5 | 0.02215 | 0.02671 | 0.8294 | 3719 | 0.407 | -0.05282 | 0.09713 |
fixed | NA | count_birth_order5/>5 | 0.00261 | 0.02527 | 0.1033 | 3724 | 0.9178 | -0.06833 | 0.07355 |
fixed | NA | count_birth_order>5/>5 | 0.01287 | 0.01968 | 0.6538 | 3521 | 0.5133 | -0.04237 | 0.06811 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.08667 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2514 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 705.5 | 774 | -341.7 | 683.5 | NA | NA | NA |
12 | 707.4 | 782.2 | -341.7 | 683.4 | 0.1277 | 1 | 0.7209 |
16 | 713.6 | 813.3 | -340.8 | 681.6 | 1.778 | 4 | 0.7765 |
26 | 721 | 883.1 | -334.5 | 669 | 12.58 | 10 | 0.2478 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Category_Government worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1944 | 0.05324 | -3.651 | 10007 | 0.0002623 | -0.3438 | -0.04494 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01928 | 0.004779 | 4.034 | 9983 | 0.00005525 | 0.005864 | 0.03269 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004177 | 0.0001344 | -3.108 | 9909 | 0.001891 | -0.000795 | -0.00004042 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002971 | 0.000001196 | 2.484 | 9809 | 0.013 | -0.000000386 | 0.000006329 |
fixed | NA | male | -0.02151 | 0.004853 | -4.432 | 9733 | 0.000009455 | -0.03513 | -0.007885 |
fixed | NA | sibling_count3 | 0.008502 | 0.01049 | 0.8108 | 7091 | 0.4175 | -0.02093 | 0.03794 |
fixed | NA | sibling_count4 | 0.01057 | 0.0106 | 0.9964 | 6790 | 0.3191 | -0.0192 | 0.04033 |
fixed | NA | sibling_count5 | 0.01661 | 0.01108 | 1.498 | 6417 | 0.1341 | -0.01451 | 0.04772 |
fixed | NA | sibling_count>5 | -0.009424 | 0.008552 | -1.102 | 7030 | 0.2705 | -0.03343 | 0.01458 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1135 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2183 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1943 | 0.05324 | -3.649 | 10004 | 0.0002645 | -0.3437 | -0.04483 |
fixed | NA | birth_order | -0.0002719 | 0.001006 | -0.2703 | 9789 | 0.787 | -0.003096 | 0.002553 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01936 | 0.004788 | 4.043 | 9976 | 0.00005323 | 0.005916 | 0.03279 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004207 | 0.0001349 | -3.119 | 9878 | 0.001818 | -0.0007992 | -0.00004211 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002999 | 0.0000012 | 2.498 | 9760 | 0.0125 | -0.0000003708 | 0.000006368 |
fixed | NA | male | -0.02151 | 0.004854 | -4.431 | 9732 | 0.000009492 | -0.03513 | -0.007881 |
fixed | NA | sibling_count3 | 0.008566 | 0.01049 | 0.8168 | 7098 | 0.4141 | -0.02087 | 0.03801 |
fixed | NA | sibling_count4 | 0.01072 | 0.01062 | 1.009 | 6834 | 0.3128 | -0.01909 | 0.04053 |
fixed | NA | sibling_count5 | 0.01689 | 0.01113 | 1.517 | 6506 | 0.1293 | -0.01436 | 0.04813 |
fixed | NA | sibling_count>5 | -0.008494 | 0.00922 | -0.9212 | 7868 | 0.357 | -0.03437 | 0.01739 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1135 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2183 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1934 | 0.0533 | -3.628 | 10005 | 0.0002868 | -0.343 | -0.04377 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.01971 | 0.004791 | 4.115 | 9976 | 0.00003905 | 0.006266 | 0.03316 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004282 | 0.0001349 | -3.175 | 9880 | 0.001505 | -0.0008069 | -0.00004958 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003015 | 0.000001201 | 2.511 | 9759 | 0.01205 | -0.0000003553 | 0.000006385 |
fixed | NA | male | -0.02147 | 0.004854 | -4.424 | 9730 | 0.000009815 | -0.03509 | -0.007846 |
fixed | NA | sibling_count3 | 0.01191 | 0.01062 | 1.121 | 7339 | 0.2621 | -0.0179 | 0.04173 |
fixed | NA | sibling_count4 | 0.01411 | 0.01086 | 1.299 | 7266 | 0.194 | -0.01638 | 0.04461 |
fixed | NA | sibling_count5 | 0.02163 | 0.01146 | 1.888 | 7047 | 0.05907 | -0.01053 | 0.0538 |
fixed | NA | sibling_count>5 | -0.002547 | 0.009608 | -0.2651 | 8468 | 0.7909 | -0.02952 | 0.02442 |
fixed | NA | birth_order_nonlinear2 | -0.01229 | 0.007011 | -1.753 | 9053 | 0.07964 | -0.03197 | 0.00739 |
fixed | NA | birth_order_nonlinear3 | -0.01874 | 0.008133 | -2.304 | 8783 | 0.02124 | -0.04157 | 0.004091 |
fixed | NA | birth_order_nonlinear4 | -0.00766 | 0.009138 | -0.8382 | 8836 | 0.4019 | -0.03331 | 0.01799 |
fixed | NA | birth_order_nonlinear5 | -0.01681 | 0.01028 | -1.634 | 8828 | 0.1022 | -0.04567 | 0.01206 |
fixed | NA | birth_order_nonlinear>5 | -0.0144 | 0.008664 | -1.662 | 10000 | 0.09648 | -0.03872 | 0.009918 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1133 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2184 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.1926 | 0.05348 | -3.602 | 10001 | 0.000317 | -0.3428 | -0.04253 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0199 | 0.004794 | 4.151 | 9966 | 0.00003341 | 0.006442 | 0.03336 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0004295 | 0.000135 | -3.182 | 9868 | 0.001467 | -0.0008084 | -0.00005062 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002987 | 0.000001201 | 2.486 | 9744 | 0.01292 | -0.0000003851 | 0.000006359 |
fixed | NA | male | -0.02117 | 0.004856 | -4.36 | 9719 | 0.00001315 | -0.0348 | -0.00754 |
fixed | NA | count_birth_order2/2 | -0.0235 | 0.01393 | -1.687 | 9168 | 0.09155 | -0.06259 | 0.01559 |
fixed | NA | count_birth_order1/3 | 0.02031 | 0.01377 | 1.475 | 9837 | 0.1403 | -0.01834 | 0.05896 |
fixed | NA | count_birth_order2/3 | -0.01708 | 0.01523 | -1.121 | 9957 | 0.2623 | -0.05984 | 0.02568 |
fixed | NA | count_birth_order3/3 | -0.01838 | 0.0167 | -1.101 | 10031 | 0.2711 | -0.06527 | 0.0285 |
fixed | NA | count_birth_order1/4 | 0.009319 | 0.01506 | 0.6189 | 9952 | 0.536 | -0.03294 | 0.05158 |
fixed | NA | count_birth_order2/4 | 0.01105 | 0.01613 | 0.685 | 10007 | 0.4934 | -0.03422 | 0.05631 |
fixed | NA | count_birth_order3/4 | -0.0106 | 0.01717 | -0.6175 | 10050 | 0.5369 | -0.0588 | 0.0376 |
fixed | NA | count_birth_order4/4 | -0.01459 | 0.01822 | -0.8008 | 10065 | 0.4233 | -0.06575 | 0.03656 |
fixed | NA | count_birth_order1/5 | 0.01084 | 0.01706 | 0.6352 | 10034 | 0.5253 | -0.03706 | 0.05873 |
fixed | NA | count_birth_order2/5 | -0.002587 | 0.01808 | -0.1431 | 10054 | 0.8862 | -0.05333 | 0.04816 |
fixed | NA | count_birth_order3/5 | 0.01388 | 0.01901 | 0.7301 | 10069 | 0.4653 | -0.03949 | 0.06725 |
fixed | NA | count_birth_order4/5 | 0.006791 | 0.01995 | 0.3404 | 10060 | 0.7335 | -0.0492 | 0.06278 |
fixed | NA | count_birth_order5/5 | 0.006184 | 0.01996 | 0.3098 | 10070 | 0.7567 | -0.04985 | 0.06222 |
fixed | NA | count_birth_order1/>5 | -0.01924 | 0.01312 | -1.466 | 10065 | 0.1427 | -0.05608 | 0.0176 |
fixed | NA | count_birth_order2/>5 | -0.01011 | 0.01365 | -0.7407 | 10071 | 0.4589 | -0.04843 | 0.02821 |
fixed | NA | count_birth_order3/>5 | -0.027 | 0.01345 | -2.008 | 10071 | 0.0447 | -0.06475 | 0.01075 |
fixed | NA | count_birth_order4/>5 | -0.007687 | 0.01322 | -0.5815 | 10068 | 0.5609 | -0.04479 | 0.02942 |
fixed | NA | count_birth_order5/>5 | -0.02553 | 0.01336 | -1.911 | 10071 | 0.05601 | -0.06302 | 0.01197 |
fixed | NA | count_birth_order>5/>5 | -0.02128 | 0.01098 | -1.938 | 9079 | 0.0526 | -0.0521 | 0.009537 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1134 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2183 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 72.34 | 151.8 | -25.17 | 50.34 | NA | NA | NA |
12 | 74.27 | 160.9 | -25.13 | 50.27 | 0.0738 | 1 | 0.7859 |
16 | 75.28 | 190.8 | -21.64 | 43.28 | 6.987 | 4 | 0.1366 |
26 | 84.51 | 272.2 | -16.26 | 32.51 | 10.77 | 10 | 0.3758 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.867 | 0.1698 | -5.107 | 3812 | 0.0000003439 | -1.344 | -0.3904 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09225 | 0.01822 | 5.062 | 3805 | 0.0000004346 | 0.0411 | 0.1434 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002883 | 0.000625 | -4.613 | 3799 | 0.000004102 | -0.004638 | -0.001129 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003017 | 0.000006861 | 4.397 | 3796 | 0.00001128 | 0.00001091 | 0.00004943 |
fixed | NA | male | -0.02578 | 0.008528 | -3.023 | 3756 | 0.002518 | -0.04972 | -0.001844 |
fixed | NA | sibling_count3 | 0.007785 | 0.01443 | 0.5395 | 3139 | 0.5896 | -0.03272 | 0.0483 |
fixed | NA | sibling_count4 | 0.004312 | 0.01497 | 0.2881 | 2988 | 0.7733 | -0.0377 | 0.04632 |
fixed | NA | sibling_count5 | 0.003921 | 0.01672 | 0.2346 | 2759 | 0.8146 | -0.043 | 0.05084 |
fixed | NA | sibling_count>5 | -0.0358 | 0.01452 | -2.465 | 2751 | 0.01375 | -0.07655 | 0.004962 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1191 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2355 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.871 | 0.1698 | -5.13 | 3812 | 0.0000003048 | -1.348 | -0.3944 |
fixed | NA | birth_order | -0.003387 | 0.002677 | -1.265 | 3806 | 0.2059 | -0.0109 | 0.004127 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09312 | 0.01824 | 5.106 | 3807 | 0.0000003445 | 0.04193 | 0.1443 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002906 | 0.0006253 | -4.648 | 3801 | 0.000003473 | -0.004661 | -0.001151 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003026 | 0.000006861 | 4.411 | 3796 | 0.0000106 | 0.000011 | 0.00004952 |
fixed | NA | male | -0.02566 | 0.008528 | -3.009 | 3755 | 0.002635 | -0.0496 | -0.001726 |
fixed | NA | sibling_count3 | 0.009541 | 0.01449 | 0.6583 | 3140 | 0.5104 | -0.03114 | 0.05023 |
fixed | NA | sibling_count4 | 0.008137 | 0.01526 | 0.5331 | 2993 | 0.594 | -0.03471 | 0.05098 |
fixed | NA | sibling_count5 | 0.0102 | 0.01743 | 0.5852 | 2808 | 0.5585 | -0.03873 | 0.05913 |
fixed | NA | sibling_count>5 | -0.02346 | 0.01749 | -1.341 | 2930 | 0.1799 | -0.07255 | 0.02563 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1187 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2356 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8585 | 0.17 | -5.05 | 3808 | 0.0000004629 | -1.336 | -0.3813 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09185 | 0.01824 | 5.034 | 3801 | 0.0000005013 | 0.04064 | 0.1431 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002859 | 0.0006256 | -4.571 | 3795 | 0.000005014 | -0.004615 | -0.001103 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002975 | 0.000006867 | 4.332 | 3790 | 0.00001513 | 0.00001047 | 0.00004902 |
fixed | NA | male | -0.02605 | 0.00853 | -3.054 | 3750 | 0.002274 | -0.04999 | -0.002106 |
fixed | NA | sibling_count3 | 0.01138 | 0.01476 | 0.7712 | 3220 | 0.4407 | -0.03005 | 0.05282 |
fixed | NA | sibling_count4 | 0.007978 | 0.01577 | 0.506 | 3141 | 0.6129 | -0.03628 | 0.05224 |
fixed | NA | sibling_count5 | 0.01 | 0.01819 | 0.5499 | 3023 | 0.5824 | -0.04106 | 0.06107 |
fixed | NA | sibling_count>5 | -0.02489 | 0.01792 | -1.389 | 3040 | 0.165 | -0.07519 | 0.02541 |
fixed | NA | birth_order_nonlinear2 | -0.01938 | 0.01113 | -1.741 | 3347 | 0.08182 | -0.05064 | 0.01187 |
fixed | NA | birth_order_nonlinear3 | -0.01584 | 0.01312 | -1.207 | 3408 | 0.2273 | -0.05265 | 0.02098 |
fixed | NA | birth_order_nonlinear4 | -0.004245 | 0.016 | -0.2654 | 3457 | 0.7908 | -0.04915 | 0.04066 |
fixed | NA | birth_order_nonlinear5 | -0.02336 | 0.01968 | -1.187 | 3456 | 0.2353 | -0.07859 | 0.03188 |
fixed | NA | birth_order_nonlinear>5 | -0.02327 | 0.01977 | -1.177 | 3805 | 0.2392 | -0.07878 | 0.03223 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1191 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2355 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.837 | 0.1707 | -4.905 | 3798 | 0.0000009749 | -1.316 | -0.358 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08981 | 0.01832 | 4.903 | 3792 | 0.0000009818 | 0.03839 | 0.1412 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00279 | 0.0006283 | -4.441 | 3787 | 0.000009204 | -0.004554 | -0.001027 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002901 | 0.000006898 | 4.205 | 3783 | 0.00002671 | 0.000009644 | 0.00004837 |
fixed | NA | male | -0.02647 | 0.008544 | -3.098 | 3740 | 0.001965 | -0.05045 | -0.002483 |
fixed | NA | count_birth_order2/2 | -0.02663 | 0.02168 | -1.228 | 3480 | 0.2194 | -0.0875 | 0.03423 |
fixed | NA | count_birth_order1/3 | 0.0166 | 0.01863 | 0.8912 | 3784 | 0.3729 | -0.03569 | 0.06889 |
fixed | NA | count_birth_order2/3 | -0.01654 | 0.02066 | -0.8007 | 3804 | 0.4234 | -0.07452 | 0.04144 |
fixed | NA | count_birth_order3/3 | -0.01347 | 0.02232 | -0.6033 | 3807 | 0.5463 | -0.07611 | 0.04918 |
fixed | NA | count_birth_order1/4 | -0.01372 | 0.02137 | -0.6419 | 3801 | 0.521 | -0.07371 | 0.04627 |
fixed | NA | count_birth_order2/4 | 0.01028 | 0.02244 | 0.4582 | 3807 | 0.6468 | -0.05271 | 0.07328 |
fixed | NA | count_birth_order3/4 | 0.003243 | 0.02351 | 0.1379 | 3802 | 0.8903 | -0.06275 | 0.06924 |
fixed | NA | count_birth_order4/4 | -0.01605 | 0.02493 | -0.644 | 3798 | 0.5196 | -0.08604 | 0.05393 |
fixed | NA | count_birth_order1/5 | 0.01175 | 0.02799 | 0.4196 | 3807 | 0.6748 | -0.06683 | 0.09032 |
fixed | NA | count_birth_order2/5 | -0.03345 | 0.03039 | -1.101 | 3781 | 0.2711 | -0.1188 | 0.05186 |
fixed | NA | count_birth_order3/5 | -0.03181 | 0.02849 | -1.116 | 3789 | 0.2643 | -0.1118 | 0.04816 |
fixed | NA | count_birth_order4/5 | 0.02514 | 0.02771 | 0.9072 | 3788 | 0.3644 | -0.05264 | 0.1029 |
fixed | NA | count_birth_order5/5 | -0.000456 | 0.02904 | -0.0157 | 3782 | 0.9875 | -0.08198 | 0.08107 |
fixed | NA | count_birth_order1/>5 | -0.02476 | 0.0266 | -0.9311 | 3799 | 0.3519 | -0.09942 | 0.04989 |
fixed | NA | count_birth_order2/>5 | -0.04955 | 0.0268 | -1.849 | 3778 | 0.0646 | -0.1248 | 0.02569 |
fixed | NA | count_birth_order3/>5 | -0.03274 | 0.0262 | -1.25 | 3773 | 0.2114 | -0.1063 | 0.0408 |
fixed | NA | count_birth_order4/>5 | -0.03021 | 0.02543 | -1.188 | 3764 | 0.2349 | -0.1016 | 0.04118 |
fixed | NA | count_birth_order5/>5 | -0.06004 | 0.02453 | -2.447 | 3774 | 0.01444 | -0.1289 | 0.00883 |
fixed | NA | count_birth_order>5/>5 | -0.05057 | 0.01932 | -2.617 | 3698 | 0.008898 | -0.1048 | 0.003665 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1189 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2356 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 613.9 | 682.6 | -295.9 | 591.9 | NA | NA | NA |
12 | 614.3 | 689.3 | -295.1 | 590.3 | 1.606 | 1 | 0.205 |
16 | 619.3 | 719.3 | -293.7 | 587.3 | 2.942 | 4 | 0.5676 |
26 | 630.8 | 793.3 | -289.4 | 578.8 | 8.559 | 10 | 0.5744 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8577 | 0.1687 | -5.085 | 3839 | 0.0000003845 | -1.331 | -0.3842 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09078 | 0.01812 | 5.01 | 3832 | 0.0000005698 | 0.03992 | 0.1417 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002845 | 0.0006216 | -4.577 | 3827 | 0.000004868 | -0.00459 | -0.0011 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002981 | 0.000006826 | 4.367 | 3824 | 0.0000129 | 0.00001065 | 0.00004897 |
fixed | NA | male | -0.02579 | 0.008479 | -3.041 | 3783 | 0.002372 | -0.04959 | -0.001986 |
fixed | NA | sibling_count3 | 0.01011 | 0.01575 | 0.6416 | 3214 | 0.5212 | -0.03411 | 0.05433 |
fixed | NA | sibling_count4 | 0.02064 | 0.01592 | 1.297 | 3111 | 0.1948 | -0.02404 | 0.06533 |
fixed | NA | sibling_count5 | 0.01602 | 0.01683 | 0.9516 | 2952 | 0.3414 | -0.03123 | 0.06326 |
fixed | NA | sibling_count>5 | -0.01717 | 0.01473 | -1.166 | 3024 | 0.2439 | -0.05853 | 0.02419 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1183 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2351 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8617 | 0.1686 | -5.11 | 3838 | 0.0000003384 | -1.335 | -0.3883 |
fixed | NA | birth_order | -0.004012 | 0.00236 | -1.7 | 3785 | 0.08927 | -0.01064 | 0.002614 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09173 | 0.01813 | 5.061 | 3833 | 0.0000004377 | 0.04085 | 0.1426 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002869 | 0.0006217 | -4.615 | 3828 | 0.000004057 | -0.004614 | -0.001124 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002989 | 0.000006824 | 4.379 | 3823 | 0.00001222 | 0.00001073 | 0.00004904 |
fixed | NA | male | -0.02568 | 0.008478 | -3.029 | 3783 | 0.002473 | -0.04947 | -0.001879 |
fixed | NA | sibling_count3 | 0.01227 | 0.0158 | 0.7764 | 3213 | 0.4376 | -0.03208 | 0.05661 |
fixed | NA | sibling_count4 | 0.0249 | 0.01611 | 1.546 | 3106 | 0.1223 | -0.02031 | 0.0701 |
fixed | NA | sibling_count5 | 0.02296 | 0.01731 | 1.327 | 2966 | 0.1848 | -0.02563 | 0.07156 |
fixed | NA | sibling_count>5 | -0.002852 | 0.01697 | -0.168 | 3094 | 0.8666 | -0.05049 | 0.04478 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1179 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2352 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.844 | 0.1687 | -5.003 | 3834 | 0.0000005912 | -1.318 | -0.3704 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08976 | 0.01812 | 4.953 | 3828 | 0.0000007618 | 0.03889 | 0.1406 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0028 | 0.0006216 | -4.503 | 3823 | 0.000006884 | -0.004545 | -0.001055 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002914 | 0.000006826 | 4.268 | 3819 | 0.00002016 | 0.000009976 | 0.0000483 |
fixed | NA | male | -0.02612 | 0.008475 | -3.082 | 3777 | 0.002072 | -0.04991 | -0.002329 |
fixed | NA | sibling_count3 | 0.01501 | 0.01605 | 0.9355 | 3276 | 0.3496 | -0.03003 | 0.06006 |
fixed | NA | sibling_count4 | 0.02489 | 0.01654 | 1.505 | 3218 | 0.1324 | -0.02153 | 0.07132 |
fixed | NA | sibling_count5 | 0.02825 | 0.018 | 1.569 | 3141 | 0.1167 | -0.02228 | 0.07878 |
fixed | NA | sibling_count>5 | -0.003534 | 0.01741 | -0.203 | 3203 | 0.8392 | -0.05241 | 0.04534 |
fixed | NA | birth_order_nonlinear2 | -0.0175 | 0.01125 | -1.555 | 3407 | 0.1201 | -0.04909 | 0.01409 |
fixed | NA | birth_order_nonlinear3 | -0.02054 | 0.01315 | -1.561 | 3475 | 0.1186 | -0.05746 | 0.01639 |
fixed | NA | birth_order_nonlinear4 | -0.001737 | 0.01557 | -0.1115 | 3528 | 0.9112 | -0.04545 | 0.04198 |
fixed | NA | birth_order_nonlinear5 | -0.05317 | 0.01898 | -2.802 | 3531 | 0.005109 | -0.1064 | 0.00009916 |
fixed | NA | birth_order_nonlinear>5 | -0.02094 | 0.01784 | -1.174 | 3843 | 0.2404 | -0.071 | 0.02912 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1181 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.235 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8285 | 0.1689 | -4.904 | 3825 | 0.0000009789 | -1.303 | -0.3543 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0882 | 0.01815 | 4.86 | 3819 | 0.000001221 | 0.03726 | 0.1391 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002742 | 0.0006227 | -4.404 | 3814 | 0.00001092 | -0.00449 | -0.0009944 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002847 | 0.000006839 | 4.163 | 3811 | 0.00003204 | 0.000009277 | 0.00004767 |
fixed | NA | male | -0.0269 | 0.008477 | -3.173 | 3766 | 0.001521 | -0.0507 | -0.003103 |
fixed | NA | count_birth_order2/2 | -0.0224 | 0.0238 | -0.9412 | 3591 | 0.3466 | -0.08919 | 0.0444 |
fixed | NA | count_birth_order1/3 | 0.02072 | 0.02048 | 1.012 | 3810 | 0.3118 | -0.03678 | 0.07822 |
fixed | NA | count_birth_order2/3 | -0.01094 | 0.02226 | -0.4914 | 3829 | 0.6232 | -0.07342 | 0.05155 |
fixed | NA | count_birth_order3/3 | -0.01167 | 0.02445 | -0.4772 | 3833 | 0.6333 | -0.08029 | 0.05696 |
fixed | NA | count_birth_order1/4 | 0.01157 | 0.02226 | 0.5198 | 3822 | 0.6032 | -0.05091 | 0.07405 |
fixed | NA | count_birth_order2/4 | 0.0485 | 0.0232 | 2.09 | 3832 | 0.03664 | -0.01663 | 0.1136 |
fixed | NA | count_birth_order3/4 | -0.008379 | 0.02533 | -0.3308 | 3829 | 0.7408 | -0.07948 | 0.06273 |
fixed | NA | count_birth_order4/4 | -0.0125 | 0.02703 | -0.4624 | 3824 | 0.6438 | -0.08838 | 0.06338 |
fixed | NA | count_birth_order1/5 | 0.03036 | 0.02665 | 1.139 | 3833 | 0.2546 | -0.04444 | 0.1052 |
fixed | NA | count_birth_order2/5 | -0.02963 | 0.02765 | -1.071 | 3829 | 0.2841 | -0.1073 | 0.048 |
fixed | NA | count_birth_order3/5 | -0.007984 | 0.02813 | -0.2838 | 3821 | 0.7766 | -0.08695 | 0.07098 |
fixed | NA | count_birth_order4/5 | 0.07203 | 0.02859 | 2.52 | 3810 | 0.01179 | -0.008218 | 0.1523 |
fixed | NA | count_birth_order5/5 | -0.01908 | 0.0288 | -0.6625 | 3811 | 0.5077 | -0.09991 | 0.06175 |
fixed | NA | count_birth_order1/>5 | -0.007641 | 0.0241 | -0.317 | 3833 | 0.7512 | -0.0753 | 0.06001 |
fixed | NA | count_birth_order2/>5 | -0.03434 | 0.02542 | -1.351 | 3816 | 0.1769 | -0.1057 | 0.03702 |
fixed | NA | count_birth_order3/>5 | -0.002912 | 0.02449 | -0.1189 | 3819 | 0.9054 | -0.07165 | 0.06583 |
fixed | NA | count_birth_order4/>5 | -0.01136 | 0.02388 | -0.4756 | 3816 | 0.6344 | -0.07839 | 0.05568 |
fixed | NA | count_birth_order5/>5 | -0.0629 | 0.02524 | -2.492 | 3797 | 0.01274 | -0.1337 | 0.00795 |
fixed | NA | count_birth_order>5/>5 | -0.02624 | 0.01925 | -1.364 | 3727 | 0.1728 | -0.08026 | 0.02778 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1185 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2345 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 598.1 | 666.9 | -288 | 576.1 | NA | NA | NA |
12 | 597.2 | 672.3 | -286.6 | 573.2 | 2.897 | 1 | 0.08874 |
16 | 597.7 | 697.8 | -282.8 | 565.7 | 7.516 | 4 | 0.111 |
26 | 599.1 | 761.8 | -273.5 | 547.1 | 18.6 | 10 | 0.04565 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8904 | 0.1716 | -5.188 | 3745 | 0.0000002242 | -1.372 | -0.4086 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09498 | 0.01845 | 5.148 | 3738 | 0.0000002773 | 0.04319 | 0.1468 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002992 | 0.0006334 | -4.723 | 3733 | 0.000002406 | -0.00477 | -0.001214 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003151 | 0.000006961 | 4.527 | 3729 | 0.000006182 | 0.00001197 | 0.00005105 |
fixed | NA | male | -0.02612 | 0.008613 | -3.032 | 3689 | 0.002444 | -0.05029 | -0.00194 |
fixed | NA | sibling_count3 | 0.005929 | 0.01414 | 0.4193 | 3084 | 0.675 | -0.03376 | 0.04562 |
fixed | NA | sibling_count4 | 0.01116 | 0.01487 | 0.7506 | 2923 | 0.453 | -0.03058 | 0.05291 |
fixed | NA | sibling_count5 | 0.009306 | 0.01708 | 0.5449 | 2630 | 0.5858 | -0.03863 | 0.05724 |
fixed | NA | sibling_count>5 | -0.03426 | 0.01459 | -2.347 | 2633 | 0.01898 | -0.07522 | 0.006707 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1183 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.236 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8946 | 0.1717 | -5.211 | 3745 | 0.0000001976 | -1.377 | -0.4128 |
fixed | NA | birth_order | -0.003066 | 0.002754 | -1.113 | 3744 | 0.2657 | -0.0108 | 0.004665 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09584 | 0.01847 | 5.19 | 3740 | 0.0000002215 | 0.04401 | 0.1477 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.003015 | 0.0006337 | -4.757 | 3734 | 0.000002036 | -0.004794 | -0.001236 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003162 | 0.000006962 | 4.543 | 3729 | 0.000005734 | 0.00001208 | 0.00005116 |
fixed | NA | male | -0.02608 | 0.008613 | -3.028 | 3688 | 0.002477 | -0.05026 | -0.001905 |
fixed | NA | sibling_count3 | 0.007558 | 0.01421 | 0.5318 | 3083 | 0.5949 | -0.03234 | 0.04745 |
fixed | NA | sibling_count4 | 0.01457 | 0.01518 | 0.9599 | 2933 | 0.3372 | -0.02804 | 0.05718 |
fixed | NA | sibling_count5 | 0.01484 | 0.01778 | 0.8345 | 2674 | 0.4041 | -0.03508 | 0.06475 |
fixed | NA | sibling_count>5 | -0.02312 | 0.0177 | -1.306 | 2857 | 0.1916 | -0.07279 | 0.02656 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.118 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2361 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8848 | 0.1719 | -5.148 | 3740 | 0.0000002768 | -1.367 | -0.4024 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0948 | 0.01847 | 5.132 | 3734 | 0.000000302 | 0.04295 | 0.1467 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002977 | 0.0006341 | -4.695 | 3728 | 0.00000276 | -0.004757 | -0.001197 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003121 | 0.000006968 | 4.48 | 3724 | 0.000007692 | 0.00001166 | 0.00005077 |
fixed | NA | male | -0.0264 | 0.008617 | -3.063 | 3684 | 0.002205 | -0.05059 | -0.002208 |
fixed | NA | sibling_count3 | 0.009706 | 0.01449 | 0.6698 | 3166 | 0.503 | -0.03097 | 0.05038 |
fixed | NA | sibling_count4 | 0.01476 | 0.01569 | 0.9406 | 3081 | 0.347 | -0.02928 | 0.05879 |
fixed | NA | sibling_count5 | 0.01424 | 0.0185 | 0.7696 | 2879 | 0.4416 | -0.03769 | 0.06617 |
fixed | NA | sibling_count>5 | -0.02438 | 0.01816 | -1.343 | 2974 | 0.1795 | -0.07534 | 0.02659 |
fixed | NA | birth_order_nonlinear2 | -0.01562 | 0.0111 | -1.408 | 3266 | 0.1593 | -0.04677 | 0.01553 |
fixed | NA | birth_order_nonlinear3 | -0.01657 | 0.01315 | -1.26 | 3333 | 0.2076 | -0.05348 | 0.02034 |
fixed | NA | birth_order_nonlinear4 | -0.002065 | 0.0165 | -0.1252 | 3384 | 0.9004 | -0.04838 | 0.04425 |
fixed | NA | birth_order_nonlinear5 | -0.0181 | 0.02032 | -0.891 | 3355 | 0.373 | -0.07513 | 0.03893 |
fixed | NA | birth_order_nonlinear>5 | -0.02136 | 0.0204 | -1.047 | 3733 | 0.2952 | -0.07863 | 0.03591 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1181 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2362 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.8625 | 0.1725 | -5 | 3731 | 0.0000005999 | -1.347 | -0.3783 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.09284 | 0.01855 | 5.006 | 3726 | 0.0000005806 | 0.04079 | 0.1449 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002912 | 0.0006367 | -4.574 | 3720 | 0.000004938 | -0.0047 | -0.001125 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003055 | 0.000006999 | 4.365 | 3716 | 0.00001303 | 0.00001091 | 0.0000502 |
fixed | NA | male | -0.02659 | 0.008634 | -3.08 | 3673 | 0.002085 | -0.05083 | -0.002357 |
fixed | NA | count_birth_order2/2 | -0.02698 | 0.02109 | -1.28 | 3379 | 0.2008 | -0.08617 | 0.03221 |
fixed | NA | count_birth_order1/3 | 0.01649 | 0.01833 | 0.8995 | 3717 | 0.3685 | -0.03496 | 0.06793 |
fixed | NA | count_birth_order2/3 | -0.01704 | 0.02034 | -0.8376 | 3738 | 0.4023 | -0.07415 | 0.04007 |
fixed | NA | count_birth_order3/3 | -0.02125 | 0.02176 | -0.9768 | 3738 | 0.3287 | -0.08232 | 0.03982 |
fixed | NA | count_birth_order1/4 | -0.01368 | 0.02147 | -0.6371 | 3735 | 0.5241 | -0.07393 | 0.04658 |
fixed | NA | count_birth_order2/4 | 0.0192 | 0.0224 | 0.857 | 3739 | 0.3915 | -0.04368 | 0.08208 |
fixed | NA | count_birth_order3/4 | 0.004533 | 0.02346 | 0.1932 | 3733 | 0.8468 | -0.06132 | 0.07038 |
fixed | NA | count_birth_order4/4 | 0.003269 | 0.02529 | 0.1293 | 3727 | 0.8972 | -0.06772 | 0.07426 |
fixed | NA | count_birth_order1/5 | 0.00178 | 0.02805 | 0.06347 | 3739 | 0.9494 | -0.07694 | 0.0805 |
fixed | NA | count_birth_order2/5 | -0.01452 | 0.03139 | -0.4625 | 3703 | 0.6437 | -0.1026 | 0.07359 |
fixed | NA | count_birth_order3/5 | -0.009643 | 0.03007 | -0.3207 | 3709 | 0.7485 | -0.09405 | 0.07477 |
fixed | NA | count_birth_order4/5 | 0.02184 | 0.02901 | 0.753 | 3715 | 0.4515 | -0.05959 | 0.1033 |
fixed | NA | count_birth_order5/5 | 0.0006849 | 0.03053 | 0.02243 | 3709 | 0.9821 | -0.08501 | 0.08638 |
fixed | NA | count_birth_order1/>5 | -0.02163 | 0.0273 | -0.7922 | 3729 | 0.4283 | -0.09826 | 0.05501 |
fixed | NA | count_birth_order2/>5 | -0.04792 | 0.0276 | -1.736 | 3705 | 0.08268 | -0.1254 | 0.02957 |
fixed | NA | count_birth_order3/>5 | -0.03897 | 0.02643 | -1.474 | 3707 | 0.1405 | -0.1132 | 0.03522 |
fixed | NA | count_birth_order4/>5 | -0.03379 | 0.02627 | -1.286 | 3686 | 0.1985 | -0.1075 | 0.03996 |
fixed | NA | count_birth_order5/>5 | -0.05096 | 0.02487 | -2.049 | 3703 | 0.04053 | -0.1208 | 0.01885 |
fixed | NA | count_birth_order>5/>5 | -0.0495 | 0.01961 | -2.524 | 3619 | 0.01165 | -0.1045 | 0.005553 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1183 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2362 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 608.1 | 676.7 | -293 | 586.1 | NA | NA | NA |
12 | 608.8 | 683.6 | -292.4 | 584.8 | 1.244 | 1 | 0.2646 |
16 | 614.6 | 714.3 | -291.3 | 582.6 | 2.283 | 4 | 0.6838 |
26 | 627.7 | 789.7 | -287.8 | 575.7 | 6.885 | 10 | 0.7363 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Category_Private worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.02918 | 0.1054 | -0.2769 | 9991 | 0.7819 | -0.325 | 0.2667 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.05562 | 0.00946 | 5.88 | 9962 | 0.000000004244 | 0.02907 | 0.08218 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001725 | 0.000266 | -6.484 | 9882 | 0.00000000009364 | -0.002471 | -0.000978 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001406 | 0.000002366 | 5.941 | 9777 | 0.00000000293 | 0.000007416 | 0.0000207 |
fixed | NA | male | 0.05526 | 0.00963 | 5.738 | 9792 | 0.000000009848 | 0.02823 | 0.08229 |
fixed | NA | sibling_count3 | 0.0003855 | 0.02066 | 0.01865 | 7198 | 0.9851 | -0.05762 | 0.05839 |
fixed | NA | sibling_count4 | -0.008148 | 0.02089 | -0.39 | 6885 | 0.6965 | -0.06679 | 0.05049 |
fixed | NA | sibling_count5 | -0.02683 | 0.02182 | -1.229 | 6500 | 0.2191 | -0.08809 | 0.03444 |
fixed | NA | sibling_count>5 | -0.0556 | 0.01685 | -3.3 | 7129 | 0.000973 | -0.1029 | -0.008301 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2157 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4361 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.02842 | 0.1054 | -0.2697 | 9988 | 0.7874 | -0.3243 | 0.2674 |
fixed | NA | birth_order | -0.002304 | 0.00199 | -1.158 | 9712 | 0.247 | -0.007891 | 0.003283 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.05627 | 0.009476 | 5.938 | 9955 | 0.000000002977 | 0.02967 | 0.08287 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00175 | 0.0002668 | -6.556 | 9850 | 0.00000000005792 | -0.002499 | -0.001 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001429 | 0.000002374 | 6.017 | 9728 | 0.000000001842 | 0.000007622 | 0.00002095 |
fixed | NA | male | 0.05529 | 0.00963 | 5.741 | 9792 | 0.000000009677 | 0.02826 | 0.08232 |
fixed | NA | sibling_count3 | 0.0009427 | 0.02067 | 0.04561 | 7210 | 0.9636 | -0.05707 | 0.05896 |
fixed | NA | sibling_count4 | -0.006841 | 0.02092 | -0.327 | 6933 | 0.7436 | -0.06556 | 0.05188 |
fixed | NA | sibling_count5 | -0.02445 | 0.02192 | -1.116 | 6593 | 0.2646 | -0.08598 | 0.03707 |
fixed | NA | sibling_count>5 | -0.04769 | 0.01819 | -2.622 | 7951 | 0.008757 | -0.09873 | 0.003364 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2156 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4362 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.02558 | 0.1055 | -0.2424 | 9990 | 0.8085 | -0.3218 | 0.2707 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0563 | 0.009484 | 5.937 | 9955 | 0.000000003009 | 0.02968 | 0.08292 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001739 | 0.000267 | -6.513 | 9853 | 0.00000000007739 | -0.002488 | -0.0009893 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001409 | 0.000002375 | 5.932 | 9727 | 0.000000003098 | 0.000007423 | 0.00002076 |
fixed | NA | male | 0.0553 | 0.009632 | 5.741 | 9789 | 0.000000009688 | 0.02826 | 0.08233 |
fixed | NA | sibling_count3 | 0.003277 | 0.02094 | 0.1565 | 7452 | 0.8756 | -0.05551 | 0.06206 |
fixed | NA | sibling_count4 | -0.003538 | 0.02142 | -0.1652 | 7368 | 0.8688 | -0.06366 | 0.05659 |
fixed | NA | sibling_count5 | -0.02212 | 0.02258 | -0.9795 | 7141 | 0.3274 | -0.08552 | 0.04127 |
fixed | NA | sibling_count>5 | -0.04829 | 0.01897 | -2.546 | 8548 | 0.01092 | -0.1015 | 0.004958 |
fixed | NA | birth_order_nonlinear2 | -0.02808 | 0.01393 | -2.016 | 9115 | 0.04385 | -0.06718 | 0.01102 |
fixed | NA | birth_order_nonlinear3 | -0.02067 | 0.01617 | -1.278 | 8868 | 0.2011 | -0.06605 | 0.02471 |
fixed | NA | birth_order_nonlinear4 | -0.02172 | 0.01816 | -1.196 | 8925 | 0.2318 | -0.0727 | 0.02926 |
fixed | NA | birth_order_nonlinear5 | -0.01489 | 0.02044 | -0.7284 | 8924 | 0.4664 | -0.07225 | 0.04248 |
fixed | NA | birth_order_nonlinear>5 | -0.02235 | 0.01718 | -1.301 | 10022 | 0.1932 | -0.07058 | 0.02587 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2154 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4363 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.02217 | 0.1059 | -0.2094 | 9987 | 0.8342 | -0.3195 | 0.2751 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.05677 | 0.009494 | 5.98 | 9946 | 0.00000000231 | 0.03012 | 0.08342 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001744 | 0.0002672 | -6.528 | 9842 | 0.00000000006976 | -0.002494 | -0.0009943 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001406 | 0.000002377 | 5.916 | 9714 | 0.000000003415 | 0.00000739 | 0.00002074 |
fixed | NA | male | 0.05551 | 0.009637 | 5.76 | 9778 | 0.000000008674 | 0.02846 | 0.08256 |
fixed | NA | count_birth_order2/2 | -0.05724 | 0.02767 | -2.068 | 9195 | 0.03862 | -0.1349 | 0.02044 |
fixed | NA | count_birth_order1/3 | 0.0003303 | 0.02726 | 0.01212 | 9871 | 0.9903 | -0.07618 | 0.07684 |
fixed | NA | count_birth_order2/3 | -0.03185 | 0.03017 | -1.056 | 9973 | 0.2911 | -0.1165 | 0.05283 |
fixed | NA | count_birth_order3/3 | -0.04859 | 0.03309 | -1.469 | 10036 | 0.142 | -0.1415 | 0.04428 |
fixed | NA | count_birth_order1/4 | -0.005195 | 0.02981 | -0.1743 | 9970 | 0.8617 | -0.08888 | 0.07849 |
fixed | NA | count_birth_order2/4 | -0.03899 | 0.03194 | -1.221 | 10016 | 0.2222 | -0.1286 | 0.05067 |
fixed | NA | count_birth_order3/4 | -0.0355 | 0.03402 | -1.043 | 10052 | 0.2968 | -0.131 | 0.05999 |
fixed | NA | count_birth_order4/4 | -0.0587 | 0.03611 | -1.626 | 10065 | 0.1041 | -0.1601 | 0.04266 |
fixed | NA | count_birth_order1/5 | -0.02741 | 0.0338 | -0.8109 | 10040 | 0.4174 | -0.1223 | 0.06747 |
fixed | NA | count_birth_order2/5 | -0.06241 | 0.03582 | -1.742 | 10057 | 0.08148 | -0.163 | 0.03814 |
fixed | NA | count_birth_order3/5 | -0.07078 | 0.03768 | -1.879 | 10069 | 0.06033 | -0.1765 | 0.03498 |
fixed | NA | count_birth_order4/5 | -0.03619 | 0.03954 | -0.9152 | 10062 | 0.3601 | -0.1472 | 0.07481 |
fixed | NA | count_birth_order5/5 | -0.0552 | 0.03957 | -1.395 | 10070 | 0.163 | -0.1663 | 0.05587 |
fixed | NA | count_birth_order1/>5 | -0.08694 | 0.026 | -3.343 | 10066 | 0.000831 | -0.1599 | -0.01394 |
fixed | NA | count_birth_order2/>5 | -0.07812 | 0.02706 | -2.887 | 10071 | 0.003892 | -0.1541 | -0.002175 |
fixed | NA | count_birth_order3/>5 | -0.06474 | 0.02665 | -2.429 | 10071 | 0.01516 | -0.1396 | 0.01008 |
fixed | NA | count_birth_order4/>5 | -0.07889 | 0.0262 | -3.012 | 10069 | 0.002605 | -0.1524 | -0.00536 |
fixed | NA | count_birth_order5/>5 | -0.07251 | 0.02647 | -2.739 | 10071 | 0.006175 | -0.1468 | 0.001803 |
fixed | NA | count_birth_order>5/>5 | -0.08181 | 0.0217 | -3.77 | 9130 | 0.0001646 | -0.1427 | -0.02089 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2159 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4362 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 13876 | 13956 | -6927 | 13854 | NA | NA | NA |
12 | 13877 | 13964 | -6927 | 13853 | 1.343 | 1 | 0.2466 |
16 | 13882 | 13997 | -6925 | 13850 | 3.301 | 4 | 0.5088 |
26 | 13895 | 14083 | -6922 | 13843 | 6.494 | 10 | 0.7722 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.026 | 0.3156 | -6.419 | 3807 | 0.0000000001543 | -2.912 | -1.14 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2738 | 0.03387 | 8.083 | 3798 | 8.427e-16 | 0.1787 | 0.3689 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008982 | 0.001162 | -7.732 | 3789 | 1.346e-14 | -0.01224 | -0.005721 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009119 | 0.00001275 | 7.151 | 3784 | 1.026e-12 | 0.0000554 | 0.000127 |
fixed | NA | male | 0.03804 | 0.01584 | 2.401 | 3733 | 0.01642 | -0.006441 | 0.08251 |
fixed | NA | sibling_count3 | -0.03885 | 0.0269 | -1.444 | 3023 | 0.1488 | -0.1144 | 0.03666 |
fixed | NA | sibling_count4 | -0.03699 | 0.02791 | -1.325 | 2860 | 0.1852 | -0.1153 | 0.04135 |
fixed | NA | sibling_count5 | -0.07355 | 0.03119 | -2.358 | 2618 | 0.01842 | -0.1611 | 0.01399 |
fixed | NA | sibling_count>5 | -0.1243 | 0.02709 | -4.59 | 2611 | 0.000004649 | -0.2004 | -0.04829 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2278 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4351 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.023 | 0.3157 | -6.408 | 3807 | 0.0000000001656 | -2.909 | -1.137 |
fixed | NA | birth_order | 0.002475 | 0.00498 | 0.4971 | 3809 | 0.6192 | -0.0115 | 0.01645 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2732 | 0.0339 | 8.058 | 3800 | 1.032e-15 | 0.178 | 0.3683 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008966 | 0.001162 | -7.714 | 3791 | 1.549e-14 | -0.01223 | -0.005703 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009112 | 0.00001275 | 7.145 | 3784 | 1.076e-12 | 0.00005532 | 0.0001269 |
fixed | NA | male | 0.03797 | 0.01585 | 2.396 | 3731 | 0.01663 | -0.006516 | 0.08245 |
fixed | NA | sibling_count3 | -0.04015 | 0.02703 | -1.485 | 3026 | 0.1376 | -0.116 | 0.03573 |
fixed | NA | sibling_count4 | -0.0398 | 0.02848 | -1.398 | 2869 | 0.1624 | -0.1197 | 0.04014 |
fixed | NA | sibling_count5 | -0.07815 | 0.03254 | -2.402 | 2675 | 0.01638 | -0.1695 | 0.01318 |
fixed | NA | sibling_count>5 | -0.1334 | 0.03264 | -4.087 | 2813 | 0.00004497 | -0.225 | -0.04177 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.228 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4351 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.027 | 0.3161 | -6.411 | 3803 | 0.0000000001622 | -2.914 | -1.139 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2741 | 0.03392 | 8.08 | 3794 | 8.631e-16 | 0.1789 | 0.3693 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.009001 | 0.001163 | -7.739 | 3786 | 1.281e-14 | -0.01227 | -0.005736 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009161 | 0.00001277 | 7.176 | 3779 | 8.608e-13 | 0.00005577 | 0.0001274 |
fixed | NA | male | 0.0381 | 0.01585 | 2.403 | 3728 | 0.0163 | -0.006404 | 0.0826 |
fixed | NA | sibling_count3 | -0.03972 | 0.02752 | -1.443 | 3119 | 0.149 | -0.117 | 0.03752 |
fixed | NA | sibling_count4 | -0.03822 | 0.0294 | -1.3 | 3034 | 0.1937 | -0.1207 | 0.0443 |
fixed | NA | sibling_count5 | -0.08413 | 0.03393 | -2.48 | 2908 | 0.0132 | -0.1794 | 0.0111 |
fixed | NA | sibling_count>5 | -0.1433 | 0.03342 | -4.287 | 2932 | 0.00001866 | -0.2371 | -0.04947 |
fixed | NA | birth_order_nonlinear2 | -0.00469 | 0.02067 | -0.2269 | 3256 | 0.8205 | -0.06271 | 0.05333 |
fixed | NA | birth_order_nonlinear3 | 0.002097 | 0.02435 | 0.08612 | 3324 | 0.9314 | -0.06625 | 0.07045 |
fixed | NA | birth_order_nonlinear4 | -0.001416 | 0.0297 | -0.04766 | 3380 | 0.962 | -0.0848 | 0.08197 |
fixed | NA | birth_order_nonlinear5 | 0.04611 | 0.03654 | 1.262 | 3376 | 0.207 | -0.05645 | 0.1487 |
fixed | NA | birth_order_nonlinear>5 | 0.0272 | 0.03676 | 0.7398 | 3797 | 0.4595 | -0.076 | 0.1304 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2275 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4354 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.078 | 0.3173 | -6.548 | 3794 | 0.00000000006596 | -2.969 | -1.187 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2796 | 0.03406 | 8.211 | 3785 | 2.978e-16 | 0.184 | 0.3752 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.009203 | 0.001168 | -7.879 | 3777 | 4.295e-15 | -0.01248 | -0.005924 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009392 | 0.00001282 | 7.324 | 3771 | 2.933e-13 | 0.00005792 | 0.0001299 |
fixed | NA | male | 0.03892 | 0.01588 | 2.451 | 3717 | 0.01428 | -0.005648 | 0.0835 |
fixed | NA | count_birth_order2/2 | 0.005079 | 0.04026 | 0.1262 | 3419 | 0.8996 | -0.1079 | 0.1181 |
fixed | NA | count_birth_order1/3 | -0.02901 | 0.03467 | -0.8367 | 3776 | 0.4028 | -0.1263 | 0.0683 |
fixed | NA | count_birth_order2/3 | -0.04598 | 0.03843 | -1.197 | 3803 | 0.2315 | -0.1539 | 0.06188 |
fixed | NA | count_birth_order3/3 | -0.0427 | 0.04151 | -1.029 | 3807 | 0.3037 | -0.1592 | 0.07382 |
fixed | NA | count_birth_order1/4 | -0.01582 | 0.03976 | -0.3978 | 3799 | 0.6908 | -0.1274 | 0.09579 |
fixed | NA | count_birth_order2/4 | -0.03676 | 0.04174 | -0.8806 | 3807 | 0.3786 | -0.1539 | 0.08042 |
fixed | NA | count_birth_order3/4 | -0.02532 | 0.04372 | -0.579 | 3801 | 0.5626 | -0.1481 | 0.09742 |
fixed | NA | count_birth_order4/4 | -0.08068 | 0.04636 | -1.74 | 3796 | 0.08189 | -0.2108 | 0.04945 |
fixed | NA | count_birth_order1/5 | -0.07601 | 0.05206 | -1.46 | 3806 | 0.1444 | -0.2221 | 0.07013 |
fixed | NA | count_birth_order2/5 | -0.1138 | 0.05651 | -2.014 | 3772 | 0.04407 | -0.2724 | 0.04481 |
fixed | NA | count_birth_order3/5 | -0.03707 | 0.05297 | -0.6999 | 3783 | 0.4841 | -0.1857 | 0.1116 |
fixed | NA | count_birth_order4/5 | -0.1023 | 0.05152 | -1.986 | 3782 | 0.04706 | -0.2469 | 0.04228 |
fixed | NA | count_birth_order5/5 | -0.03525 | 0.054 | -0.6528 | 3774 | 0.5139 | -0.1868 | 0.1163 |
fixed | NA | count_birth_order1/>5 | -0.1897 | 0.04946 | -3.835 | 3795 | 0.0001275 | -0.3285 | -0.05085 |
fixed | NA | count_birth_order2/>5 | -0.13 | 0.04983 | -2.609 | 3768 | 0.009127 | -0.2699 | 0.009887 |
fixed | NA | count_birth_order3/>5 | -0.1686 | 0.0487 | -3.462 | 3762 | 0.0005426 | -0.3053 | -0.03189 |
fixed | NA | count_birth_order4/>5 | -0.08096 | 0.04728 | -1.712 | 3751 | 0.08691 | -0.2137 | 0.05175 |
fixed | NA | count_birth_order5/>5 | -0.09381 | 0.04561 | -2.057 | 3764 | 0.03978 | -0.2218 | 0.03422 |
fixed | NA | count_birth_order>5/>5 | -0.1121 | 0.03598 | -3.115 | 3683 | 0.001852 | -0.2131 | -0.01109 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2282 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4353 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 5366 | 5435 | -2672 | 5344 | NA | NA | NA |
12 | 5368 | 5443 | -2672 | 5344 | 0.2466 | 1 | 0.6195 |
16 | 5374 | 5474 | -2671 | 5342 | 2.082 | 4 | 0.7207 |
26 | 5386 | 5549 | -2667 | 5334 | 8.045 | 10 | 0.6245 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.018 | 0.3145 | -6.417 | 3833 | 0.000000000156 | -2.901 | -1.135 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.272 | 0.03379 | 8.048 | 3824 | 1.113e-15 | 0.1771 | 0.3668 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008924 | 0.001159 | -7.699 | 3815 | 1.737e-14 | -0.01218 | -0.00567 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009054 | 0.00001273 | 7.114 | 3810 | 1.339e-12 | 0.00005481 | 0.0001263 |
fixed | NA | male | 0.03847 | 0.0158 | 2.434 | 3757 | 0.01497 | -0.005892 | 0.08283 |
fixed | NA | sibling_count3 | -0.01225 | 0.02948 | -0.4156 | 3097 | 0.6777 | -0.09501 | 0.0705 |
fixed | NA | sibling_count4 | -0.02102 | 0.0298 | -0.7053 | 2984 | 0.4807 | -0.1047 | 0.06263 |
fixed | NA | sibling_count5 | -0.04856 | 0.03152 | -1.541 | 2814 | 0.1235 | -0.137 | 0.03992 |
fixed | NA | sibling_count>5 | -0.09925 | 0.02759 | -3.598 | 2894 | 0.0003267 | -0.1767 | -0.02181 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2287 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4351 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.02 | 0.3146 | -6.42 | 3833 | 0.0000000001529 | -2.903 | -1.137 |
fixed | NA | birth_order | -0.001348 | 0.004409 | -0.3058 | 3789 | 0.7598 | -0.01372 | 0.01103 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2723 | 0.03381 | 8.053 | 3825 | 1.07e-15 | 0.1774 | 0.3672 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008932 | 0.00116 | -7.703 | 3817 | 1.681e-14 | -0.01219 | -0.005677 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009057 | 0.00001273 | 7.115 | 3810 | 1.328e-12 | 0.00005484 | 0.0001263 |
fixed | NA | male | 0.0385 | 0.01581 | 2.436 | 3756 | 0.01491 | -0.00587 | 0.08287 |
fixed | NA | sibling_count3 | -0.01153 | 0.02958 | -0.3896 | 3095 | 0.6968 | -0.09456 | 0.07151 |
fixed | NA | sibling_count4 | -0.01958 | 0.03017 | -0.6491 | 2979 | 0.5163 | -0.1043 | 0.0651 |
fixed | NA | sibling_count5 | -0.04622 | 0.03244 | -1.425 | 2831 | 0.1543 | -0.1373 | 0.04483 |
fixed | NA | sibling_count>5 | -0.09442 | 0.03179 | -2.971 | 2978 | 0.002996 | -0.1836 | -0.0052 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2286 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4352 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.011 | 0.315 | -6.386 | 3829 | 0.0000000001908 | -2.896 | -1.127 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2716 | 0.03383 | 8.03 | 3820 | 1.288e-15 | 0.1767 | 0.3666 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008913 | 0.00116 | -7.682 | 3812 | 1.985e-14 | -0.01217 | -0.005656 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009045 | 0.00001274 | 7.1 | 3806 | 1.486e-12 | 0.00005469 | 0.0001262 |
fixed | NA | male | 0.03842 | 0.01581 | 2.43 | 3752 | 0.01514 | -0.005961 | 0.08281 |
fixed | NA | sibling_count3 | -0.01008 | 0.03005 | -0.3354 | 3170 | 0.7373 | -0.09443 | 0.07427 |
fixed | NA | sibling_count4 | -0.01969 | 0.03098 | -0.6358 | 3108 | 0.525 | -0.1066 | 0.06725 |
fixed | NA | sibling_count5 | -0.05592 | 0.03372 | -1.658 | 3026 | 0.09734 | -0.1506 | 0.03873 |
fixed | NA | sibling_count>5 | -0.103 | 0.03261 | -3.158 | 3100 | 0.001604 | -0.1945 | -0.01144 |
fixed | NA | birth_order_nonlinear2 | -0.01341 | 0.02097 | -0.6398 | 3314 | 0.5224 | -0.07227 | 0.04544 |
fixed | NA | birth_order_nonlinear3 | -0.01003 | 0.02451 | -0.409 | 3391 | 0.6826 | -0.07883 | 0.05878 |
fixed | NA | birth_order_nonlinear4 | 0.000195 | 0.02903 | 0.006718 | 3451 | 0.9946 | -0.08129 | 0.08168 |
fixed | NA | birth_order_nonlinear5 | 0.04181 | 0.03537 | 1.182 | 3453 | 0.2373 | -0.05749 | 0.1411 |
fixed | NA | birth_order_nonlinear>5 | -0.009151 | 0.0333 | -0.2748 | 3842 | 0.7835 | -0.1026 | 0.08434 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.228 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4355 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.009 | 0.3158 | -6.363 | 3820 | 0.000000000221 | -2.896 | -1.123 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2733 | 0.03392 | 8.058 | 3811 | 1.029e-15 | 0.1781 | 0.3685 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008987 | 0.001164 | -7.723 | 3804 | 1.445e-14 | -0.01225 | -0.00572 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009141 | 0.00001278 | 7.153 | 3798 | 1.015e-12 | 0.00005554 | 0.0001273 |
fixed | NA | male | 0.03913 | 0.01584 | 2.471 | 3740 | 0.01353 | -0.005325 | 0.08358 |
fixed | NA | count_birth_order2/2 | -0.05345 | 0.04441 | -1.204 | 3543 | 0.2288 | -0.1781 | 0.07121 |
fixed | NA | count_birth_order1/3 | -0.01953 | 0.03832 | -0.5096 | 3802 | 0.6104 | -0.1271 | 0.08804 |
fixed | NA | count_birth_order2/3 | -0.04084 | 0.04163 | -0.981 | 3827 | 0.3266 | -0.1577 | 0.07601 |
fixed | NA | count_birth_order3/3 | -0.03316 | 0.04571 | -0.7255 | 3833 | 0.4682 | -0.1615 | 0.09515 |
fixed | NA | count_birth_order1/4 | -0.04812 | 0.04163 | -1.156 | 3819 | 0.2478 | -0.165 | 0.06874 |
fixed | NA | count_birth_order2/4 | -0.03541 | 0.04338 | -0.8163 | 3832 | 0.4144 | -0.1572 | 0.08636 |
fixed | NA | count_birth_order3/4 | -0.01073 | 0.04735 | -0.2265 | 3827 | 0.8208 | -0.1436 | 0.1222 |
fixed | NA | count_birth_order4/4 | -0.05686 | 0.05053 | -1.125 | 3821 | 0.2605 | -0.1987 | 0.08496 |
fixed | NA | count_birth_order1/5 | -0.04768 | 0.04983 | -0.9569 | 3833 | 0.3387 | -0.1875 | 0.09218 |
fixed | NA | count_birth_order2/5 | -0.08619 | 0.05169 | -1.667 | 3827 | 0.09552 | -0.2313 | 0.05891 |
fixed | NA | count_birth_order3/5 | -0.05817 | 0.05257 | -1.106 | 3816 | 0.2686 | -0.2057 | 0.08941 |
fixed | NA | count_birth_order4/5 | -0.129 | 0.05342 | -2.416 | 3803 | 0.01575 | -0.279 | 0.0209 |
fixed | NA | count_birth_order5/5 | -0.009836 | 0.05381 | -0.1828 | 3804 | 0.855 | -0.1609 | 0.1412 |
fixed | NA | count_birth_order1/>5 | -0.1407 | 0.04506 | -3.123 | 3833 | 0.001805 | -0.2672 | -0.01423 |
fixed | NA | count_birth_order2/>5 | -0.1041 | 0.04751 | -2.191 | 3809 | 0.02852 | -0.2375 | 0.02927 |
fixed | NA | count_birth_order3/>5 | -0.1657 | 0.04577 | -3.621 | 3813 | 0.0002976 | -0.2942 | -0.03724 |
fixed | NA | count_birth_order4/>5 | -0.06336 | 0.04463 | -1.42 | 3810 | 0.1558 | -0.1886 | 0.06191 |
fixed | NA | count_birth_order5/>5 | -0.08578 | 0.04716 | -1.819 | 3786 | 0.06897 | -0.2182 | 0.04658 |
fixed | NA | count_birth_order>5/>5 | -0.1241 | 0.03602 | -3.446 | 3709 | 0.000575 | -0.2253 | -0.02302 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2294 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.435 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 5409 | 5477 | -2693 | 5387 | NA | NA | NA |
12 | 5410 | 5486 | -2693 | 5386 | 0.09448 | 1 | 0.7586 |
16 | 5416 | 5516 | -2692 | 5384 | 2.809 | 4 | 0.5902 |
26 | 5426 | 5589 | -2687 | 5374 | 9.447 | 10 | 0.4903 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.997 | 0.3192 | -6.256 | 3740 | 0.0000000004382 | -2.893 | -1.101 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2714 | 0.03431 | 7.912 | 3731 | 3.319e-15 | 0.1751 | 0.3677 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008929 | 0.001178 | -7.582 | 3723 | 4.27e-14 | -0.01223 | -0.005623 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009099 | 0.00001294 | 7.031 | 3717 | 2.431e-12 | 0.00005466 | 0.0001273 |
fixed | NA | male | 0.0349 | 0.01601 | 2.18 | 3667 | 0.02929 | -0.01003 | 0.07984 |
fixed | NA | sibling_count3 | -0.04555 | 0.02637 | -1.727 | 2984 | 0.08422 | -0.1196 | 0.02848 |
fixed | NA | sibling_count4 | -0.04056 | 0.02775 | -1.462 | 2813 | 0.144 | -0.1185 | 0.03733 |
fixed | NA | sibling_count5 | -0.0787 | 0.03189 | -2.468 | 2508 | 0.01366 | -0.1682 | 0.01082 |
fixed | NA | sibling_count>5 | -0.1247 | 0.02725 | -4.577 | 2512 | 0.000004941 | -0.2012 | -0.04824 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.227 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.436 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.994 | 0.3193 | -6.245 | 3740 | 0.0000000004712 | -2.89 | -1.098 |
fixed | NA | birth_order | 0.002076 | 0.005125 | 0.405 | 3747 | 0.6855 | -0.01231 | 0.01646 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2708 | 0.03434 | 7.887 | 3733 | 4.043e-15 | 0.1744 | 0.3672 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008913 | 0.001178 | -7.564 | 3725 | 4.911e-14 | -0.01222 | -0.005605 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009091 | 0.00001294 | 7.023 | 3718 | 2.568e-12 | 0.00005457 | 0.0001272 |
fixed | NA | male | 0.03489 | 0.01601 | 2.18 | 3665 | 0.02936 | -0.01005 | 0.07983 |
fixed | NA | sibling_count3 | -0.04667 | 0.02652 | -1.76 | 2985 | 0.07857 | -0.1211 | 0.02778 |
fixed | NA | sibling_count4 | -0.04288 | 0.02834 | -1.513 | 2826 | 0.1303 | -0.1224 | 0.03666 |
fixed | NA | sibling_count5 | -0.08244 | 0.03322 | -2.482 | 2558 | 0.01313 | -0.1757 | 0.0108 |
fixed | NA | sibling_count>5 | -0.1323 | 0.03304 | -4.004 | 2758 | 0.00006399 | -0.225 | -0.03954 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2272 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.436 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.999 | 0.3196 | -6.253 | 3736 | 0.0000000004491 | -2.896 | -1.101 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2719 | 0.03435 | 7.916 | 3727 | 3.207e-15 | 0.1755 | 0.3684 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.008956 | 0.001179 | -7.596 | 3719 | 3.842e-14 | -0.01226 | -0.005646 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000915 | 0.00001295 | 7.063 | 3712 | 1.939e-12 | 0.00005513 | 0.0001279 |
fixed | NA | male | 0.03526 | 0.01602 | 2.201 | 3662 | 0.02777 | -0.0097 | 0.08022 |
fixed | NA | sibling_count3 | -0.04768 | 0.02702 | -1.764 | 3078 | 0.0778 | -0.1235 | 0.02818 |
fixed | NA | sibling_count4 | -0.04006 | 0.02926 | -1.369 | 2989 | 0.1712 | -0.1222 | 0.04209 |
fixed | NA | sibling_count5 | -0.08599 | 0.03453 | -2.49 | 2776 | 0.01282 | -0.1829 | 0.01093 |
fixed | NA | sibling_count>5 | -0.1441 | 0.03388 | -4.252 | 2884 | 0.00002183 | -0.2392 | -0.04896 |
fixed | NA | birth_order_nonlinear2 | -0.008968 | 0.02059 | -0.4354 | 3181 | 0.6633 | -0.06678 | 0.04884 |
fixed | NA | birth_order_nonlinear3 | 0.006384 | 0.02441 | 0.2616 | 3255 | 0.7936 | -0.06212 | 0.07489 |
fixed | NA | birth_order_nonlinear4 | -0.01746 | 0.03063 | -0.5702 | 3310 | 0.5686 | -0.1034 | 0.06851 |
fixed | NA | birth_order_nonlinear5 | 0.03934 | 0.03771 | 1.043 | 3275 | 0.297 | -0.06652 | 0.1452 |
fixed | NA | birth_order_nonlinear>5 | 0.03292 | 0.03794 | 0.8678 | 3723 | 0.3856 | -0.07357 | 0.1394 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2269 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4362 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -2.036 | 0.3208 | -6.347 | 3727 | 0.0000000002462 | -2.937 | -1.136 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.2765 | 0.03449 | 8.018 | 3719 | 1.432e-15 | 0.1797 | 0.3733 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.009123 | 0.001184 | -7.705 | 3712 | 1.662e-14 | -0.01245 | -0.0058 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00009344 | 0.00001301 | 7.18 | 3706 | 8.36e-13 | 0.00005691 | 0.00013 |
fixed | NA | male | 0.03622 | 0.01605 | 2.257 | 3650 | 0.02404 | -0.008821 | 0.08127 |
fixed | NA | count_birth_order2/2 | -0.01423 | 0.03915 | -0.3636 | 3319 | 0.7162 | -0.1241 | 0.09566 |
fixed | NA | count_birth_order1/3 | -0.04654 | 0.03411 | -1.364 | 3711 | 0.1726 | -0.1423 | 0.04922 |
fixed | NA | count_birth_order2/3 | -0.06353 | 0.03785 | -1.678 | 3738 | 0.09334 | -0.1698 | 0.04272 |
fixed | NA | count_birth_order3/3 | -0.04164 | 0.04047 | -1.029 | 3738 | 0.3036 | -0.1552 | 0.07196 |
fixed | NA | count_birth_order1/4 | -0.02181 | 0.03994 | -0.546 | 3734 | 0.5851 | -0.1339 | 0.09031 |
fixed | NA | count_birth_order2/4 | -0.03984 | 0.04167 | -0.9562 | 3739 | 0.339 | -0.1568 | 0.07713 |
fixed | NA | count_birth_order3/4 | -0.03702 | 0.04363 | -0.8485 | 3731 | 0.3962 | -0.1595 | 0.08545 |
fixed | NA | count_birth_order4/4 | -0.1064 | 0.04703 | -2.262 | 3723 | 0.02376 | -0.2384 | 0.02564 |
fixed | NA | count_birth_order1/5 | -0.08905 | 0.05217 | -1.707 | 3739 | 0.08791 | -0.2355 | 0.05739 |
fixed | NA | count_birth_order2/5 | -0.1309 | 0.05835 | -2.243 | 3692 | 0.02498 | -0.2947 | 0.03293 |
fixed | NA | count_birth_order3/5 | -0.04651 | 0.05591 | -0.8318 | 3700 | 0.4056 | -0.2035 | 0.1104 |
fixed | NA | count_birth_order4/5 | -0.1053 | 0.05394 | -1.953 | 3708 | 0.0509 | -0.2568 | 0.04607 |
fixed | NA | count_birth_order5/5 | -0.04859 | 0.05676 | -0.856 | 3700 | 0.392 | -0.2079 | 0.1107 |
fixed | NA | count_birth_order1/>5 | -0.1966 | 0.05077 | -3.873 | 3724 | 0.0001093 | -0.3391 | -0.05413 |
fixed | NA | count_birth_order2/>5 | -0.1305 | 0.05132 | -2.542 | 3694 | 0.01106 | -0.2745 | 0.0136 |
fixed | NA | count_birth_order3/>5 | -0.1642 | 0.04914 | -3.341 | 3697 | 0.0008435 | -0.3021 | -0.02623 |
fixed | NA | count_birth_order4/>5 | -0.1132 | 0.04884 | -2.318 | 3671 | 0.02048 | -0.2503 | 0.02386 |
fixed | NA | count_birth_order5/>5 | -0.1064 | 0.04624 | -2.302 | 3692 | 0.0214 | -0.2362 | 0.02336 |
fixed | NA | count_birth_order>5/>5 | -0.112 | 0.03652 | -3.067 | 3606 | 0.002177 | -0.2145 | -0.009499 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.2272 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4363 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 5279 | 5348 | -2629 | 5257 | NA | NA | NA |
12 | 5281 | 5356 | -2628 | 5257 | 0.1631 | 1 | 0.6863 |
16 | 5286 | 5386 | -2627 | 5254 | 2.91 | 4 | 0.573 |
26 | 5299 | 5461 | -2624 | 5247 | 6.613 | 10 | 0.7614 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Category_Self-employed`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2665 | 0.095 | -2.805 | 9917 | 0.005038 | -0.5331 | 0.000174 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02362 | 0.008521 | 2.772 | 9866 | 0.005576 | -0.0002959 | 0.04754 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001646 | 0.0002393 | -0.6879 | 9765 | 0.4915 | -0.0008364 | 0.0005071 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000002153 | 0.000002126 | -0.1013 | 9648 | 0.9193 | -0.000006183 | 0.000005753 |
fixed | NA | male | -0.002977 | 0.008766 | -0.3396 | 9989 | 0.7342 | -0.02758 | 0.02163 |
fixed | NA | sibling_count3 | -0.02246 | 0.01828 | -1.229 | 7683 | 0.2192 | -0.07376 | 0.02885 |
fixed | NA | sibling_count4 | -0.01987 | 0.01844 | -1.077 | 7310 | 0.2813 | -0.07162 | 0.03189 |
fixed | NA | sibling_count5 | -0.01023 | 0.01921 | -0.5326 | 6871 | 0.5944 | -0.06417 | 0.0437 |
fixed | NA | sibling_count>5 | 0.01732 | 0.0149 | 1.162 | 7571 | 0.2452 | -0.0245 | 0.05913 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1531 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4098 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2668 | 0.09499 | -2.809 | 9915 | 0.004984 | -0.5335 | -0.0001598 |
fixed | NA | birth_order | 0.002029 | 0.001784 | 1.137 | 9196 | 0.2556 | -0.00298 | 0.007038 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02307 | 0.008535 | 2.703 | 9857 | 0.006891 | -0.0008909 | 0.04703 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001441 | 0.00024 | -0.6006 | 9731 | 0.5481 | -0.0008177 | 0.0005295 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000004013 | 0.000002132 | -0.1882 | 9599 | 0.8507 | -0.000006387 | 0.000005584 |
fixed | NA | male | -0.003007 | 0.008766 | -0.3431 | 9989 | 0.7315 | -0.02761 | 0.0216 |
fixed | NA | sibling_count3 | -0.023 | 0.01828 | -1.258 | 7695 | 0.2084 | -0.07432 | 0.02832 |
fixed | NA | sibling_count4 | -0.0211 | 0.01847 | -1.143 | 7356 | 0.2532 | -0.07295 | 0.03074 |
fixed | NA | sibling_count5 | -0.01241 | 0.01931 | -0.6426 | 6958 | 0.5205 | -0.06661 | 0.04179 |
fixed | NA | sibling_count>5 | 0.01022 | 0.01615 | 0.6328 | 8281 | 0.5269 | -0.03512 | 0.05556 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1529 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4098 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2752 | 0.09511 | -2.893 | 9918 | 0.003821 | -0.5422 | -0.008203 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02319 | 0.008541 | 2.715 | 9858 | 0.006636 | -0.0007847 | 0.04716 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001598 | 0.0002401 | -0.6657 | 9735 | 0.5056 | -0.0008336 | 0.0005141 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000001582 | 0.000002133 | -0.07415 | 9600 | 0.9409 | -0.000006145 | 0.000005829 |
fixed | NA | male | -0.003111 | 0.008765 | -0.3549 | 9984 | 0.7227 | -0.02771 | 0.02149 |
fixed | NA | sibling_count3 | -0.02462 | 0.01855 | -1.327 | 7932 | 0.1844 | -0.07669 | 0.02745 |
fixed | NA | sibling_count4 | -0.02199 | 0.01896 | -1.16 | 7793 | 0.2461 | -0.07521 | 0.03123 |
fixed | NA | sibling_count5 | -0.01296 | 0.01996 | -0.6493 | 7524 | 0.5162 | -0.06899 | 0.04307 |
fixed | NA | sibling_count>5 | 0.01309 | 0.01691 | 0.7741 | 8865 | 0.4389 | -0.03438 | 0.06055 |
fixed | NA | birth_order_nonlinear2 | 0.03823 | 0.01276 | 2.997 | 9348 | 0.002737 | 0.002419 | 0.07405 |
fixed | NA | birth_order_nonlinear3 | 0.01961 | 0.01483 | 1.322 | 9199 | 0.1861 | -0.02202 | 0.06123 |
fixed | NA | birth_order_nonlinear4 | 0.0146 | 0.01665 | 0.877 | 9276 | 0.3805 | -0.03214 | 0.06135 |
fixed | NA | birth_order_nonlinear5 | 0.01968 | 0.01874 | 1.05 | 9304 | 0.2936 | -0.03291 | 0.07227 |
fixed | NA | birth_order_nonlinear>5 | 0.02218 | 0.01558 | 1.423 | 10079 | 0.1546 | -0.02156 | 0.06591 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1529 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4097 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.2834 | 0.09546 | -2.969 | 9918 | 0.002995 | -0.5514 | -0.01546 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02291 | 0.008548 | 2.68 | 9849 | 0.007384 | -0.00109 | 0.0469 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0001582 | 0.0002402 | -0.6585 | 9723 | 0.5102 | -0.0008324 | 0.0005161 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000111 | 0.000002134 | -0.052 | 9586 | 0.9585 | -0.000006101 | 0.000005879 |
fixed | NA | male | -0.003372 | 0.008769 | -0.3845 | 9975 | 0.7006 | -0.02799 | 0.02124 |
fixed | NA | count_birth_order2/2 | 0.07421 | 0.02534 | 2.928 | 9275 | 0.003418 | 0.003069 | 0.1453 |
fixed | NA | count_birth_order1/3 | -0.02418 | 0.02456 | -0.9844 | 9991 | 0.3249 | -0.09311 | 0.04476 |
fixed | NA | count_birth_order2/3 | 0.03323 | 0.02722 | 1.221 | 10030 | 0.2221 | -0.04317 | 0.1096 |
fixed | NA | count_birth_order3/3 | 0.02459 | 0.02989 | 0.8229 | 10053 | 0.4106 | -0.0593 | 0.1085 |
fixed | NA | count_birth_order1/4 | 0.01501 | 0.0269 | 0.5579 | 10031 | 0.5769 | -0.0605 | 0.09051 |
fixed | NA | count_birth_order2/4 | 0.005201 | 0.02884 | 0.1804 | 10046 | 0.8569 | -0.07575 | 0.08616 |
fixed | NA | count_birth_order3/4 | -0.005191 | 0.03075 | -0.1688 | 10061 | 0.8659 | -0.0915 | 0.08111 |
fixed | NA | count_birth_order4/4 | 0.01914 | 0.03266 | 0.5862 | 10066 | 0.5578 | -0.07253 | 0.1108 |
fixed | NA | count_birth_order1/5 | 0.009117 | 0.03054 | 0.2985 | 10059 | 0.7653 | -0.07661 | 0.09484 |
fixed | NA | count_birth_order2/5 | 0.04643 | 0.03238 | 1.434 | 10065 | 0.1517 | -0.04447 | 0.1373 |
fixed | NA | count_birth_order3/5 | 0.03461 | 0.03409 | 1.015 | 10069 | 0.31 | -0.06108 | 0.1303 |
fixed | NA | count_birth_order4/5 | -0.01429 | 0.03583 | -0.3989 | 10068 | 0.69 | -0.1149 | 0.08627 |
fixed | NA | count_birth_order5/5 | 0.0102 | 0.03582 | 0.2846 | 10071 | 0.7759 | -0.09036 | 0.1107 |
fixed | NA | count_birth_order1/>5 | 0.03492 | 0.02352 | 1.485 | 10069 | 0.1377 | -0.03111 | 0.1009 |
fixed | NA | count_birth_order2/>5 | 0.05428 | 0.02449 | 2.216 | 10071 | 0.02672 | -0.01448 | 0.123 |
fixed | NA | count_birth_order3/>5 | 0.04115 | 0.02413 | 1.705 | 10071 | 0.0882 | -0.02659 | 0.1089 |
fixed | NA | count_birth_order4/>5 | 0.04521 | 0.0237 | 1.907 | 10070 | 0.05649 | -0.02132 | 0.1117 |
fixed | NA | count_birth_order5/>5 | 0.04958 | 0.02396 | 2.069 | 10071 | 0.03857 | -0.01769 | 0.1168 |
fixed | NA | count_birth_order>5/>5 | 0.04898 | 0.01941 | 2.523 | 9318 | 0.01164 | -0.005507 | 0.1035 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.153 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4097 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 11871 | 11950 | -5924 | 11849 | NA | NA | NA |
12 | 11871 | 11958 | -5924 | 11847 | 1.295 | 1 | 0.2552 |
16 | 11872 | 11987 | -5920 | 11840 | 7.919 | 4 | 0.0946 |
26 | 11883 | 12071 | -5916 | 11831 | 8.217 | 10 | 0.6077 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9428 | 0.2612 | 3.609 | 3819 | 0.0003116 | 0.2094 | 1.676 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1058 | 0.02805 | -3.773 | 3817 | 0.0001635 | -0.1846 | -0.02711 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004147 | 0.0009623 | 4.309 | 3815 | 0.00001678 | 0.001446 | 0.006848 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004614 | 0.00001056 | -4.368 | 3814 | 0.00001288 | -0.0000758 | -0.00001649 |
fixed | NA | male | -0.02367 | 0.01315 | -1.8 | 3785 | 0.0719 | -0.06057 | 0.01324 |
fixed | NA | sibling_count3 | 0.01552 | 0.02194 | 0.7075 | 3125 | 0.4793 | -0.04606 | 0.0771 |
fixed | NA | sibling_count4 | -0.02907 | 0.02271 | -1.28 | 2946 | 0.2007 | -0.09282 | 0.03469 |
fixed | NA | sibling_count5 | 0.03856 | 0.02531 | 1.524 | 2677 | 0.1277 | -0.03248 | 0.1096 |
fixed | NA | sibling_count>5 | 0.04773 | 0.02198 | 2.172 | 2660 | 0.02998 | -0.01397 | 0.1094 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1578 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3721 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9413 | 0.2613 | 3.602 | 3819 | 0.0003195 | 0.2078 | 1.675 |
fixed | NA | birth_order | -0.001447 | 0.004107 | -0.3524 | 3766 | 0.7246 | -0.01298 | 0.01008 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1055 | 0.02807 | -3.759 | 3817 | 0.0001733 | -0.1843 | -0.02671 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004138 | 0.0009626 | 4.299 | 3815 | 0.00001761 | 0.001436 | 0.00684 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004611 | 0.00001057 | -4.364 | 3813 | 0.00001308 | -0.00007577 | -0.00001645 |
fixed | NA | male | -0.02362 | 0.01315 | -1.796 | 3783 | 0.07252 | -0.06052 | 0.01329 |
fixed | NA | sibling_count3 | 0.01627 | 0.02204 | 0.7382 | 3124 | 0.4605 | -0.04561 | 0.07815 |
fixed | NA | sibling_count4 | -0.02744 | 0.02318 | -1.184 | 2948 | 0.2365 | -0.09251 | 0.03762 |
fixed | NA | sibling_count5 | 0.0412 | 0.02642 | 1.559 | 2723 | 0.119 | -0.03296 | 0.1154 |
fixed | NA | sibling_count>5 | 0.05295 | 0.02654 | 1.995 | 2828 | 0.04609 | -0.02154 | 0.1274 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.372 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9329 | 0.2617 | 3.565 | 3815 | 0.0003682 | 0.1984 | 1.667 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1051 | 0.02809 | -3.742 | 3812 | 0.0001852 | -0.184 | -0.02627 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004127 | 0.0009634 | 4.283 | 3810 | 0.00001887 | 0.001422 | 0.006831 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004607 | 0.00001058 | -4.355 | 3808 | 0.00001363 | -0.00007576 | -0.00001638 |
fixed | NA | male | -0.02352 | 0.01315 | -1.788 | 3779 | 0.07392 | -0.06044 | 0.01341 |
fixed | NA | sibling_count3 | 0.0156 | 0.02247 | 0.6942 | 3214 | 0.4876 | -0.04747 | 0.07867 |
fixed | NA | sibling_count4 | -0.02767 | 0.02398 | -1.154 | 3114 | 0.2487 | -0.09499 | 0.03965 |
fixed | NA | sibling_count5 | 0.04284 | 0.02763 | 1.55 | 2963 | 0.1212 | -0.03472 | 0.1204 |
fixed | NA | sibling_count>5 | 0.0613 | 0.02722 | 2.252 | 2955 | 0.02438 | -0.0151 | 0.1377 |
fixed | NA | birth_order_nonlinear2 | 0.01025 | 0.01727 | 0.5934 | 3368 | 0.553 | -0.03824 | 0.05874 |
fixed | NA | birth_order_nonlinear3 | 0.001374 | 0.02033 | 0.06759 | 3441 | 0.9461 | -0.0557 | 0.05845 |
fixed | NA | birth_order_nonlinear4 | -0.002639 | 0.02479 | -0.1065 | 3498 | 0.9152 | -0.07221 | 0.06693 |
fixed | NA | birth_order_nonlinear5 | -0.008891 | 0.03048 | -0.2917 | 3505 | 0.7706 | -0.09446 | 0.07668 |
fixed | NA | birth_order_nonlinear>5 | -0.02557 | 0.03043 | -0.8404 | 3817 | 0.4007 | -0.111 | 0.05985 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1581 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3722 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9316 | 0.2628 | 3.545 | 3805 | 0.000397 | 0.194 | 1.669 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1065 | 0.02821 | -3.774 | 3803 | 0.0001631 | -0.1856 | -0.02728 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004174 | 0.0009678 | 4.313 | 3801 | 0.00001652 | 0.001457 | 0.006891 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004658 | 0.00001063 | -4.383 | 3800 | 0.000012 | -0.00007642 | -0.00001675 |
fixed | NA | male | -0.02415 | 0.01318 | -1.832 | 3769 | 0.067 | -0.06115 | 0.01285 |
fixed | NA | count_birth_order2/2 | 0.05231 | 0.0336 | 1.557 | 3475 | 0.1196 | -0.04201 | 0.1466 |
fixed | NA | count_birth_order1/3 | 0.03981 | 0.02861 | 1.392 | 3792 | 0.1641 | -0.04049 | 0.1201 |
fixed | NA | count_birth_order2/3 | 0.03881 | 0.03176 | 1.222 | 3805 | 0.2218 | -0.05034 | 0.128 |
fixed | NA | count_birth_order3/3 | 0.01045 | 0.03434 | 0.3044 | 3807 | 0.7609 | -0.08594 | 0.1068 |
fixed | NA | count_birth_order1/4 | -0.008259 | 0.03285 | -0.2514 | 3802 | 0.8015 | -0.1005 | 0.08395 |
fixed | NA | count_birth_order2/4 | -0.02985 | 0.03453 | -0.8646 | 3807 | 0.3873 | -0.1268 | 0.06706 |
fixed | NA | count_birth_order3/4 | -0.01272 | 0.0362 | -0.3513 | 3804 | 0.7254 | -0.1143 | 0.08889 |
fixed | NA | count_birth_order4/4 | 0.008705 | 0.03839 | 0.2267 | 3801 | 0.8206 | -0.09907 | 0.1165 |
fixed | NA | count_birth_order1/5 | 0.05321 | 0.04307 | 1.235 | 3807 | 0.2168 | -0.06769 | 0.1741 |
fixed | NA | count_birth_order2/5 | 0.07654 | 0.04684 | 1.634 | 3790 | 0.1023 | -0.05495 | 0.208 |
fixed | NA | count_birth_order3/5 | 0.06749 | 0.04389 | 1.538 | 3795 | 0.1242 | -0.05572 | 0.1907 |
fixed | NA | count_birth_order4/5 | 0.05473 | 0.04269 | 1.282 | 3794 | 0.1999 | -0.06511 | 0.1746 |
fixed | NA | count_birth_order5/5 | 0.02978 | 0.04476 | 0.6652 | 3789 | 0.506 | -0.09587 | 0.1554 |
fixed | NA | count_birth_order1/>5 | 0.07785 | 0.04095 | 1.901 | 3804 | 0.05738 | -0.0371 | 0.1928 |
fixed | NA | count_birth_order2/>5 | 0.07465 | 0.04131 | 1.807 | 3792 | 0.07084 | -0.04131 | 0.1906 |
fixed | NA | count_birth_order3/>5 | 0.09799 | 0.04038 | 2.426 | 3787 | 0.01529 | -0.01537 | 0.2113 |
fixed | NA | count_birth_order4/>5 | 0.04506 | 0.03922 | 1.149 | 3779 | 0.2506 | -0.06502 | 0.1551 |
fixed | NA | count_birth_order5/>5 | 0.07709 | 0.03782 | 2.038 | 3785 | 0.0416 | -0.02908 | 0.1832 |
fixed | NA | count_birth_order>5/>5 | 0.04905 | 0.0296 | 1.657 | 3670 | 0.09751 | -0.03402 | 0.1321 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1579 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3725 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3908 | 3977 | -1943 | 3886 | NA | NA | NA |
12 | 3910 | 3985 | -1943 | 3886 | 0.122 | 1 | 0.7269 |
16 | 3917 | 4017 | -1942 | 3885 | 1.352 | 4 | 0.8525 |
26 | 3931 | 4094 | -1940 | 3879 | 5.638 | 10 | 0.8447 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.917 | 0.2603 | 3.523 | 3846 | 0.0004316 | 0.1864 | 1.648 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1019 | 0.02798 | -3.642 | 3843 | 0.0002737 | -0.1804 | -0.02337 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004027 | 0.0009598 | 4.196 | 3841 | 0.00002782 | 0.001333 | 0.006722 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004496 | 0.00001054 | -4.266 | 3840 | 0.00002039 | -0.00007455 | -0.00001538 |
fixed | NA | male | -0.02421 | 0.01311 | -1.847 | 3810 | 0.06483 | -0.06101 | 0.01259 |
fixed | NA | sibling_count3 | -0.006695 | 0.02405 | -0.2784 | 3201 | 0.7807 | -0.0742 | 0.06081 |
fixed | NA | sibling_count4 | -0.03614 | 0.02428 | -1.489 | 3079 | 0.1366 | -0.1043 | 0.032 |
fixed | NA | sibling_count5 | -0.008562 | 0.02563 | -0.3341 | 2892 | 0.7383 | -0.0805 | 0.06337 |
fixed | NA | sibling_count>5 | 0.0278 | 0.02245 | 1.238 | 2968 | 0.2157 | -0.03522 | 0.09082 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1587 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.372 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9174 | 0.2603 | 3.524 | 3845 | 0.0004304 | 0.1866 | 1.648 |
fixed | NA | birth_order | 0.0004435 | 0.003628 | 0.1222 | 3719 | 0.9027 | -0.009742 | 0.01063 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.102 | 0.02799 | -3.644 | 3843 | 0.0002721 | -0.1806 | -0.02342 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00403 | 0.0009601 | 4.197 | 3841 | 0.00002769 | 0.001334 | 0.006725 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004497 | 0.00001054 | -4.266 | 3839 | 0.0000204 | -0.00007456 | -0.00001538 |
fixed | NA | male | -0.02422 | 0.01311 | -1.848 | 3809 | 0.06474 | -0.06103 | 0.01258 |
fixed | NA | sibling_count3 | -0.006931 | 0.02413 | -0.2872 | 3197 | 0.7739 | -0.07466 | 0.0608 |
fixed | NA | sibling_count4 | -0.03661 | 0.02457 | -1.49 | 3071 | 0.1364 | -0.1056 | 0.03237 |
fixed | NA | sibling_count5 | -0.009323 | 0.02638 | -0.3534 | 2901 | 0.7238 | -0.08337 | 0.06472 |
fixed | NA | sibling_count>5 | 0.02623 | 0.02589 | 1.013 | 3022 | 0.311 | -0.04644 | 0.09889 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1587 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3721 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9044 | 0.2607 | 3.47 | 3841 | 0.0005271 | 0.1727 | 1.636 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1011 | 0.02801 | -3.608 | 3839 | 0.0003122 | -0.1797 | -0.02244 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.003996 | 0.0009609 | 4.159 | 3836 | 0.00003269 | 0.001299 | 0.006694 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004462 | 0.00001055 | -4.229 | 3835 | 0.00002404 | -0.00007425 | -0.000015 |
fixed | NA | male | -0.02403 | 0.01312 | -1.832 | 3804 | 0.06702 | -0.06085 | 0.01279 |
fixed | NA | sibling_count3 | -0.01015 | 0.02454 | -0.4134 | 3267 | 0.6793 | -0.07903 | 0.05874 |
fixed | NA | sibling_count4 | -0.03844 | 0.02528 | -1.521 | 3196 | 0.1284 | -0.1094 | 0.03252 |
fixed | NA | sibling_count5 | -0.008874 | 0.02749 | -0.3228 | 3097 | 0.7469 | -0.08604 | 0.06829 |
fixed | NA | sibling_count>5 | 0.02904 | 0.02661 | 1.091 | 3148 | 0.2752 | -0.04564 | 0.1037 |
fixed | NA | birth_order_nonlinear2 | 0.01753 | 0.01751 | 1.001 | 3422 | 0.3169 | -0.03163 | 0.06668 |
fixed | NA | birth_order_nonlinear3 | 0.01558 | 0.02045 | 0.7616 | 3503 | 0.4464 | -0.04184 | 0.07299 |
fixed | NA | birth_order_nonlinear4 | -0.00005851 | 0.0242 | -0.002418 | 3563 | 0.9981 | -0.06799 | 0.06787 |
fixed | NA | birth_order_nonlinear5 | -0.002062 | 0.02949 | -0.06994 | 3572 | 0.9442 | -0.08484 | 0.08071 |
fixed | NA | birth_order_nonlinear>5 | 0.002764 | 0.02752 | 0.1004 | 3836 | 0.92 | -0.07449 | 0.08002 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1585 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3722 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.904 | 0.2612 | 3.46 | 3831 | 0.0005452 | 0.1707 | 1.637 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1033 | 0.02807 | -3.68 | 3829 | 0.0002365 | -0.1821 | -0.0245 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004077 | 0.0009634 | 4.233 | 3828 | 0.00002364 | 0.001373 | 0.006782 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004555 | 0.00001058 | -4.305 | 3827 | 0.00001715 | -0.00007526 | -0.00001585 |
fixed | NA | male | -0.02482 | 0.01313 | -1.89 | 3795 | 0.05884 | -0.06169 | 0.01205 |
fixed | NA | count_birth_order2/2 | 0.07947 | 0.03699 | 2.148 | 3581 | 0.03176 | -0.02437 | 0.1833 |
fixed | NA | count_birth_order1/3 | 0.02032 | 0.0316 | 0.643 | 3818 | 0.5202 | -0.06838 | 0.109 |
fixed | NA | count_birth_order2/3 | 0.04303 | 0.03437 | 1.252 | 3830 | 0.2107 | -0.05345 | 0.1395 |
fixed | NA | count_birth_order3/3 | -0.015 | 0.03778 | -0.3971 | 3833 | 0.6913 | -0.121 | 0.09104 |
fixed | NA | count_birth_order1/4 | 0.005795 | 0.03435 | 0.1687 | 3825 | 0.866 | -0.09063 | 0.1022 |
fixed | NA | count_birth_order2/4 | -0.0307 | 0.03584 | -0.8566 | 3832 | 0.3917 | -0.1313 | 0.0699 |
fixed | NA | count_birth_order3/4 | -0.0108 | 0.03917 | -0.2758 | 3830 | 0.7827 | -0.1207 | 0.09914 |
fixed | NA | count_birth_order4/4 | -0.006404 | 0.04181 | -0.1532 | 3827 | 0.8783 | -0.1238 | 0.111 |
fixed | NA | count_birth_order1/5 | 0.01609 | 0.04117 | 0.3908 | 3833 | 0.6959 | -0.09947 | 0.1316 |
fixed | NA | count_birth_order2/5 | 0.01692 | 0.04276 | 0.3957 | 3831 | 0.6924 | -0.1031 | 0.1369 |
fixed | NA | count_birth_order3/5 | 0.01622 | 0.04352 | 0.3728 | 3825 | 0.7093 | -0.1059 | 0.1384 |
fixed | NA | count_birth_order4/5 | 0.01776 | 0.04424 | 0.4013 | 3818 | 0.6882 | -0.1064 | 0.1419 |
fixed | NA | count_birth_order5/5 | 0.02105 | 0.04457 | 0.4723 | 3817 | 0.6367 | -0.104 | 0.1461 |
fixed | NA | count_birth_order1/>5 | 0.03557 | 0.03723 | 0.9554 | 3832 | 0.3394 | -0.06894 | 0.1401 |
fixed | NA | count_birth_order2/>5 | 0.04765 | 0.03933 | 1.211 | 3824 | 0.2258 | -0.06276 | 0.1581 |
fixed | NA | count_birth_order3/>5 | 0.1171 | 0.03789 | 3.092 | 3824 | 0.002004 | 0.01079 | 0.2235 |
fixed | NA | count_birth_order4/>5 | 0.03739 | 0.03695 | 1.012 | 3821 | 0.3117 | -0.06634 | 0.1411 |
fixed | NA | count_birth_order5/>5 | 0.03913 | 0.03908 | 1.001 | 3808 | 0.3167 | -0.07056 | 0.1488 |
fixed | NA | count_birth_order>5/>5 | 0.05174 | 0.02961 | 1.747 | 3707 | 0.08067 | -0.03138 | 0.1349 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1582 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3723 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3939 | 4008 | -1958 | 3917 | NA | NA | NA |
12 | 3941 | 4016 | -1958 | 3917 | 0.01549 | 1 | 0.901 |
16 | 3947 | 4047 | -1958 | 3915 | 1.543 | 4 | 0.8189 |
26 | 3955 | 4118 | -1952 | 3903 | 11.8 | 10 | 0.2988 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9712 | 0.2646 | 3.67 | 3751 | 0.0002462 | 0.2283 | 1.714 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.11 | 0.02846 | -3.864 | 3749 | 0.0001135 | -0.1898 | -0.03008 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004334 | 0.0009771 | 4.435 | 3746 | 0.000009468 | 0.001591 | 0.007076 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004871 | 0.00001074 | -4.536 | 3745 | 0.000005926 | -0.00007886 | -0.00001856 |
fixed | NA | male | -0.02276 | 0.0133 | -1.711 | 3715 | 0.08719 | -0.0601 | 0.01458 |
fixed | NA | sibling_count3 | 0.02252 | 0.02157 | 1.044 | 3069 | 0.2966 | -0.03803 | 0.08307 |
fixed | NA | sibling_count4 | -0.02657 | 0.02265 | -1.173 | 2884 | 0.2409 | -0.09016 | 0.03702 |
fixed | NA | sibling_count5 | 0.03133 | 0.02594 | 1.208 | 2547 | 0.2273 | -0.04149 | 0.1042 |
fixed | NA | sibling_count>5 | 0.04105 | 0.02217 | 1.852 | 2545 | 0.06416 | -0.02117 | 0.1033 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.16 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3726 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9698 | 0.2647 | 3.663 | 3751 | 0.0002524 | 0.2267 | 1.713 |
fixed | NA | birth_order | -0.001067 | 0.004238 | -0.2517 | 3715 | 0.8013 | -0.01296 | 0.01083 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1097 | 0.02848 | -3.851 | 3749 | 0.0001198 | -0.1896 | -0.02972 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004326 | 0.0009776 | 4.425 | 3747 | 0.000009919 | 0.001582 | 0.00707 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.00001074 | -4.531 | 3745 | 0.000006041 | -0.00007883 | -0.00001852 |
fixed | NA | male | -0.02275 | 0.0133 | -1.71 | 3713 | 0.0874 | -0.06009 | 0.0146 |
fixed | NA | sibling_count3 | 0.02308 | 0.02169 | 1.064 | 3067 | 0.2874 | -0.03781 | 0.08397 |
fixed | NA | sibling_count4 | -0.02539 | 0.02314 | -1.097 | 2891 | 0.2725 | -0.09034 | 0.03955 |
fixed | NA | sibling_count5 | 0.03322 | 0.02704 | 1.229 | 2589 | 0.2193 | -0.04268 | 0.1091 |
fixed | NA | sibling_count>5 | 0.0449 | 0.02695 | 1.666 | 2763 | 0.09583 | -0.03075 | 0.1205 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1602 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3725 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9616 | 0.2651 | 3.628 | 3747 | 0.0002899 | 0.2175 | 1.706 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1091 | 0.0285 | -3.828 | 3744 | 0.0001314 | -0.1891 | -0.02909 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00431 | 0.0009784 | 4.405 | 3742 | 0.00001088 | 0.001563 | 0.007056 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004859 | 0.00001075 | -4.519 | 3740 | 0.000006417 | -0.00007877 | -0.0000184 |
fixed | NA | male | -0.02281 | 0.01331 | -1.713 | 3710 | 0.08675 | -0.06018 | 0.01456 |
fixed | NA | sibling_count3 | 0.02313 | 0.02213 | 1.045 | 3157 | 0.296 | -0.039 | 0.08526 |
fixed | NA | sibling_count4 | -0.02585 | 0.02394 | -1.08 | 3054 | 0.2803 | -0.09306 | 0.04136 |
fixed | NA | sibling_count5 | 0.03196 | 0.02818 | 1.134 | 2816 | 0.2569 | -0.04715 | 0.1111 |
fixed | NA | sibling_count>5 | 0.05248 | 0.02768 | 1.896 | 2897 | 0.05807 | -0.02522 | 0.1302 |
fixed | NA | birth_order_nonlinear2 | 0.004606 | 0.01724 | 0.2672 | 3285 | 0.7893 | -0.04378 | 0.05299 |
fixed | NA | birth_order_nonlinear3 | -0.001029 | 0.02041 | -0.0504 | 3362 | 0.9598 | -0.05831 | 0.05626 |
fixed | NA | birth_order_nonlinear4 | 0.001722 | 0.02559 | 0.06727 | 3422 | 0.9464 | -0.07012 | 0.07357 |
fixed | NA | birth_order_nonlinear5 | 0.003465 | 0.03152 | 0.1099 | 3399 | 0.9125 | -0.08503 | 0.09196 |
fixed | NA | birth_order_nonlinear>5 | -0.02943 | 0.03147 | -0.9352 | 3747 | 0.3498 | -0.1178 | 0.05891 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1602 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3727 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.9503 | 0.266 | 3.573 | 3737 | 0.000358 | 0.2036 | 1.697 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.1092 | 0.0286 | -3.819 | 3735 | 0.0001361 | -0.1895 | -0.02895 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.004316 | 0.0009823 | 4.394 | 3733 | 0.00001143 | 0.001559 | 0.007073 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00004867 | 0.0000108 | -4.507 | 3732 | 0.000006766 | -0.00007898 | -0.00001836 |
fixed | NA | male | -0.0234 | 0.01334 | -1.754 | 3699 | 0.07946 | -0.06083 | 0.01404 |
fixed | NA | count_birth_order2/2 | 0.0426 | 0.03271 | 1.302 | 3378 | 0.193 | -0.04923 | 0.1344 |
fixed | NA | count_birth_order1/3 | 0.04535 | 0.0282 | 1.608 | 3724 | 0.1078 | -0.0338 | 0.1245 |
fixed | NA | count_birth_order2/3 | 0.04406 | 0.03134 | 1.406 | 3738 | 0.1598 | -0.0439 | 0.132 |
fixed | NA | count_birth_order3/3 | 0.01164 | 0.03353 | 0.3472 | 3738 | 0.7285 | -0.08249 | 0.1058 |
fixed | NA | count_birth_order1/4 | -0.008358 | 0.03305 | -0.2528 | 3736 | 0.8004 | -0.1011 | 0.08443 |
fixed | NA | count_birth_order2/4 | -0.04096 | 0.03452 | -1.187 | 3739 | 0.2355 | -0.1379 | 0.05594 |
fixed | NA | count_birth_order3/4 | -0.01007 | 0.03618 | -0.2784 | 3735 | 0.7807 | -0.1116 | 0.09147 |
fixed | NA | count_birth_order4/4 | 0.02124 | 0.03901 | 0.5443 | 3731 | 0.5862 | -0.08827 | 0.1307 |
fixed | NA | count_birth_order1/5 | 0.0574 | 0.04322 | 1.328 | 3739 | 0.1842 | -0.06392 | 0.1787 |
fixed | NA | count_birth_order2/5 | 0.07243 | 0.04845 | 1.495 | 3715 | 0.1351 | -0.06358 | 0.2084 |
fixed | NA | count_birth_order3/5 | 0.0487 | 0.04642 | 1.049 | 3719 | 0.2941 | -0.08159 | 0.179 |
fixed | NA | count_birth_order4/5 | 0.03821 | 0.04477 | 0.8534 | 3722 | 0.3935 | -0.08747 | 0.1639 |
fixed | NA | count_birth_order5/5 | 0.0122 | 0.04712 | 0.2589 | 3717 | 0.7957 | -0.1201 | 0.1445 |
fixed | NA | count_birth_order1/>5 | 0.05652 | 0.0421 | 1.342 | 3735 | 0.1795 | -0.06166 | 0.1747 |
fixed | NA | count_birth_order2/>5 | 0.05222 | 0.04261 | 1.225 | 3719 | 0.2205 | -0.06739 | 0.1718 |
fixed | NA | count_birth_order3/>5 | 0.09224 | 0.04079 | 2.261 | 3719 | 0.02382 | -0.02227 | 0.2067 |
fixed | NA | count_birth_order4/>5 | 0.03775 | 0.04057 | 0.9304 | 3703 | 0.3522 | -0.07614 | 0.1516 |
fixed | NA | count_birth_order5/>5 | 0.0893 | 0.0384 | 2.326 | 3713 | 0.02009 | -0.01849 | 0.1971 |
fixed | NA | count_birth_order>5/>5 | 0.0354 | 0.0301 | 1.176 | 3588 | 0.2396 | -0.04908 | 0.1199 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1598 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3729 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3861 | 3930 | -1919 | 3839 | NA | NA | NA |
12 | 3863 | 3938 | -1919 | 3839 | 0.06169 | 1 | 0.8038 |
16 | 3870 | 3969 | -1919 | 3838 | 1.332 | 4 | 0.856 |
26 | 3882 | 4044 | -1915 | 3830 | 8.08 | 10 | 0.6211 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Category_Unpaid family worker`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.174 | 0.06645 | 17.66 | 9941 | 8.86e-69 | 0.9873 | 1.36 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0784 | 0.005963 | -13.15 | 9896 | 3.758e-39 | -0.09513 | -0.06166 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001808 | 0.0001676 | 10.79 | 9796 | 5.516e-27 | 0.001337 | 0.002278 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001311 | 0.00000149 | -8.799 | 9672 | 1.618e-18 | -0.00001729 | -0.000008926 |
fixed | NA | male | -0.09204 | 0.006103 | -15.08 | 9888 | 7.898e-51 | -0.1092 | -0.07491 |
fixed | NA | sibling_count3 | 0.01356 | 0.0129 | 1.051 | 7256 | 0.2933 | -0.02266 | 0.04978 |
fixed | NA | sibling_count4 | 0.01864 | 0.01303 | 1.43 | 6899 | 0.1527 | -0.01794 | 0.05521 |
fixed | NA | sibling_count5 | 0.02536 | 0.0136 | 1.865 | 6474 | 0.06216 | -0.0128 | 0.06353 |
fixed | NA | sibling_count>5 | 0.04657 | 0.01052 | 4.427 | 7163 | 0.000009694 | 0.01704 | 0.07609 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1222 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2808 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.173 | 0.06645 | 17.66 | 9939 | 9.994e-69 | 0.9867 | 1.36 |
fixed | NA | birth_order | 0.002099 | 0.001252 | 1.676 | 9439 | 0.09368 | -0.001416 | 0.005614 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.07898 | 0.005973 | -13.22 | 9888 | 1.392e-39 | -0.09575 | -0.06221 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00183 | 0.0001681 | 10.89 | 9761 | 1.907e-27 | 0.001358 | 0.002301 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001331 | 0.000001494 | -8.905 | 9619 | 6.278e-19 | -0.0000175 | -0.000009113 |
fixed | NA | male | -0.09207 | 0.006102 | -15.09 | 9887 | 7.137e-51 | -0.1092 | -0.07494 |
fixed | NA | sibling_count3 | 0.01303 | 0.01291 | 1.009 | 7267 | 0.3129 | -0.0232 | 0.04925 |
fixed | NA | sibling_count4 | 0.0174 | 0.01305 | 1.333 | 6947 | 0.1825 | -0.01923 | 0.05403 |
fixed | NA | sibling_count5 | 0.02316 | 0.01366 | 1.695 | 6567 | 0.09009 | -0.01519 | 0.0615 |
fixed | NA | sibling_count>5 | 0.03929 | 0.01138 | 3.453 | 7970 | 0.0005576 | 0.007349 | 0.07123 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1223 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2807 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.178 | 0.06653 | 17.71 | 9941 | 3.766e-69 | 0.9917 | 1.365 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.07952 | 0.005977 | -13.3 | 9889 | 4.805e-40 | -0.09629 | -0.06274 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001839 | 0.0001681 | 10.94 | 9763 | 1.056e-27 | 0.001367 | 0.002311 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001332 | 0.000001495 | -8.914 | 9618 | 5.821e-19 | -0.00001752 | -0.000009128 |
fixed | NA | male | -0.09203 | 0.006102 | -15.08 | 9885 | 7.813e-51 | -0.1092 | -0.0749 |
fixed | NA | sibling_count3 | 0.008595 | 0.01308 | 0.657 | 7520 | 0.5112 | -0.02813 | 0.04532 |
fixed | NA | sibling_count4 | 0.01064 | 0.01338 | 0.7952 | 7404 | 0.4265 | -0.02691 | 0.04818 |
fixed | NA | sibling_count5 | 0.01522 | 0.01409 | 1.08 | 7145 | 0.2802 | -0.02434 | 0.05479 |
fixed | NA | sibling_count>5 | 0.0316 | 0.01189 | 2.658 | 8599 | 0.007882 | -0.001775 | 0.06497 |
fixed | NA | birth_order_nonlinear2 | 0.01122 | 0.008852 | 1.268 | 9164 | 0.2048 | -0.01362 | 0.03607 |
fixed | NA | birth_order_nonlinear3 | 0.02609 | 0.01028 | 2.537 | 8952 | 0.01118 | -0.002772 | 0.05495 |
fixed | NA | birth_order_nonlinear4 | 0.02517 | 0.01155 | 2.179 | 9025 | 0.02934 | -0.00725 | 0.05758 |
fixed | NA | birth_order_nonlinear5 | 0.02458 | 0.01299 | 1.892 | 9039 | 0.05854 | -0.01189 | 0.06106 |
fixed | NA | birth_order_nonlinear>5 | 0.0255 | 0.01086 | 2.347 | 10058 | 0.01895 | -0.004999 | 0.056 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.122 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2808 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 1.183 | 0.06675 | 17.73 | 9940 | 3.009e-69 | 0.996 | 1.371 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.08008 | 0.005981 | -13.39 | 9878 | 1.561e-40 | -0.09687 | -0.0633 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00185 | 0.0001682 | 11 | 9751 | 5.56e-28 | 0.001378 | 0.002322 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001336 | 0.000001495 | -8.938 | 9603 | 4.688e-19 | -0.00001756 | -0.000009168 |
fixed | NA | male | -0.09221 | 0.006105 | -15.1 | 9876 | 5.625e-51 | -0.1093 | -0.07507 |
fixed | NA | count_birth_order2/2 | 0.01891 | 0.01758 | 1.076 | 9167 | 0.2821 | -0.03044 | 0.06826 |
fixed | NA | count_birth_order1/3 | 0.001989 | 0.01717 | 0.1158 | 9928 | 0.9078 | -0.04621 | 0.05018 |
fixed | NA | count_birth_order2/3 | 0.01413 | 0.01902 | 0.7428 | 9999 | 0.4576 | -0.03925 | 0.06751 |
fixed | NA | count_birth_order3/3 | 0.06725 | 0.02087 | 3.222 | 10042 | 0.001278 | 0.008659 | 0.1258 |
fixed | NA | count_birth_order1/4 | 0.01351 | 0.01879 | 0.7191 | 9999 | 0.4721 | -0.03924 | 0.06627 |
fixed | NA | count_birth_order2/4 | 0.0194 | 0.02014 | 0.9631 | 10029 | 0.3355 | -0.03715 | 0.07595 |
fixed | NA | count_birth_order3/4 | 0.02846 | 0.02147 | 1.326 | 10055 | 0.1849 | -0.0318 | 0.08872 |
fixed | NA | count_birth_order4/4 | 0.06085 | 0.0228 | 2.67 | 10065 | 0.007608 | -0.003134 | 0.1248 |
fixed | NA | count_birth_order1/5 | 0.0184 | 0.02132 | 0.8626 | 10049 | 0.3884 | -0.04146 | 0.07826 |
fixed | NA | count_birth_order2/5 | 0.04596 | 0.02261 | 2.033 | 10061 | 0.04208 | -0.0175 | 0.1094 |
fixed | NA | count_birth_order3/5 | 0.02026 | 0.02379 | 0.8517 | 10069 | 0.3944 | -0.04652 | 0.08704 |
fixed | NA | count_birth_order4/5 | 0.0333 | 0.02499 | 1.333 | 10065 | 0.1826 | -0.03683 | 0.1034 |
fixed | NA | count_birth_order5/5 | 0.059 | 0.02499 | 2.361 | 10071 | 0.01826 | -0.01116 | 0.1291 |
fixed | NA | count_birth_order1/>5 | 0.04611 | 0.01642 | 2.809 | 10068 | 0.004985 | 0.0000257 | 0.09219 |
fixed | NA | count_birth_order2/>5 | 0.04523 | 0.01709 | 2.647 | 10071 | 0.008138 | -0.002738 | 0.0932 |
fixed | NA | count_birth_order3/>5 | 0.0602 | 0.01683 | 3.576 | 10071 | 0.0003509 | 0.01294 | 0.1075 |
fixed | NA | count_birth_order4/>5 | 0.05521 | 0.01654 | 3.338 | 10070 | 0.0008472 | 0.008781 | 0.1016 |
fixed | NA | count_birth_order5/>5 | 0.05467 | 0.01672 | 3.27 | 10071 | 0.001081 | 0.007733 | 0.1016 |
fixed | NA | count_birth_order>5/>5 | 0.06034 | 0.01362 | 4.429 | 9159 | 0.000009559 | 0.0221 | 0.09857 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1218 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2808 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4606 | 4686 | -2292 | 4584 | NA | NA | NA |
12 | 4605 | 4692 | -2291 | 4581 | 2.811 | 1 | 0.09361 |
16 | 4607 | 4722 | -2287 | 4575 | 6.69 | 4 | 0.1532 |
26 | 4616 | 4804 | -2282 | 4564 | 10.22 | 10 | 0.4212 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.442 | 0.188 | 12.99 | 3820 | 8.801e-38 | 1.914 | 2.97 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2215 | 0.02019 | -10.97 | 3818 | 1.353e-27 | -0.2782 | -0.1648 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006628 | 0.0006926 | 9.57 | 3816 | 1.861e-21 | 0.004684 | 0.008572 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006461 | 0.000007603 | -8.497 | 3815 | 2.749e-17 | -0.00008595 | -0.00004326 |
fixed | NA | male | -0.03876 | 0.009466 | -4.095 | 3775 | 0.00004316 | -0.06533 | -0.01219 |
fixed | NA | sibling_count3 | 0.02684 | 0.01573 | 1.706 | 2806 | 0.08803 | -0.01731 | 0.07099 |
fixed | NA | sibling_count4 | 0.05053 | 0.01628 | 3.105 | 2567 | 0.001926 | 0.004844 | 0.09622 |
fixed | NA | sibling_count5 | 0.05469 | 0.01812 | 3.018 | 2230 | 0.00257 | 0.00383 | 0.1055 |
fixed | NA | sibling_count>5 | 0.07393 | 0.01574 | 4.699 | 2206 | 0.000002782 | 0.02976 | 0.1181 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1072 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2701 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.445 | 0.188 | 13 | 3819 | 7.481e-38 | 1.917 | 2.972 |
fixed | NA | birth_order | 0.003024 | 0.002952 | 1.024 | 3702 | 0.3058 | -0.005263 | 0.01131 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2222 | 0.0202 | -11 | 3818 | 1.01e-27 | -0.2789 | -0.1655 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006644 | 0.0006927 | 9.591 | 3816 | 1.524e-21 | 0.0047 | 0.008589 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006465 | 0.000007603 | -8.503 | 3814 | 2.61e-17 | -0.000086 | -0.00004331 |
fixed | NA | male | -0.03886 | 0.009466 | -4.105 | 3774 | 0.00004124 | -0.06543 | -0.01229 |
fixed | NA | sibling_count3 | 0.02528 | 0.0158 | 1.6 | 2809 | 0.1098 | -0.01908 | 0.06964 |
fixed | NA | sibling_count4 | 0.04716 | 0.01661 | 2.839 | 2573 | 0.004559 | 0.0005333 | 0.09378 |
fixed | NA | sibling_count5 | 0.04914 | 0.01892 | 2.598 | 2286 | 0.009449 | -0.003963 | 0.1022 |
fixed | NA | sibling_count>5 | 0.06302 | 0.01901 | 3.315 | 2401 | 0.0009284 | 0.009665 | 0.1164 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1075 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.27 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.444 | 0.1882 | 12.99 | 3816 | 9.112e-38 | 1.916 | 2.972 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.222 | 0.0202 | -10.99 | 3813 | 1.111e-27 | -0.2787 | -0.1653 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006638 | 0.000693 | 9.578 | 3811 | 1.727e-21 | 0.004692 | 0.008583 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006456 | 0.000007608 | -8.486 | 3810 | 3.025e-17 | -0.00008592 | -0.00004321 |
fixed | NA | male | -0.03863 | 0.009467 | -4.08 | 3770 | 0.00004587 | -0.0652 | -0.01206 |
fixed | NA | sibling_count3 | 0.01909 | 0.0161 | 1.186 | 2927 | 0.2358 | -0.02611 | 0.06429 |
fixed | NA | sibling_count4 | 0.03957 | 0.01718 | 2.303 | 2784 | 0.02133 | -0.008652 | 0.0878 |
fixed | NA | sibling_count5 | 0.0444 | 0.01979 | 2.244 | 2577 | 0.0249 | -0.01114 | 0.09994 |
fixed | NA | sibling_count>5 | 0.05921 | 0.01949 | 3.038 | 2555 | 0.002407 | 0.004499 | 0.1139 |
fixed | NA | birth_order_nonlinear2 | 0.01273 | 0.01246 | 1.022 | 3150 | 0.3071 | -0.02224 | 0.04769 |
fixed | NA | birth_order_nonlinear3 | 0.03267 | 0.01466 | 2.229 | 3261 | 0.02589 | -0.008476 | 0.07382 |
fixed | NA | birth_order_nonlinear4 | 0.02027 | 0.01786 | 1.135 | 3349 | 0.2566 | -0.02988 | 0.07042 |
fixed | NA | birth_order_nonlinear5 | 0.004018 | 0.02197 | 0.1828 | 3364 | 0.8549 | -0.05766 | 0.06569 |
fixed | NA | birth_order_nonlinear>5 | 0.02633 | 0.02188 | 1.203 | 3816 | 0.2289 | -0.03509 | 0.08776 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.107 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2701 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.448 | 0.1889 | 12.96 | 3806 | 1.237e-37 | 1.918 | 2.979 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2223 | 0.02028 | -10.96 | 3804 | 1.461e-27 | -0.2793 | -0.1654 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006654 | 0.0006958 | 9.563 | 3802 | 1.98e-21 | 0.004701 | 0.008607 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006481 | 0.00000764 | -8.483 | 3801 | 3.098e-17 | -0.00008626 | -0.00004337 |
fixed | NA | male | -0.03842 | 0.00948 | -4.053 | 3760 | 0.00005165 | -0.06503 | -0.01181 |
fixed | NA | count_birth_order2/2 | 0.003413 | 0.02421 | 0.141 | 3296 | 0.8879 | -0.06454 | 0.07136 |
fixed | NA | count_birth_order1/3 | 0.0001465 | 0.02055 | 0.007127 | 3787 | 0.9943 | -0.05754 | 0.05784 |
fixed | NA | count_birth_order2/3 | 0.03307 | 0.02282 | 1.449 | 3804 | 0.1474 | -0.03099 | 0.09713 |
fixed | NA | count_birth_order3/3 | 0.07378 | 0.02468 | 2.99 | 3807 | 0.002811 | 0.004507 | 0.1431 |
fixed | NA | count_birth_order1/4 | 0.05301 | 0.0236 | 2.246 | 3800 | 0.02477 | -0.01324 | 0.1193 |
fixed | NA | count_birth_order2/4 | 0.03648 | 0.02481 | 1.47 | 3807 | 0.1416 | -0.03317 | 0.1061 |
fixed | NA | count_birth_order3/4 | 0.04578 | 0.02602 | 1.759 | 3802 | 0.07861 | -0.02726 | 0.1188 |
fixed | NA | count_birth_order4/4 | 0.07534 | 0.0276 | 2.73 | 3799 | 0.006371 | -0.002139 | 0.1528 |
fixed | NA | count_birth_order1/5 | 0.03696 | 0.03096 | 1.194 | 3807 | 0.2325 | -0.04993 | 0.1239 |
fixed | NA | count_birth_order2/5 | 0.09427 | 0.03368 | 2.799 | 3785 | 0.005157 | -0.0002813 | 0.1888 |
fixed | NA | count_birth_order3/5 | 0.05057 | 0.03156 | 1.602 | 3791 | 0.1092 | -0.03802 | 0.1391 |
fixed | NA | count_birth_order4/5 | 0.0572 | 0.0307 | 1.863 | 3789 | 0.06249 | -0.02897 | 0.1434 |
fixed | NA | count_birth_order5/5 | 0.04417 | 0.03219 | 1.372 | 3782 | 0.17 | -0.04618 | 0.1345 |
fixed | NA | count_birth_order1/>5 | 0.06705 | 0.02944 | 2.278 | 3805 | 0.02279 | -0.01558 | 0.1497 |
fixed | NA | count_birth_order2/>5 | 0.06292 | 0.0297 | 2.118 | 3789 | 0.03421 | -0.02045 | 0.1463 |
fixed | NA | count_birth_order3/>5 | 0.101 | 0.02904 | 3.479 | 3781 | 0.0005098 | 0.0195 | 0.1825 |
fixed | NA | count_birth_order4/>5 | 0.06068 | 0.0282 | 2.152 | 3770 | 0.03149 | -0.01848 | 0.1398 |
fixed | NA | count_birth_order5/>5 | 0.06101 | 0.0272 | 2.243 | 3777 | 0.02493 | -0.01533 | 0.1374 |
fixed | NA | count_birth_order>5/>5 | 0.08233 | 0.02124 | 3.876 | 3573 | 0.0001079 | 0.02271 | 0.142 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.107 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2701 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 1386 | 1455 | -682.2 | 1364 | NA | NA | NA |
12 | 1387 | 1462 | -681.6 | 1363 | 1.048 | 1 | 0.3059 |
16 | 1390 | 1490 | -679.2 | 1358 | 4.901 | 4 | 0.2976 |
26 | 1401 | 1563 | -674.3 | 1349 | 9.699 | 10 | 0.4672 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.464 | 0.1878 | 13.13 | 3846 | 1.562e-38 | 1.937 | 2.991 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2235 | 0.02018 | -11.07 | 3844 | 4.507e-28 | -0.2801 | -0.1668 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00669 | 0.0006925 | 9.661 | 3842 | 7.831e-22 | 0.004746 | 0.008633 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000652 | 0.000007604 | -8.574 | 3841 | 1.426e-17 | -0.00008654 | -0.00004385 |
fixed | NA | male | -0.03937 | 0.009461 | -4.161 | 3798 | 0.00003233 | -0.06593 | -0.01281 |
fixed | NA | sibling_count3 | 0.02618 | 0.01729 | 1.514 | 2889 | 0.13 | -0.02235 | 0.07471 |
fixed | NA | sibling_count4 | 0.0433 | 0.01744 | 2.482 | 2722 | 0.01313 | -0.005673 | 0.09226 |
fixed | NA | sibling_count5 | 0.03684 | 0.01841 | 2.001 | 2475 | 0.04545 | -0.01483 | 0.0885 |
fixed | NA | sibling_count>5 | 0.06644 | 0.01613 | 4.12 | 2570 | 0.00003915 | 0.02117 | 0.1117 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1083 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2705 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.468 | 0.1877 | 13.14 | 3845 | 1.231e-38 | 1.941 | 2.994 |
fixed | NA | birth_order | 0.004248 | 0.002612 | 1.626 | 3598 | 0.104 | -0.003085 | 0.01158 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2243 | 0.02018 | -11.11 | 3844 | 2.88e-28 | -0.281 | -0.1677 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00671 | 0.0006924 | 9.691 | 3842 | 5.88e-22 | 0.004766 | 0.008654 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006523 | 0.000007602 | -8.581 | 3840 | 1.35e-17 | -0.00008657 | -0.00004389 |
fixed | NA | male | -0.03948 | 0.009459 | -4.174 | 3797 | 0.00003061 | -0.06603 | -0.01293 |
fixed | NA | sibling_count3 | 0.02393 | 0.01734 | 1.38 | 2888 | 0.1678 | -0.02476 | 0.07261 |
fixed | NA | sibling_count4 | 0.03886 | 0.01766 | 2.201 | 2716 | 0.02784 | -0.01071 | 0.08842 |
fixed | NA | sibling_count5 | 0.02956 | 0.01894 | 1.561 | 2491 | 0.1188 | -0.02361 | 0.08273 |
fixed | NA | sibling_count>5 | 0.05138 | 0.0186 | 2.763 | 2636 | 0.005763 | -0.000815 | 0.1036 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1085 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2704 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.458 | 0.1878 | 13.09 | 3842 | 2.526e-38 | 1.931 | 2.986 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2232 | 0.02018 | -11.06 | 3839 | 5.342e-28 | -0.2798 | -0.1665 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006673 | 0.0006925 | 9.636 | 3837 | 9.933e-22 | 0.004729 | 0.008617 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006486 | 0.000007605 | -8.528 | 3836 | 2.115e-17 | -0.00008621 | -0.00004351 |
fixed | NA | male | -0.03913 | 0.009457 | -4.137 | 3792 | 0.00003588 | -0.06568 | -0.01258 |
fixed | NA | sibling_count3 | 0.01657 | 0.01763 | 0.9395 | 2980 | 0.3476 | -0.03293 | 0.06607 |
fixed | NA | sibling_count4 | 0.0298 | 0.01816 | 1.641 | 2879 | 0.101 | -0.02118 | 0.08078 |
fixed | NA | sibling_count5 | 0.02269 | 0.01975 | 1.149 | 2739 | 0.2505 | -0.03273 | 0.07812 |
fixed | NA | sibling_count>5 | 0.04598 | 0.01911 | 2.406 | 2800 | 0.01621 | -0.007671 | 0.09963 |
fixed | NA | birth_order_nonlinear2 | 0.01053 | 0.01265 | 0.8323 | 3205 | 0.4053 | -0.02497 | 0.04602 |
fixed | NA | birth_order_nonlinear3 | 0.03994 | 0.01477 | 2.705 | 3330 | 0.00687 | -0.00151 | 0.08139 |
fixed | NA | birth_order_nonlinear4 | 0.02845 | 0.01747 | 1.629 | 3422 | 0.1035 | -0.02059 | 0.07748 |
fixed | NA | birth_order_nonlinear5 | 0.009549 | 0.02128 | 0.4487 | 3438 | 0.6537 | -0.0502 | 0.0693 |
fixed | NA | birth_order_nonlinear>5 | 0.03222 | 0.01982 | 1.625 | 3824 | 0.1042 | -0.02343 | 0.08787 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1088 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2702 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.444 | 0.1881 | 12.99 | 3832 | 8.715e-38 | 1.916 | 2.972 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2221 | 0.02022 | -10.99 | 3831 | 1.132e-27 | -0.2789 | -0.1654 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00664 | 0.0006938 | 9.571 | 3829 | 1.845e-21 | 0.004693 | 0.008588 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006454 | 0.000007622 | -8.468 | 3829 | 3.5e-17 | -0.00008594 | -0.00004315 |
fixed | NA | male | -0.03836 | 0.009465 | -4.052 | 3785 | 0.0000517 | -0.06492 | -0.01179 |
fixed | NA | count_birth_order2/2 | 0.02215 | 0.02669 | 0.83 | 3435 | 0.4066 | -0.05277 | 0.09708 |
fixed | NA | count_birth_order1/3 | 0.00529 | 0.02274 | 0.2326 | 3813 | 0.8161 | -0.05855 | 0.06913 |
fixed | NA | count_birth_order2/3 | 0.02414 | 0.02474 | 0.9755 | 3829 | 0.3294 | -0.04532 | 0.09359 |
fixed | NA | count_birth_order3/3 | 0.09777 | 0.0272 | 3.594 | 3833 | 0.0003298 | 0.02141 | 0.1741 |
fixed | NA | count_birth_order1/4 | 0.05529 | 0.02473 | 2.236 | 3822 | 0.0254 | -0.01412 | 0.1247 |
fixed | NA | count_birth_order2/4 | 0.01373 | 0.0258 | 0.5321 | 3832 | 0.5947 | -0.0587 | 0.08616 |
fixed | NA | count_birth_order3/4 | 0.06335 | 0.02821 | 2.246 | 3829 | 0.02477 | -0.01583 | 0.1425 |
fixed | NA | count_birth_order4/4 | 0.08211 | 0.03012 | 2.727 | 3825 | 0.006428 | -0.002422 | 0.1666 |
fixed | NA | count_birth_order1/5 | 0.001284 | 0.02964 | 0.04333 | 3833 | 0.9654 | -0.08192 | 0.08449 |
fixed | NA | count_birth_order2/5 | 0.08761 | 0.03079 | 2.845 | 3830 | 0.004462 | 0.001176 | 0.1741 |
fixed | NA | count_birth_order3/5 | 0.05313 | 0.03135 | 1.695 | 3822 | 0.09017 | -0.03486 | 0.1411 |
fixed | NA | count_birth_order4/5 | 0.05656 | 0.03187 | 1.775 | 3812 | 0.07603 | -0.0329 | 0.146 |
fixed | NA | count_birth_order5/5 | 0.02284 | 0.03211 | 0.7115 | 3811 | 0.4768 | -0.06728 | 0.113 |
fixed | NA | count_birth_order1/>5 | 0.07247 | 0.0268 | 2.704 | 3831 | 0.006889 | -0.002771 | 0.1477 |
fixed | NA | count_birth_order2/>5 | 0.06204 | 0.02833 | 2.19 | 3822 | 0.02862 | -0.0175 | 0.1416 |
fixed | NA | count_birth_order3/>5 | 0.07122 | 0.02729 | 2.61 | 3822 | 0.009099 | -0.005387 | 0.1478 |
fixed | NA | count_birth_order4/>5 | 0.06325 | 0.02662 | 2.376 | 3817 | 0.01754 | -0.01147 | 0.138 |
fixed | NA | count_birth_order5/>5 | 0.06806 | 0.02816 | 2.417 | 3800 | 0.01568 | -0.01097 | 0.1471 |
fixed | NA | count_birth_order>5/>5 | 0.08184 | 0.02129 | 3.844 | 3621 | 0.0001233 | 0.02207 | 0.1416 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1072 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2705 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 1418 | 1487 | -697.9 | 1396 | NA | NA | NA |
12 | 1417 | 1492 | -696.5 | 1393 | 2.648 | 1 | 0.1037 |
16 | 1419 | 1519 | -693.4 | 1387 | 6.263 | 4 | 0.1804 |
26 | 1422 | 1585 | -685 | 1370 | 16.78 | 10 | 0.07945 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.439 | 0.1895 | 12.87 | 3753 | 3.812e-37 | 1.907 | 2.971 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2205 | 0.02038 | -10.82 | 3751 | 6.611e-27 | -0.2777 | -0.1633 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006576 | 0.0006996 | 9.4 | 3749 | 9.213e-21 | 0.004613 | 0.00854 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006393 | 0.00000769 | -8.314 | 3749 | 1.276e-16 | -0.00008552 | -0.00004235 |
fixed | NA | male | -0.03783 | 0.009531 | -3.97 | 3710 | 0.00007337 | -0.06459 | -0.01108 |
fixed | NA | sibling_count3 | 0.02853 | 0.01537 | 1.857 | 2784 | 0.06348 | -0.01461 | 0.07167 |
fixed | NA | sibling_count4 | 0.04803 | 0.01613 | 2.978 | 2538 | 0.002924 | 0.002765 | 0.0933 |
fixed | NA | sibling_count5 | 0.06003 | 0.01844 | 3.255 | 2121 | 0.001151 | 0.008265 | 0.1118 |
fixed | NA | sibling_count>5 | 0.07782 | 0.01576 | 4.938 | 2115 | 0.0000008509 | 0.03358 | 0.122 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1061 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2697 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.442 | 0.1895 | 12.89 | 3752 | 3.213e-37 | 1.91 | 2.974 |
fixed | NA | birth_order | 0.002716 | 0.003029 | 0.8965 | 3658 | 0.37 | -0.005788 | 0.01122 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2212 | 0.02039 | -10.85 | 3751 | 5.051e-27 | -0.2784 | -0.164 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006594 | 0.0006999 | 9.421 | 3749 | 7.577e-21 | 0.004629 | 0.008559 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006401 | 0.00000769 | -8.323 | 3748 | 1.187e-16 | -0.00008559 | -0.00004242 |
fixed | NA | male | -0.03786 | 0.009531 | -3.972 | 3709 | 0.00007249 | -0.06461 | -0.01111 |
fixed | NA | sibling_count3 | 0.0271 | 0.01545 | 1.754 | 2785 | 0.07958 | -0.01628 | 0.07048 |
fixed | NA | sibling_count4 | 0.04504 | 0.01647 | 2.735 | 2549 | 0.006286 | -0.00119 | 0.09127 |
fixed | NA | sibling_count5 | 0.05519 | 0.01922 | 2.871 | 2171 | 0.00413 | 0.001232 | 0.1092 |
fixed | NA | sibling_count>5 | 0.06803 | 0.01917 | 3.548 | 2363 | 0.0003953 | 0.01421 | 0.1219 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1063 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2697 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.443 | 0.1897 | 12.88 | 3748 | 3.528e-37 | 1.911 | 2.975 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2215 | 0.02039 | -10.86 | 3747 | 4.502e-27 | -0.2787 | -0.1642 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006599 | 0.0007002 | 9.425 | 3745 | 7.293e-21 | 0.004634 | 0.008565 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006404 | 0.000007695 | -8.322 | 3744 | 1.202e-16 | -0.00008564 | -0.00004244 |
fixed | NA | male | -0.03763 | 0.009533 | -3.948 | 3706 | 0.00008039 | -0.06439 | -0.01087 |
fixed | NA | sibling_count3 | 0.02229 | 0.01576 | 1.415 | 2903 | 0.1573 | -0.02194 | 0.06653 |
fixed | NA | sibling_count4 | 0.03807 | 0.01704 | 2.234 | 2756 | 0.02555 | -0.009763 | 0.0859 |
fixed | NA | sibling_count5 | 0.05204 | 0.02004 | 2.598 | 2436 | 0.009446 | -0.004197 | 0.1083 |
fixed | NA | sibling_count>5 | 0.06606 | 0.01968 | 3.356 | 2524 | 0.0008029 | 0.0108 | 0.1213 |
fixed | NA | birth_order_nonlinear2 | 0.01948 | 0.01238 | 1.573 | 3092 | 0.1157 | -0.01527 | 0.05423 |
fixed | NA | birth_order_nonlinear3 | 0.027 | 0.01465 | 1.843 | 3206 | 0.06546 | -0.01413 | 0.06812 |
fixed | NA | birth_order_nonlinear4 | 0.02471 | 0.01837 | 1.345 | 3298 | 0.1786 | -0.02685 | 0.07627 |
fixed | NA | birth_order_nonlinear5 | 0.001399 | 0.02263 | 0.06181 | 3271 | 0.9507 | -0.06212 | 0.06491 |
fixed | NA | birth_order_nonlinear>5 | 0.02411 | 0.02252 | 1.071 | 3749 | 0.2843 | -0.03909 | 0.08732 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1055 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2699 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 2.451 | 0.1904 | 12.87 | 3739 | 3.825e-37 | 1.916 | 2.985 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.2225 | 0.02047 | -10.87 | 3738 | 4.073e-27 | -0.28 | -0.1651 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.006642 | 0.0007031 | 9.448 | 3736 | 5.925e-21 | 0.004669 | 0.008616 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00006459 | 0.000007729 | -8.357 | 3736 | 8.95e-17 | -0.00008629 | -0.0000429 |
fixed | NA | male | -0.03784 | 0.009553 | -3.961 | 3697 | 0.00007597 | -0.06466 | -0.01103 |
fixed | NA | count_birth_order2/2 | 0.01989 | 0.0235 | 0.8465 | 3208 | 0.3973 | -0.04606 | 0.08584 |
fixed | NA | count_birth_order1/3 | 0.008942 | 0.02016 | 0.4434 | 3721 | 0.6575 | -0.04766 | 0.06554 |
fixed | NA | count_birth_order2/3 | 0.04507 | 0.02242 | 2.01 | 3738 | 0.04446 | -0.01786 | 0.108 |
fixed | NA | count_birth_order3/3 | 0.07044 | 0.024 | 2.935 | 3738 | 0.003353 | 0.003077 | 0.1378 |
fixed | NA | count_birth_order1/4 | 0.05241 | 0.02364 | 2.217 | 3735 | 0.0267 | -0.01396 | 0.1188 |
fixed | NA | count_birth_order2/4 | 0.04846 | 0.0247 | 1.962 | 3739 | 0.04989 | -0.02089 | 0.1178 |
fixed | NA | count_birth_order3/4 | 0.04797 | 0.02589 | 1.852 | 3734 | 0.06404 | -0.02472 | 0.1207 |
fixed | NA | count_birth_order4/4 | 0.07353 | 0.02793 | 2.633 | 3730 | 0.008497 | -0.004858 | 0.1519 |
fixed | NA | count_birth_order1/5 | 0.05752 | 0.03092 | 1.86 | 3739 | 0.06296 | -0.02928 | 0.1443 |
fixed | NA | count_birth_order2/5 | 0.07077 | 0.0347 | 2.04 | 3712 | 0.04146 | -0.02663 | 0.1682 |
fixed | NA | count_birth_order3/5 | 0.05268 | 0.03324 | 1.585 | 3715 | 0.1131 | -0.04062 | 0.146 |
fixed | NA | count_birth_order4/5 | 0.07725 | 0.03206 | 2.41 | 3719 | 0.01601 | -0.01274 | 0.1672 |
fixed | NA | count_birth_order5/5 | 0.07412 | 0.03375 | 2.196 | 3713 | 0.02812 | -0.02061 | 0.1688 |
fixed | NA | count_birth_order1/>5 | 0.07883 | 0.03014 | 2.616 | 3737 | 0.008934 | -0.005758 | 0.1634 |
fixed | NA | count_birth_order2/>5 | 0.09488 | 0.03051 | 3.11 | 3720 | 0.001888 | 0.009231 | 0.1805 |
fixed | NA | count_birth_order3/>5 | 0.1004 | 0.02921 | 3.436 | 3718 | 0.0005975 | 0.01836 | 0.1824 |
fixed | NA | count_birth_order4/>5 | 0.07875 | 0.02906 | 2.71 | 3698 | 0.006766 | -0.002829 | 0.1603 |
fixed | NA | count_birth_order5/>5 | 0.05546 | 0.0275 | 2.017 | 3709 | 0.04379 | -0.02173 | 0.1327 |
fixed | NA | count_birth_order>5/>5 | 0.09005 | 0.02148 | 4.192 | 3478 | 0.00002835 | 0.02975 | 0.1504 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1046 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2704 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 1344 | 1413 | -661 | 1322 | NA | NA | NA |
12 | 1345 | 1420 | -660.6 | 1321 | 0.8029 | 1 | 0.3702 |
16 | 1348 | 1448 | -658.2 | 1316 | 4.708 | 4 | 0.3186 |
26 | 1362 | 1524 | -655.2 | 1310 | 6.094 | 10 | 0.8073 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Sector_Agriculture, forestry, fishing and hunting`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1306 | 0.0897 | 1.456 | 9664 | 0.1455 | -0.1212 | 0.3824 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0008862 | 0.008036 | -0.1103 | 9640 | 0.9122 | -0.02344 | 0.02167 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001282 | 0.0002255 | 0.5685 | 9572 | 0.5697 | -0.0005048 | 0.0007612 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001381 | 0.000002002 | -0.6899 | 9480 | 0.4903 | -0.000007 | 0.000004238 |
fixed | NA | male | 0.02977 | 0.008213 | 3.624 | 9475 | 0.0002912 | 0.006712 | 0.05282 |
fixed | NA | sibling_count3 | 0.00264 | 0.01767 | 0.1494 | 7173 | 0.8813 | -0.04697 | 0.05225 |
fixed | NA | sibling_count4 | 0.0012 | 0.01789 | 0.06708 | 6867 | 0.9465 | -0.04901 | 0.05141 |
fixed | NA | sibling_count5 | 0.00142 | 0.01864 | 0.07615 | 6516 | 0.9393 | -0.05092 | 0.05376 |
fixed | NA | sibling_count>5 | 0.01776 | 0.01442 | 1.232 | 7097 | 0.2182 | -0.02273 | 0.05825 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1829 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3648 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1302 | 0.0897 | 1.451 | 9662 | 0.1468 | -0.1216 | 0.3819 |
fixed | NA | birth_order | 0.001497 | 0.001692 | 0.8848 | 9436 | 0.3763 | -0.003252 | 0.006245 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001315 | 0.008051 | -0.1634 | 9633 | 0.8702 | -0.02391 | 0.02128 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001445 | 0.0002262 | 0.6385 | 9544 | 0.5231 | -0.0004906 | 0.0007795 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000153 | 0.000002009 | -0.7617 | 9437 | 0.4462 | -0.000007169 | 0.000004109 |
fixed | NA | male | 0.02974 | 0.008213 | 3.621 | 9475 | 0.0002953 | 0.006683 | 0.05279 |
fixed | NA | sibling_count3 | 0.0023 | 0.01768 | 0.1301 | 7182 | 0.8965 | -0.04732 | 0.05192 |
fixed | NA | sibling_count4 | 0.0003682 | 0.01791 | 0.02055 | 6909 | 0.9836 | -0.04991 | 0.05065 |
fixed | NA | sibling_count5 | -0.00009096 | 0.01872 | -0.004859 | 6600 | 0.9961 | -0.05264 | 0.05246 |
fixed | NA | sibling_count>5 | 0.01263 | 0.01555 | 0.812 | 7848 | 0.4168 | -0.03102 | 0.05627 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1827 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3649 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1386 | 0.08983 | 1.543 | 9663 | 0.1228 | -0.1135 | 0.3908 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.001996 | 0.008057 | -0.2477 | 9634 | 0.8044 | -0.02461 | 0.02062 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001671 | 0.0002264 | 0.7384 | 9546 | 0.4603 | -0.0004682 | 0.0008025 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001733 | 0.00000201 | -0.8621 | 9437 | 0.3887 | -0.000007374 | 0.000003909 |
fixed | NA | male | 0.02977 | 0.008214 | 3.624 | 9471 | 0.0002917 | 0.00671 | 0.05283 |
fixed | NA | sibling_count3 | 0.002077 | 0.01791 | 0.116 | 7398 | 0.9076 | -0.04819 | 0.05234 |
fixed | NA | sibling_count4 | -0.003051 | 0.01834 | -0.1663 | 7312 | 0.8679 | -0.05454 | 0.04844 |
fixed | NA | sibling_count5 | -0.00412 | 0.01928 | -0.2137 | 7101 | 0.8308 | -0.05824 | 0.05 |
fixed | NA | sibling_count>5 | 0.004782 | 0.01621 | 0.295 | 8382 | 0.768 | -0.04073 | 0.05029 |
fixed | NA | birth_order_nonlinear2 | -0.004716 | 0.01189 | -0.3967 | 8886 | 0.6916 | -0.03809 | 0.02866 |
fixed | NA | birth_order_nonlinear3 | 0.003489 | 0.01378 | 0.2532 | 8648 | 0.8001 | -0.03519 | 0.04217 |
fixed | NA | birth_order_nonlinear4 | 0.02163 | 0.0155 | 1.396 | 8674 | 0.1628 | -0.02188 | 0.06514 |
fixed | NA | birth_order_nonlinear5 | 0.0108 | 0.01742 | 0.6202 | 8681 | 0.5351 | -0.03809 | 0.05969 |
fixed | NA | birth_order_nonlinear>5 | 0.02094 | 0.01463 | 1.431 | 9684 | 0.1524 | -0.02013 | 0.06202 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1826 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3649 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1623 | 0.09007 | 1.802 | 9660 | 0.07158 | -0.09052 | 0.4151 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.00313 | 0.008058 | -0.3884 | 9626 | 0.6977 | -0.02575 | 0.01949 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001942 | 0.0002263 | 0.8581 | 9537 | 0.3909 | -0.0004411 | 0.0008295 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001913 | 0.000002009 | -0.9523 | 9426 | 0.341 | -0.000007553 | 0.000003726 |
fixed | NA | male | 0.02973 | 0.00821 | 3.622 | 9459 | 0.0002944 | 0.006687 | 0.05278 |
fixed | NA | count_birth_order2/2 | -0.03256 | 0.02366 | -1.376 | 8968 | 0.1687 | -0.09897 | 0.03385 |
fixed | NA | count_birth_order1/3 | -0.02768 | 0.02327 | -1.19 | 9551 | 0.2342 | -0.093 | 0.03764 |
fixed | NA | count_birth_order2/3 | -0.02653 | 0.02583 | -1.027 | 9645 | 0.3044 | -0.09905 | 0.04598 |
fixed | NA | count_birth_order3/3 | 0.05159 | 0.02831 | 1.822 | 9700 | 0.06848 | -0.02789 | 0.1311 |
fixed | NA | count_birth_order1/4 | -0.02445 | 0.02556 | -0.9567 | 9644 | 0.3388 | -0.09619 | 0.04729 |
fixed | NA | count_birth_order2/4 | -0.04134 | 0.02739 | -1.509 | 9682 | 0.1312 | -0.1182 | 0.03554 |
fixed | NA | count_birth_order3/4 | 0.03614 | 0.02885 | 1.253 | 9710 | 0.2103 | -0.04483 | 0.1171 |
fixed | NA | count_birth_order4/4 | 0.007561 | 0.03102 | 0.2438 | 9727 | 0.8074 | -0.07951 | 0.09463 |
fixed | NA | count_birth_order1/5 | -0.01458 | 0.02876 | -0.507 | 9703 | 0.6122 | -0.09532 | 0.06616 |
fixed | NA | count_birth_order2/5 | -0.001386 | 0.03052 | -0.04544 | 9717 | 0.9638 | -0.08704 | 0.08427 |
fixed | NA | count_birth_order3/5 | -0.04137 | 0.03206 | -1.29 | 9729 | 0.197 | -0.1314 | 0.04864 |
fixed | NA | count_birth_order4/5 | 0.04476 | 0.03378 | 1.325 | 9718 | 0.1852 | -0.05006 | 0.1396 |
fixed | NA | count_birth_order5/5 | -0.02623 | 0.03388 | -0.7743 | 9728 | 0.4388 | -0.1213 | 0.06888 |
fixed | NA | count_birth_order1/>5 | 0.006506 | 0.02222 | 0.2929 | 9726 | 0.7696 | -0.05585 | 0.06887 |
fixed | NA | count_birth_order2/>5 | 0.02085 | 0.02307 | 0.9039 | 9730 | 0.3661 | -0.0439 | 0.0856 |
fixed | NA | count_birth_order3/>5 | -0.04021 | 0.02283 | -1.761 | 9730 | 0.07819 | -0.1043 | 0.02387 |
fixed | NA | count_birth_order4/>5 | 0.007129 | 0.02239 | 0.3185 | 9729 | 0.7501 | -0.05571 | 0.06997 |
fixed | NA | count_birth_order5/>5 | 0.01262 | 0.02261 | 0.5581 | 9730 | 0.5768 | -0.05085 | 0.07609 |
fixed | NA | count_birth_order>5/>5 | 0.01603 | 0.01858 | 0.8625 | 8912 | 0.3885 | -0.03613 | 0.06818 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1828 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3644 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 9969 | 10049 | -4974 | 9947 | NA | NA | NA |
12 | 9971 | 10057 | -4973 | 9947 | 0.7849 | 1 | 0.3756 |
16 | 9975 | 10090 | -4972 | 9943 | 3.619 | 4 | 0.4601 |
26 | 9966 | 10153 | -4957 | 9914 | 28.92 | 10 | 0.001283 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2048 | 0.2492 | 0.8218 | 3657 | 0.4112 | -0.4947 | 0.9043 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.006416 | 0.02672 | -0.2401 | 3652 | 0.8102 | -0.08142 | 0.06859 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002029 | 0.0009152 | 0.2217 | 3647 | 0.8246 | -0.002366 | 0.002772 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000112 | 0.00001003 | -0.1116 | 3645 | 0.9111 | -0.00002928 | 0.00002704 |
fixed | NA | male | 0.01815 | 0.01255 | 1.446 | 3607 | 0.1482 | -0.01708 | 0.05338 |
fixed | NA | sibling_count3 | -0.01727 | 0.02117 | -0.8156 | 2932 | 0.4148 | -0.07668 | 0.04215 |
fixed | NA | sibling_count4 | -0.006193 | 0.02193 | -0.2825 | 2756 | 0.7776 | -0.06774 | 0.05536 |
fixed | NA | sibling_count5 | 0.005548 | 0.02456 | 0.2259 | 2497 | 0.8213 | -0.06339 | 0.07449 |
fixed | NA | sibling_count>5 | 0.01615 | 0.02122 | 0.7613 | 2490 | 0.4466 | -0.0434 | 0.07571 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1644 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3417 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2093 | 0.2493 | 0.8396 | 3657 | 0.4012 | -0.4904 | 0.909 |
fixed | NA | birth_order | 0.003167 | 0.003924 | 0.8071 | 3633 | 0.4197 | -0.007847 | 0.01418 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.007299 | 0.02674 | -0.2729 | 3653 | 0.7849 | -0.08237 | 0.06777 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002263 | 0.0009157 | 0.2472 | 3649 | 0.8048 | -0.002344 | 0.002797 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001234 | 0.00001003 | -0.123 | 3645 | 0.9021 | -0.0000294 | 0.00002693 |
fixed | NA | male | 0.01803 | 0.01255 | 1.437 | 3606 | 0.1509 | -0.0172 | 0.05326 |
fixed | NA | sibling_count3 | -0.01886 | 0.02126 | -0.8871 | 2935 | 0.3751 | -0.07854 | 0.04082 |
fixed | NA | sibling_count4 | -0.009734 | 0.02236 | -0.4353 | 2762 | 0.6634 | -0.07251 | 0.05304 |
fixed | NA | sibling_count5 | -0.00025 | 0.02559 | -0.009769 | 2546 | 0.9922 | -0.07208 | 0.07158 |
fixed | NA | sibling_count>5 | 0.004629 | 0.02557 | 0.181 | 2664 | 0.8564 | -0.06715 | 0.07641 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1644 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3417 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2063 | 0.2494 | 0.8274 | 3653 | 0.4081 | -0.4936 | 0.9063 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.007303 | 0.02673 | -0.2732 | 3648 | 0.7847 | -0.08234 | 0.06773 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002221 | 0.0009154 | 0.2426 | 3643 | 0.8083 | -0.002347 | 0.002792 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001135 | 0.00001003 | -0.1131 | 3640 | 0.91 | -0.0000293 | 0.00002703 |
fixed | NA | male | 0.01846 | 0.01255 | 1.471 | 3602 | 0.1413 | -0.01676 | 0.05369 |
fixed | NA | sibling_count3 | -0.02808 | 0.02162 | -1.299 | 3024 | 0.1941 | -0.08877 | 0.03261 |
fixed | NA | sibling_count4 | -0.02 | 0.02309 | -0.8659 | 2927 | 0.3866 | -0.08482 | 0.04483 |
fixed | NA | sibling_count5 | -0.004471 | 0.02665 | -0.1678 | 2779 | 0.8668 | -0.07929 | 0.07035 |
fixed | NA | sibling_count>5 | -0.002136 | 0.02617 | -0.08163 | 2795 | 0.9349 | -0.07559 | 0.07131 |
fixed | NA | birth_order_nonlinear2 | 0.02484 | 0.01643 | 1.512 | 3174 | 0.1308 | -0.02129 | 0.07097 |
fixed | NA | birth_order_nonlinear3 | 0.04716 | 0.01931 | 2.443 | 3215 | 0.01463 | -0.007032 | 0.1014 |
fixed | NA | birth_order_nonlinear4 | 0.02073 | 0.02359 | 0.8784 | 3261 | 0.3798 | -0.0455 | 0.08696 |
fixed | NA | birth_order_nonlinear5 | -0.005032 | 0.02894 | -0.1739 | 3254 | 0.862 | -0.08627 | 0.07621 |
fixed | NA | birth_order_nonlinear>5 | 0.04153 | 0.02893 | 1.435 | 3654 | 0.1513 | -0.03969 | 0.1227 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.164 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3417 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1737 | 0.2502 | 0.6943 | 3645 | 0.4875 | -0.5286 | 0.8761 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003514 | 0.02683 | -0.131 | 3640 | 0.8958 | -0.07882 | 0.07179 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00007322 | 0.000919 | 0.07967 | 3637 | 0.9365 | -0.002506 | 0.002653 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006975 | 0.00001008 | 0.06922 | 3635 | 0.9448 | -0.00002758 | 0.00002898 |
fixed | NA | male | 0.01881 | 0.01256 | 1.498 | 3595 | 0.1343 | -0.01644 | 0.05407 |
fixed | NA | count_birth_order2/2 | 0.03164 | 0.03213 | 0.9849 | 3281 | 0.3247 | -0.05854 | 0.1218 |
fixed | NA | count_birth_order1/3 | -0.007422 | 0.02734 | -0.2715 | 3628 | 0.7861 | -0.08417 | 0.06932 |
fixed | NA | count_birth_order2/3 | -0.0317 | 0.03035 | -1.045 | 3646 | 0.2962 | -0.1169 | 0.05348 |
fixed | NA | count_birth_order3/3 | 0.0254 | 0.03301 | 0.7693 | 3650 | 0.4417 | -0.06727 | 0.1181 |
fixed | NA | count_birth_order1/4 | -0.0155 | 0.03133 | -0.4946 | 3644 | 0.6209 | -0.1034 | 0.07244 |
fixed | NA | count_birth_order2/4 | 0.009061 | 0.03316 | 0.2732 | 3650 | 0.7847 | -0.08402 | 0.1021 |
fixed | NA | count_birth_order3/4 | 0.05157 | 0.03435 | 1.501 | 3646 | 0.1334 | -0.04485 | 0.148 |
fixed | NA | count_birth_order4/4 | -0.02999 | 0.03675 | -0.8159 | 3641 | 0.4146 | -0.1331 | 0.07318 |
fixed | NA | count_birth_order1/5 | -0.007561 | 0.0412 | -0.1835 | 3650 | 0.8544 | -0.1232 | 0.1081 |
fixed | NA | count_birth_order2/5 | -0.0012 | 0.04434 | -0.02707 | 3629 | 0.9784 | -0.1257 | 0.1233 |
fixed | NA | count_birth_order3/5 | 0.04731 | 0.04215 | 1.123 | 3631 | 0.2617 | -0.07099 | 0.1656 |
fixed | NA | count_birth_order4/5 | 0.05736 | 0.0411 | 1.396 | 3628 | 0.1629 | -0.05802 | 0.1727 |
fixed | NA | count_birth_order5/5 | -0.02381 | 0.04323 | -0.5508 | 3619 | 0.5818 | -0.1452 | 0.09754 |
fixed | NA | count_birth_order1/>5 | -0.0458 | 0.03899 | -1.175 | 3642 | 0.2403 | -0.1552 | 0.06365 |
fixed | NA | count_birth_order2/>5 | 0.09322 | 0.03922 | 2.377 | 3618 | 0.01752 | -0.01688 | 0.2033 |
fixed | NA | count_birth_order3/>5 | 0.01043 | 0.03826 | 0.2726 | 3617 | 0.7851 | -0.09698 | 0.1178 |
fixed | NA | count_birth_order4/>5 | 0.02492 | 0.03743 | 0.6657 | 3604 | 0.5056 | -0.08015 | 0.13 |
fixed | NA | count_birth_order5/>5 | 0.005131 | 0.03579 | 0.1434 | 3618 | 0.886 | -0.09534 | 0.1056 |
fixed | NA | count_birth_order>5/>5 | 0.0424 | 0.02827 | 1.5 | 3520 | 0.1338 | -0.03697 | 0.1218 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1621 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3422 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3263 | 3332 | -1621 | 3241 | NA | NA | NA |
12 | 3265 | 3339 | -1620 | 3241 | 0.6535 | 1 | 0.4189 |
16 | 3265 | 3364 | -1616 | 3233 | 7.902 | 4 | 0.09525 |
26 | 3271 | 3432 | -1609 | 3219 | 14.38 | 10 | 0.1564 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2 | 0.248 | 0.8065 | 3681 | 0.42 | -0.4961 | 0.8961 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.005978 | 0.02661 | -0.2246 | 3676 | 0.8223 | -0.08068 | 0.06873 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001901 | 0.0009118 | 0.2085 | 3672 | 0.8349 | -0.002369 | 0.002749 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000009767 | 0.000009998 | -0.09769 | 3670 | 0.9222 | -0.00002904 | 0.00002709 |
fixed | NA | male | 0.01874 | 0.0125 | 1.499 | 3631 | 0.134 | -0.01635 | 0.05383 |
fixed | NA | sibling_count3 | -0.02278 | 0.02317 | -0.9834 | 3000 | 0.3255 | -0.08781 | 0.04225 |
fixed | NA | sibling_count4 | -0.004367 | 0.02342 | -0.1865 | 2881 | 0.8521 | -0.07011 | 0.06138 |
fixed | NA | sibling_count5 | 0.004279 | 0.02475 | 0.1729 | 2716 | 0.8627 | -0.06519 | 0.07375 |
fixed | NA | sibling_count>5 | 0.009765 | 0.02168 | 0.4505 | 2770 | 0.6524 | -0.05108 | 0.07061 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1641 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3415 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.2047 | 0.248 | 0.8255 | 3681 | 0.4092 | -0.4915 | 0.9009 |
fixed | NA | birth_order | 0.003732 | 0.00347 | 1.076 | 3595 | 0.2822 | -0.006008 | 0.01347 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.006952 | 0.02663 | -0.2611 | 3677 | 0.794 | -0.0817 | 0.0678 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002152 | 0.0009121 | 0.236 | 3673 | 0.8134 | -0.002345 | 0.002775 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000108 | 0.000009998 | -0.108 | 3670 | 0.914 | -0.00002914 | 0.00002699 |
fixed | NA | male | 0.0186 | 0.0125 | 1.488 | 3631 | 0.1369 | -0.01649 | 0.05369 |
fixed | NA | sibling_count3 | -0.0247 | 0.02323 | -1.063 | 2999 | 0.2879 | -0.08991 | 0.04052 |
fixed | NA | sibling_count4 | -0.008205 | 0.02369 | -0.3464 | 2875 | 0.7291 | -0.0747 | 0.05829 |
fixed | NA | sibling_count5 | -0.002088 | 0.02545 | -0.08207 | 2728 | 0.9346 | -0.07351 | 0.06934 |
fixed | NA | sibling_count>5 | -0.003568 | 0.02497 | -0.1429 | 2834 | 0.8864 | -0.07366 | 0.06653 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1639 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3416 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.196 | 0.2482 | 0.7895 | 3677 | 0.4298 | -0.5007 | 0.8927 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.006367 | 0.02663 | -0.2391 | 3672 | 0.811 | -0.08112 | 0.06838 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001927 | 0.0009122 | 0.2113 | 3668 | 0.8327 | -0.002368 | 0.002753 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008051 | 0.00001 | -0.0805 | 3666 | 0.9358 | -0.00002888 | 0.00002727 |
fixed | NA | male | 0.01888 | 0.0125 | 1.51 | 3627 | 0.131 | -0.01621 | 0.05397 |
fixed | NA | sibling_count3 | -0.03091 | 0.02358 | -1.311 | 3070 | 0.19 | -0.09711 | 0.03528 |
fixed | NA | sibling_count4 | -0.01824 | 0.02432 | -0.7502 | 2998 | 0.4532 | -0.0865 | 0.05002 |
fixed | NA | sibling_count5 | -0.008351 | 0.02645 | -0.3157 | 2922 | 0.7522 | -0.0826 | 0.0659 |
fixed | NA | sibling_count>5 | -0.00879 | 0.02563 | -0.343 | 2966 | 0.7316 | -0.08072 | 0.06314 |
fixed | NA | birth_order_nonlinear2 | 0.02643 | 0.01663 | 1.589 | 3225 | 0.1121 | -0.02025 | 0.07311 |
fixed | NA | birth_order_nonlinear3 | 0.03556 | 0.01942 | 1.831 | 3283 | 0.06718 | -0.01895 | 0.09008 |
fixed | NA | birth_order_nonlinear4 | 0.04224 | 0.02305 | 1.833 | 3350 | 0.06695 | -0.02246 | 0.1069 |
fixed | NA | birth_order_nonlinear5 | 0.00225 | 0.02807 | 0.08016 | 3328 | 0.9361 | -0.07653 | 0.08103 |
fixed | NA | birth_order_nonlinear>5 | 0.03512 | 0.02623 | 1.339 | 3683 | 0.1806 | -0.0385 | 0.1087 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1636 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3417 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1632 | 0.2485 | 0.6567 | 3669 | 0.5114 | -0.5344 | 0.8609 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.002079 | 0.02667 | -0.07794 | 3665 | 0.9379 | -0.07695 | 0.07279 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001812 | 0.000914 | 0.01983 | 3662 | 0.9842 | -0.002548 | 0.002584 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000001353 | 0.00001002 | 0.135 | 3660 | 0.8926 | -0.00002679 | 0.00002949 |
fixed | NA | male | 0.01964 | 0.01251 | 1.57 | 3619 | 0.1165 | -0.01547 | 0.05475 |
fixed | NA | count_birth_order2/2 | 0.02775 | 0.03526 | 0.7871 | 3393 | 0.4313 | -0.07122 | 0.1267 |
fixed | NA | count_birth_order1/3 | -0.01368 | 0.03019 | -0.453 | 3652 | 0.6506 | -0.09843 | 0.07108 |
fixed | NA | count_birth_order2/3 | -0.02855 | 0.03284 | -0.8694 | 3669 | 0.3847 | -0.1207 | 0.06364 |
fixed | NA | count_birth_order3/3 | 0.007524 | 0.03635 | 0.207 | 3674 | 0.836 | -0.09451 | 0.1096 |
fixed | NA | count_birth_order1/4 | -0.02249 | 0.03274 | -0.6868 | 3664 | 0.4923 | -0.1144 | 0.06942 |
fixed | NA | count_birth_order2/4 | -0.01115 | 0.03446 | -0.3235 | 3673 | 0.7463 | -0.1079 | 0.08557 |
fixed | NA | count_birth_order3/4 | 0.08672 | 0.03724 | 2.328 | 3671 | 0.01994 | -0.01782 | 0.1913 |
fixed | NA | count_birth_order4/4 | -0.01743 | 0.04042 | -0.4312 | 3664 | 0.6663 | -0.1309 | 0.09603 |
fixed | NA | count_birth_order1/5 | 0.01313 | 0.03952 | 0.3322 | 3674 | 0.7397 | -0.09781 | 0.1241 |
fixed | NA | count_birth_order2/5 | 0.02348 | 0.04048 | 0.58 | 3672 | 0.562 | -0.09014 | 0.1371 |
fixed | NA | count_birth_order3/5 | 0.01464 | 0.0416 | 0.3519 | 3662 | 0.7249 | -0.1021 | 0.1314 |
fixed | NA | count_birth_order4/5 | 0.04861 | 0.04232 | 1.149 | 3654 | 0.2508 | -0.07019 | 0.1674 |
fixed | NA | count_birth_order5/5 | -0.036 | 0.04295 | -0.8381 | 3648 | 0.402 | -0.1566 | 0.08458 |
fixed | NA | count_birth_order1/>5 | -0.04299 | 0.03567 | -1.205 | 3674 | 0.2282 | -0.1431 | 0.05713 |
fixed | NA | count_birth_order2/>5 | 0.07643 | 0.03759 | 2.034 | 3656 | 0.04207 | -0.02907 | 0.1819 |
fixed | NA | count_birth_order3/>5 | -0.02567 | 0.03621 | -0.7089 | 3659 | 0.4785 | -0.1273 | 0.07598 |
fixed | NA | count_birth_order4/>5 | 0.05458 | 0.03517 | 1.552 | 3657 | 0.1208 | -0.04414 | 0.1533 |
fixed | NA | count_birth_order5/>5 | 0.0148 | 0.03721 | 0.3979 | 3638 | 0.6907 | -0.08963 | 0.1192 |
fixed | NA | count_birth_order>5/>5 | 0.0284 | 0.02839 | 1 | 3552 | 0.3172 | -0.0513 | 0.1081 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1614 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.342 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3280 | 3348 | -1629 | 3258 | NA | NA | NA |
12 | 3280 | 3355 | -1628 | 3256 | 1.161 | 1 | 0.2813 |
16 | 3283 | 3382 | -1625 | 3251 | 5.449 | 4 | 0.2443 |
26 | 3282 | 3444 | -1615 | 3230 | 20.81 | 10 | 0.02245 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1848 | 0.2525 | 0.732 | 3593 | 0.4642 | -0.524 | 0.8936 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.004672 | 0.02712 | -0.1723 | 3587 | 0.8632 | -0.0808 | 0.07145 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001606 | 0.0009297 | 0.1727 | 3583 | 0.8629 | -0.002449 | 0.00277 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000009046 | 0.0000102 | -0.08866 | 3580 | 0.9294 | -0.00002955 | 0.00002774 |
fixed | NA | male | 0.01747 | 0.01271 | 1.375 | 3541 | 0.1691 | -0.01819 | 0.05314 |
fixed | NA | sibling_count3 | -0.006028 | 0.0208 | -0.2897 | 2884 | 0.772 | -0.06442 | 0.05237 |
fixed | NA | sibling_count4 | -0.008332 | 0.02186 | -0.3811 | 2715 | 0.7031 | -0.0697 | 0.05303 |
fixed | NA | sibling_count5 | 0.00707 | 0.02522 | 0.2804 | 2382 | 0.7792 | -0.06371 | 0.07785 |
fixed | NA | sibling_count>5 | 0.01936 | 0.02141 | 0.9043 | 2398 | 0.3659 | -0.04074 | 0.07947 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1663 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3423 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1905 | 0.2526 | 0.7539 | 3593 | 0.4509 | -0.5186 | 0.8995 |
fixed | NA | birth_order | 0.003283 | 0.004052 | 0.81 | 3583 | 0.418 | -0.008093 | 0.01466 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.005701 | 0.02715 | -0.21 | 3589 | 0.8337 | -0.08191 | 0.07051 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001888 | 0.0009304 | 0.2029 | 3584 | 0.8392 | -0.002423 | 0.0028 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001065 | 0.00001021 | -0.1043 | 3581 | 0.9169 | -0.00002971 | 0.00002758 |
fixed | NA | male | 0.01743 | 0.01271 | 1.372 | 3540 | 0.1701 | -0.01823 | 0.0531 |
fixed | NA | sibling_count3 | -0.007723 | 0.02091 | -0.3694 | 2886 | 0.7119 | -0.06642 | 0.05097 |
fixed | NA | sibling_count4 | -0.01195 | 0.02231 | -0.5356 | 2727 | 0.5922 | -0.07459 | 0.05068 |
fixed | NA | sibling_count5 | 0.00124 | 0.02622 | 0.04729 | 2426 | 0.9623 | -0.07237 | 0.07485 |
fixed | NA | sibling_count>5 | 0.007432 | 0.02599 | 0.2859 | 2621 | 0.7749 | -0.06552 | 0.08039 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1663 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3424 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1896 | 0.2527 | 0.7506 | 3589 | 0.453 | -0.5196 | 0.8988 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.006112 | 0.02713 | -0.2253 | 3584 | 0.8218 | -0.08227 | 0.07005 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001968 | 0.0009299 | 0.2116 | 3579 | 0.8324 | -0.002414 | 0.002807 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001088 | 0.0000102 | -0.1067 | 3576 | 0.9151 | -0.00002973 | 0.00002755 |
fixed | NA | male | 0.01806 | 0.0127 | 1.422 | 3538 | 0.1551 | -0.01759 | 0.05372 |
fixed | NA | sibling_count3 | -0.01698 | 0.02128 | -0.7977 | 2977 | 0.4251 | -0.07671 | 0.04276 |
fixed | NA | sibling_count4 | -0.0222 | 0.02304 | -0.9634 | 2889 | 0.3354 | -0.08688 | 0.04248 |
fixed | NA | sibling_count5 | -0.001415 | 0.0272 | -0.052 | 2640 | 0.9585 | -0.07778 | 0.07495 |
fixed | NA | sibling_count>5 | 0.001559 | 0.02661 | 0.0586 | 2758 | 0.9533 | -0.07314 | 0.07626 |
fixed | NA | birth_order_nonlinear2 | 0.03129 | 0.0164 | 1.908 | 3101 | 0.05647 | -0.01474 | 0.07733 |
fixed | NA | birth_order_nonlinear3 | 0.04782 | 0.01938 | 2.467 | 3148 | 0.01367 | -0.006586 | 0.1022 |
fixed | NA | birth_order_nonlinear4 | 0.02218 | 0.02437 | 0.9103 | 3189 | 0.3627 | -0.04621 | 0.09058 |
fixed | NA | birth_order_nonlinear5 | -0.006486 | 0.03001 | -0.2161 | 3153 | 0.8289 | -0.09074 | 0.07777 |
fixed | NA | birth_order_nonlinear>5 | 0.04426 | 0.02993 | 1.479 | 3584 | 0.1393 | -0.03975 | 0.1283 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1653 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3425 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1681 | 0.2535 | 0.663 | 3581 | 0.5074 | -0.5436 | 0.8798 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003336 | 0.02724 | -0.1225 | 3577 | 0.9025 | -0.07979 | 0.07312 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0000858 | 0.0009339 | 0.09188 | 3574 | 0.9268 | -0.002536 | 0.002707 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000002996 | 0.00001025 | 0.02923 | 3572 | 0.9767 | -0.00002847 | 0.00002907 |
fixed | NA | male | 0.01896 | 0.01272 | 1.49 | 3530 | 0.1362 | -0.01675 | 0.05467 |
fixed | NA | count_birth_order2/2 | 0.02905 | 0.03134 | 0.9271 | 3202 | 0.354 | -0.05891 | 0.117 |
fixed | NA | count_birth_order1/3 | -0.002032 | 0.02696 | -0.07537 | 3564 | 0.9399 | -0.07771 | 0.07364 |
fixed | NA | count_birth_order2/3 | -0.007826 | 0.02992 | -0.2615 | 3584 | 0.7937 | -0.09183 | 0.07617 |
fixed | NA | count_birth_order3/3 | 0.02743 | 0.03219 | 0.8522 | 3585 | 0.3942 | -0.06292 | 0.1178 |
fixed | NA | count_birth_order1/4 | -0.02844 | 0.03159 | -0.9001 | 3582 | 0.3681 | -0.1171 | 0.06025 |
fixed | NA | count_birth_order2/4 | 0.01055 | 0.03314 | 0.3183 | 3586 | 0.7503 | -0.08247 | 0.1036 |
fixed | NA | count_birth_order3/4 | 0.05262 | 0.03435 | 1.532 | 3581 | 0.1257 | -0.04381 | 0.1491 |
fixed | NA | count_birth_order4/4 | -0.02922 | 0.0373 | -0.7834 | 3574 | 0.4334 | -0.1339 | 0.07549 |
fixed | NA | count_birth_order1/5 | -0.005244 | 0.04125 | -0.1271 | 3586 | 0.8989 | -0.121 | 0.1106 |
fixed | NA | count_birth_order2/5 | 0.01438 | 0.04592 | 0.3131 | 3554 | 0.7542 | -0.1145 | 0.1433 |
fixed | NA | count_birth_order3/5 | 0.03522 | 0.04477 | 0.7867 | 3553 | 0.4315 | -0.09046 | 0.1609 |
fixed | NA | count_birth_order4/5 | 0.06448 | 0.04311 | 1.496 | 3558 | 0.1348 | -0.05652 | 0.1855 |
fixed | NA | count_birth_order5/5 | -0.02928 | 0.04577 | -0.6397 | 3549 | 0.5224 | -0.1577 | 0.09919 |
fixed | NA | count_birth_order1/>5 | -0.03966 | 0.04016 | -0.9875 | 3576 | 0.3235 | -0.1524 | 0.07308 |
fixed | NA | count_birth_order2/>5 | 0.09011 | 0.04053 | 2.224 | 3547 | 0.02624 | -0.02365 | 0.2039 |
fixed | NA | count_birth_order3/>5 | 0.02288 | 0.0387 | 0.5913 | 3555 | 0.5544 | -0.08575 | 0.1315 |
fixed | NA | count_birth_order4/>5 | 0.02081 | 0.03882 | 0.5362 | 3528 | 0.5919 | -0.08815 | 0.1298 |
fixed | NA | count_birth_order5/>5 | 0.005412 | 0.03647 | 0.1484 | 3550 | 0.882 | -0.09696 | 0.1078 |
fixed | NA | count_birth_order>5/>5 | 0.04579 | 0.02876 | 1.592 | 3444 | 0.1114 | -0.03493 | 0.1265 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1631 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3434 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 3231 | 3300 | -1605 | 3209 | NA | NA | NA |
12 | 3233 | 3307 | -1604 | 3209 | 0.6582 | 1 | 0.4172 |
16 | 3232 | 3331 | -1600 | 3200 | 8.947 | 4 | 0.06245 |
26 | 3241 | 3402 | -1595 | 3189 | 10.51 | 10 | 0.3971 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Sector_Construction`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
## boundary (singular) fit: see ?isSingular
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.00014 | 0.007992 | -0.01751 | 9745 | 0.986 | -0.02257 | 0.02229 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0001646 | 0.0007143 | 0.2304 | 9745 | 0.8178 | -0.001841 | 0.00217 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000005987 | 0.00001998 | -0.2997 | 9745 | 0.7644 | -0.00006206 | 0.00005009 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000005958 | 0.0000001767 | 0.3371 | 9745 | 0.736 | -0.0000004365 | 0.0000005557 |
fixed | NA | male | 0.001437 | 0.0007496 | 1.917 | 9745 | 0.05521 | -0.0006668 | 0.003542 |
fixed | NA | sibling_count3 | -0.001779 | 0.001507 | -1.18 | 9745 | 0.2379 | -0.006009 | 0.002452 |
fixed | NA | sibling_count4 | 0.0006745 | 0.001514 | 0.4455 | 9745 | 0.656 | -0.003576 | 0.004925 |
fixed | NA | sibling_count5 | -0.0008865 | 0.001566 | -0.5663 | 9745 | 0.5712 | -0.005281 | 0.003508 |
fixed | NA | sibling_count>5 | -0.0004652 | 0.001227 | -0.3793 | 9745 | 0.7045 | -0.003908 | 0.002978 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03649 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0001227 | 0.007992 | -0.01535 | 9744 | 0.9878 | -0.02256 | 0.02231 |
fixed | NA | birth_order | 0.00008633 | 0.0001468 | 0.5883 | 9744 | 0.5564 | -0.0003256 | 0.0004983 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0001414 | 0.0007155 | 0.1976 | 9744 | 0.8433 | -0.001867 | 0.00215 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00000519 | 0.00002002 | -0.2592 | 9744 | 0.7955 | -0.00006139 | 0.00005101 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000005258 | 0.0000001771 | 0.2968 | 9744 | 0.7666 | -0.0000004446 | 0.0000005498 |
fixed | NA | male | 0.001435 | 0.0007497 | 1.914 | 9744 | 0.05564 | -0.0006694 | 0.003539 |
fixed | NA | sibling_count3 | -0.001804 | 0.001508 | -1.197 | 9744 | 0.2315 | -0.006037 | 0.002428 |
fixed | NA | sibling_count4 | 0.000616 | 0.001517 | 0.4059 | 9744 | 0.6848 | -0.003644 | 0.004875 |
fixed | NA | sibling_count5 | -0.0009842 | 0.001574 | -0.6252 | 9744 | 0.5319 | -0.005404 | 0.003435 |
fixed | NA | sibling_count>5 | -0.0007791 | 0.001338 | -0.5825 | 9744 | 0.5603 | -0.004534 | 0.002976 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000003213 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03649 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0006085 | 0.008007 | -0.07599 | 9740 | 0.9394 | -0.02308 | 0.02187 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0002089 | 0.0007162 | 0.2916 | 9740 | 0.7706 | -0.001802 | 0.002219 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000007051 | 0.00002004 | -0.3519 | 9740 | 0.7249 | -0.0000633 | 0.0000492 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000006636 | 0.0000001772 | 0.3744 | 9740 | 0.7081 | -0.0000004312 | 0.0000005639 |
fixed | NA | male | 0.00143 | 0.0007498 | 1.907 | 9740 | 0.05657 | -0.000675 | 0.003534 |
fixed | NA | sibling_count3 | -0.001577 | 0.001534 | -1.028 | 9740 | 0.3039 | -0.005882 | 0.002728 |
fixed | NA | sibling_count4 | 0.001223 | 0.001566 | 0.7812 | 9740 | 0.4347 | -0.003173 | 0.005619 |
fixed | NA | sibling_count5 | -0.0005539 | 0.001638 | -0.3382 | 9740 | 0.7352 | -0.005152 | 0.004044 |
fixed | NA | sibling_count>5 | -0.00006166 | 0.00141 | -0.04372 | 9740 | 0.9651 | -0.00402 | 0.003897 |
fixed | NA | birth_order_nonlinear2 | -0.00004771 | 0.001109 | -0.04303 | 9740 | 0.9657 | -0.00316 | 0.003065 |
fixed | NA | birth_order_nonlinear3 | -0.0008901 | 0.001289 | -0.6904 | 9740 | 0.4899 | -0.004509 | 0.002729 |
fixed | NA | birth_order_nonlinear4 | -0.002 | 0.001448 | -1.382 | 9740 | 0.1671 | -0.006064 | 0.002063 |
fixed | NA | birth_order_nonlinear5 | 0.000813 | 0.001625 | 0.5004 | 9740 | 0.6168 | -0.003748 | 0.005374 |
fixed | NA | birth_order_nonlinear>5 | -0.0004879 | 0.001322 | -0.369 | 9740 | 0.7121 | -0.004199 | 0.003223 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000004815 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03649 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.001129 | 0.00804 | -0.1404 | 9730 | 0.8883 | -0.0237 | 0.02144 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0002277 | 0.0007171 | 0.3175 | 9730 | 0.7509 | -0.001785 | 0.002241 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000007642 | 0.00002005 | -0.3811 | 9730 | 0.7032 | -0.00006394 | 0.00004865 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000007203 | 0.0000001773 | 0.4062 | 9730 | 0.6846 | -0.0000004258 | 0.0000005699 |
fixed | NA | male | 0.001399 | 0.0007502 | 1.865 | 9730 | 0.06222 | -0.0007068 | 0.003505 |
fixed | NA | count_birth_order2/2 | 0.0008908 | 0.002215 | 0.4021 | 9730 | 0.6876 | -0.005328 | 0.00711 |
fixed | NA | count_birth_order1/3 | -0.001422 | 0.002092 | -0.6798 | 9730 | 0.4966 | -0.007293 | 0.00445 |
fixed | NA | count_birth_order2/3 | -0.001456 | 0.002328 | -0.6254 | 9730 | 0.5317 | -0.007989 | 0.005078 |
fixed | NA | count_birth_order3/3 | -0.001499 | 0.002556 | -0.5867 | 9730 | 0.5574 | -0.008673 | 0.005674 |
fixed | NA | count_birth_order1/4 | 0.003658 | 0.002303 | 1.588 | 9730 | 0.1122 | -0.002807 | 0.01012 |
fixed | NA | count_birth_order2/4 | 0.001647 | 0.00247 | 0.6669 | 9730 | 0.5048 | -0.005286 | 0.008581 |
fixed | NA | count_birth_order3/4 | -0.001469 | 0.002605 | -0.5637 | 9730 | 0.573 | -0.008782 | 0.005845 |
fixed | NA | count_birth_order4/4 | -0.001533 | 0.002805 | -0.5465 | 9730 | 0.5847 | -0.009406 | 0.006341 |
fixed | NA | count_birth_order1/5 | -0.001484 | 0.002599 | -0.5709 | 9730 | 0.5681 | -0.008778 | 0.005811 |
fixed | NA | count_birth_order2/5 | 0.00277 | 0.002759 | 1.004 | 9730 | 0.3154 | -0.004974 | 0.01051 |
fixed | NA | count_birth_order3/5 | -0.001468 | 0.002903 | -0.5055 | 9730 | 0.6132 | -0.009617 | 0.006682 |
fixed | NA | count_birth_order4/5 | -0.001597 | 0.003066 | -0.521 | 9730 | 0.6023 | -0.0102 | 0.007008 |
fixed | NA | count_birth_order5/5 | -0.001528 | 0.00307 | -0.4976 | 9730 | 0.6188 | -0.01015 | 0.00709 |
fixed | NA | count_birth_order1/>5 | 0.0001466 | 0.00201 | 0.07294 | 9730 | 0.9419 | -0.005496 | 0.00579 |
fixed | NA | count_birth_order2/>5 | -0.001418 | 0.00209 | -0.6783 | 9730 | 0.4976 | -0.007286 | 0.00445 |
fixed | NA | count_birth_order3/>5 | 0.0002647 | 0.002069 | 0.1279 | 9730 | 0.8982 | -0.005544 | 0.006073 |
fixed | NA | count_birth_order4/>5 | -0.001477 | 0.002027 | -0.729 | 9730 | 0.466 | -0.007166 | 0.004212 |
fixed | NA | count_birth_order5/>5 | 0.001744 | 0.002049 | 0.8512 | 9730 | 0.3947 | -0.004008 | 0.007496 |
fixed | NA | count_birth_order>5/>5 | -0.0001939 | 0.001632 | -0.1188 | 9730 | 0.9054 | -0.004776 | 0.004388 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000002354 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03649 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -36894 | -36815 | 18458 | -36916 | NA | NA | NA |
12 | -36892 | -36806 | 18458 | -36916 | 0.3464 | 1 | 0.5562 |
16 | -36887 | -36772 | 18460 | -36919 | 3.056 | 4 | 0.5484 |
26 | -36874 | -36687 | 18463 | -36926 | 7.077 | 10 | 0.7181 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01904 | 0.02438 | -0.7808 | 3665 | 0.4349 | -0.08748 | 0.0494 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00222 | 0.002615 | 0.8488 | 3665 | 0.3961 | -0.005121 | 0.00956 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00006986 | 0.00008957 | -0.7799 | 3665 | 0.4355 | -0.0003213 | 0.0001816 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006769 | 0.0000009816 | 0.6896 | 3665 | 0.4905 | -0.000002078 | 0.000003432 |
fixed | NA | male | 0.001275 | 0.001234 | 1.033 | 3665 | 0.3016 | -0.002189 | 0.00474 |
fixed | NA | sibling_count3 | -0.002135 | 0.001996 | -1.07 | 3665 | 0.2848 | -0.007738 | 0.003468 |
fixed | NA | sibling_count4 | -0.003247 | 0.002052 | -1.582 | 3665 | 0.1136 | -0.009006 | 0.002513 |
fixed | NA | sibling_count5 | -0.001205 | 0.002273 | -0.5304 | 3665 | 0.5958 | -0.007585 | 0.005174 |
fixed | NA | sibling_count>5 | -0.002255 | 0.00196 | -1.15 | 3665 | 0.2501 | -0.007758 | 0.003248 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03688 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01893 | 0.02439 | -0.7762 | 3664 | 0.4377 | -0.08739 | 0.04953 |
fixed | NA | birth_order | 0.0001139 | 0.0003773 | 0.302 | 3664 | 0.7627 | -0.000945 | 0.001173 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002195 | 0.002617 | 0.839 | 3664 | 0.4015 | -0.00515 | 0.00954 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00006929 | 0.0000896 | -0.7733 | 3664 | 0.4394 | -0.0003208 | 0.0001822 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006754 | 0.0000009817 | 0.688 | 3664 | 0.4915 | -0.00000208 | 0.000003431 |
fixed | NA | male | 0.001271 | 0.001235 | 1.029 | 3664 | 0.3035 | -0.002195 | 0.004736 |
fixed | NA | sibling_count3 | -0.002192 | 0.002005 | -1.093 | 3664 | 0.2744 | -0.007819 | 0.003436 |
fixed | NA | sibling_count4 | -0.00337 | 0.002092 | -1.611 | 3664 | 0.1073 | -0.009244 | 0.002503 |
fixed | NA | sibling_count5 | -0.001409 | 0.002371 | -0.5944 | 3664 | 0.5523 | -0.008065 | 0.005246 |
fixed | NA | sibling_count>5 | -0.00266 | 0.002374 | -1.12 | 3664 | 0.2627 | -0.009324 | 0.004005 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03689 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01804 | 0.0244 | -0.7394 | 3660 | 0.4597 | -0.08654 | 0.05046 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002198 | 0.002617 | 0.8399 | 3660 | 0.401 | -0.005147 | 0.009543 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00006814 | 0.00008961 | -0.7603 | 3660 | 0.4471 | -0.0003197 | 0.0001834 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006483 | 0.0000009821 | 0.6601 | 3660 | 0.5092 | -0.000002108 | 0.000003405 |
fixed | NA | male | 0.001222 | 0.001235 | 0.9901 | 3660 | 0.3222 | -0.002243 | 0.004688 |
fixed | NA | sibling_count3 | -0.001531 | 0.002047 | -0.7481 | 3660 | 0.4545 | -0.007276 | 0.004214 |
fixed | NA | sibling_count4 | -0.002233 | 0.002175 | -1.027 | 3660 | 0.3047 | -0.008339 | 0.003873 |
fixed | NA | sibling_count5 | 0.0001622 | 0.002493 | 0.06504 | 3660 | 0.9481 | -0.006837 | 0.007161 |
fixed | NA | sibling_count>5 | -0.001611 | 0.002443 | -0.6594 | 3660 | 0.5097 | -0.00847 | 0.005248 |
fixed | NA | birth_order_nonlinear2 | -0.003122 | 0.001656 | -1.886 | 3660 | 0.05944 | -0.007771 | 0.001526 |
fixed | NA | birth_order_nonlinear3 | -0.002794 | 0.00194 | -1.44 | 3660 | 0.15 | -0.00824 | 0.002652 |
fixed | NA | birth_order_nonlinear4 | -0.003035 | 0.002365 | -1.284 | 3660 | 0.1994 | -0.009674 | 0.003603 |
fixed | NA | birth_order_nonlinear5 | -0.003377 | 0.002899 | -1.165 | 3660 | 0.2441 | -0.01151 | 0.00476 |
fixed | NA | birth_order_nonlinear>5 | -0.0000936 | 0.002817 | -0.03323 | 3660 | 0.9735 | -0.008 | 0.007813 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03688 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01888 | 0.02451 | -0.7703 | 3650 | 0.4412 | -0.08768 | 0.04992 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002348 | 0.002629 | 0.8932 | 3650 | 0.3718 | -0.00503 | 0.009726 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007276 | 0.00009004 | -0.8081 | 3650 | 0.4191 | -0.0003255 | 0.00018 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006932 | 0.0000009869 | 0.7024 | 3650 | 0.4825 | -0.000002077 | 0.000003463 |
fixed | NA | male | 0.001217 | 0.001237 | 0.9839 | 3650 | 0.3252 | -0.002256 | 0.00469 |
fixed | NA | count_birth_order2/2 | -0.005185 | 0.003234 | -1.603 | 3650 | 0.1089 | -0.01426 | 0.003892 |
fixed | NA | count_birth_order1/3 | -0.002396 | 0.002674 | -0.8963 | 3650 | 0.3702 | -0.009901 | 0.005109 |
fixed | NA | count_birth_order2/3 | -0.005014 | 0.002973 | -1.687 | 3650 | 0.09177 | -0.01336 | 0.003331 |
fixed | NA | count_birth_order3/3 | -0.005052 | 0.00324 | -1.559 | 3650 | 0.119 | -0.01415 | 0.004044 |
fixed | NA | count_birth_order1/4 | -0.004789 | 0.003067 | -1.561 | 3650 | 0.1185 | -0.0134 | 0.003821 |
fixed | NA | count_birth_order2/4 | -0.004976 | 0.003253 | -1.529 | 3650 | 0.1262 | -0.01411 | 0.004156 |
fixed | NA | count_birth_order3/4 | -0.004932 | 0.003375 | -1.461 | 3650 | 0.144 | -0.0144 | 0.004542 |
fixed | NA | count_birth_order4/4 | -0.005233 | 0.003613 | -1.448 | 3650 | 0.1476 | -0.01537 | 0.004909 |
fixed | NA | count_birth_order1/5 | 0.004607 | 0.004041 | 1.14 | 3650 | 0.2544 | -0.006737 | 0.01595 |
fixed | NA | count_birth_order2/5 | -0.004763 | 0.004362 | -1.092 | 3650 | 0.2749 | -0.01701 | 0.007481 |
fixed | NA | count_birth_order3/5 | -0.004893 | 0.004147 | -1.18 | 3650 | 0.2381 | -0.01653 | 0.006748 |
fixed | NA | count_birth_order4/5 | -0.005202 | 0.004046 | -1.286 | 3650 | 0.1987 | -0.01656 | 0.006156 |
fixed | NA | count_birth_order5/5 | -0.005179 | 0.004259 | -1.216 | 3650 | 0.2241 | -0.01713 | 0.006777 |
fixed | NA | count_birth_order1/>5 | -0.004681 | 0.003823 | -1.224 | 3650 | 0.2209 | -0.01541 | 0.006051 |
fixed | NA | count_birth_order2/>5 | -0.00473 | 0.003857 | -1.226 | 3650 | 0.2201 | -0.01556 | 0.006096 |
fixed | NA | count_birth_order3/>5 | -0.004821 | 0.003765 | -1.28 | 3650 | 0.2006 | -0.01539 | 0.005749 |
fixed | NA | count_birth_order4/>5 | -0.004809 | 0.003688 | -1.304 | 3650 | 0.1923 | -0.01516 | 0.005542 |
fixed | NA | count_birth_order5/>5 | -0.004901 | 0.003524 | -1.391 | 3650 | 0.1644 | -0.01479 | 0.004992 |
fixed | NA | count_birth_order>5/>5 | -0.002395 | 0.002722 | -0.8798 | 3650 | 0.379 | -0.01003 | 0.005246 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03691 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -13809 | -13741 | 6916 | -13831 | NA | NA | NA |
12 | -13807 | -13733 | 6916 | -13831 | 0.09146 | 1 | 0.7623 |
16 | -13805 | -13705 | 6918 | -13837 | 5.574 | 4 | 0.2333 |
26 | -13790 | -13628 | 6921 | -13842 | 4.71 | 10 | 0.9097 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01904 | 0.02419 | -0.7868 | 3689 | 0.4314 | -0.08695 | 0.04888 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002273 | 0.002597 | 0.875 | 3689 | 0.3816 | -0.005018 | 0.009564 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007096 | 0.00008898 | -0.7975 | 3689 | 0.4252 | -0.0003207 | 0.0001788 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006852 | 0.0000009753 | 0.7025 | 3689 | 0.4824 | -0.000002053 | 0.000003423 |
fixed | NA | male | 0.001309 | 0.001226 | 1.067 | 3689 | 0.2859 | -0.002133 | 0.00475 |
fixed | NA | sibling_count3 | -0.002695 | 0.002183 | -1.235 | 3689 | 0.217 | -0.008822 | 0.003432 |
fixed | NA | sibling_count4 | -0.004092 | 0.002196 | -1.864 | 3689 | 0.0624 | -0.01026 | 0.00207 |
fixed | NA | sibling_count5 | -0.002261 | 0.002303 | -0.9815 | 3689 | 0.3264 | -0.008727 | 0.004205 |
fixed | NA | sibling_count>5 | -0.00326 | 0.00202 | -1.614 | 3689 | 0.1067 | -0.008932 | 0.002411 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000000423 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03676 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01896 | 0.0242 | -0.7833 | 3688 | 0.4335 | -0.08688 | 0.04897 |
fixed | NA | birth_order | 0.0001029 | 0.0003309 | 0.3109 | 3688 | 0.7559 | -0.0008261 | 0.001032 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002253 | 0.002598 | 0.8669 | 3688 | 0.386 | -0.005041 | 0.009547 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007051 | 0.000089 | -0.7923 | 3688 | 0.4282 | -0.0003203 | 0.0001793 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006846 | 0.0000009754 | 0.7018 | 3688 | 0.4828 | -0.000002053 | 0.000003423 |
fixed | NA | male | 0.001304 | 0.001226 | 1.064 | 3688 | 0.2876 | -0.002138 | 0.004747 |
fixed | NA | sibling_count3 | -0.002747 | 0.002189 | -1.255 | 3688 | 0.2097 | -0.008892 | 0.003399 |
fixed | NA | sibling_count4 | -0.004195 | 0.00222 | -1.889 | 3688 | 0.05893 | -0.01043 | 0.002038 |
fixed | NA | sibling_count5 | -0.002432 | 0.002369 | -1.027 | 3688 | 0.3046 | -0.009082 | 0.004217 |
fixed | NA | sibling_count>5 | -0.003621 | 0.00233 | -1.554 | 3688 | 0.1202 | -0.01016 | 0.002919 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03676 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01787 | 0.02422 | -0.7379 | 3684 | 0.4606 | -0.08584 | 0.05011 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002244 | 0.002599 | 0.8634 | 3684 | 0.388 | -0.005051 | 0.009539 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00006906 | 0.00008903 | -0.7757 | 3684 | 0.438 | -0.000319 | 0.0001808 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006551 | 0.0000009758 | 0.6713 | 3684 | 0.5021 | -0.000002084 | 0.000003394 |
fixed | NA | male | 0.001255 | 0.001226 | 1.023 | 3684 | 0.3063 | -0.002188 | 0.004697 |
fixed | NA | sibling_count3 | -0.002103 | 0.002228 | -0.944 | 3684 | 0.3452 | -0.008358 | 0.004151 |
fixed | NA | sibling_count4 | -0.003207 | 0.00229 | -1.4 | 3684 | 0.1615 | -0.009635 | 0.003221 |
fixed | NA | sibling_count5 | -0.001055 | 0.002481 | -0.4253 | 3684 | 0.6706 | -0.008019 | 0.005909 |
fixed | NA | sibling_count>5 | -0.002713 | 0.002404 | -1.129 | 3684 | 0.2591 | -0.00946 | 0.004034 |
fixed | NA | birth_order_nonlinear2 | -0.003291 | 0.001669 | -1.972 | 3684 | 0.04873 | -0.007976 | 0.001394 |
fixed | NA | birth_order_nonlinear3 | -0.002759 | 0.001942 | -1.42 | 3684 | 0.1556 | -0.008211 | 0.002694 |
fixed | NA | birth_order_nonlinear4 | -0.002861 | 0.002297 | -1.245 | 3684 | 0.213 | -0.009309 | 0.003587 |
fixed | NA | birth_order_nonlinear5 | -0.003159 | 0.002798 | -1.129 | 3684 | 0.2588 | -0.01101 | 0.004694 |
fixed | NA | birth_order_nonlinear>5 | -0.00035 | 0.002537 | -0.1379 | 3684 | 0.8903 | -0.007472 | 0.006772 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0000000005529 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03675 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01698 | 0.02429 | -0.6991 | 3674 | 0.4845 | -0.08518 | 0.05121 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00227 | 0.002608 | 0.8703 | 3674 | 0.3842 | -0.00505 | 0.00959 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0000702 | 0.00008935 | -0.7857 | 3674 | 0.4321 | -0.000321 | 0.0001806 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000006703 | 0.0000009796 | 0.6843 | 3674 | 0.4939 | -0.000002079 | 0.00000342 |
fixed | NA | male | 0.001227 | 0.001229 | 0.9981 | 3674 | 0.3183 | -0.002224 | 0.004678 |
fixed | NA | count_birth_order2/2 | -0.006385 | 0.00353 | -1.809 | 3674 | 0.07059 | -0.01629 | 0.003525 |
fixed | NA | count_birth_order1/3 | -0.003068 | 0.002946 | -1.041 | 3674 | 0.2979 | -0.01134 | 0.005203 |
fixed | NA | count_birth_order2/3 | -0.006267 | 0.00321 | -1.952 | 3674 | 0.051 | -0.01528 | 0.002745 |
fixed | NA | count_birth_order3/3 | -0.006277 | 0.003561 | -1.763 | 3674 | 0.07802 | -0.01627 | 0.003718 |
fixed | NA | count_birth_order1/4 | -0.006116 | 0.003198 | -1.913 | 3674 | 0.05587 | -0.01509 | 0.00286 |
fixed | NA | count_birth_order2/4 | -0.006265 | 0.003371 | -1.859 | 3674 | 0.06317 | -0.01573 | 0.003197 |
fixed | NA | count_birth_order3/4 | -0.006214 | 0.003651 | -1.702 | 3674 | 0.08881 | -0.01646 | 0.004033 |
fixed | NA | count_birth_order4/4 | -0.006527 | 0.003966 | -1.646 | 3674 | 0.09987 | -0.01766 | 0.004605 |
fixed | NA | count_birth_order1/5 | 0.001582 | 0.003866 | 0.4093 | 3674 | 0.6824 | -0.009271 | 0.01244 |
fixed | NA | count_birth_order2/5 | -0.006089 | 0.003966 | -1.535 | 3674 | 0.1248 | -0.01722 | 0.005043 |
fixed | NA | count_birth_order3/5 | -0.006068 | 0.004082 | -1.486 | 3674 | 0.1372 | -0.01753 | 0.005391 |
fixed | NA | count_birth_order4/5 | -0.006315 | 0.004157 | -1.519 | 3674 | 0.1288 | -0.01798 | 0.005354 |
fixed | NA | count_birth_order5/5 | -0.006395 | 0.004222 | -1.515 | 3674 | 0.1299 | -0.01825 | 0.005455 |
fixed | NA | count_birth_order1/>5 | -0.00598 | 0.003485 | -1.716 | 3674 | 0.08623 | -0.01576 | 0.003802 |
fixed | NA | count_birth_order2/>5 | -0.006117 | 0.003686 | -1.66 | 3674 | 0.09705 | -0.01646 | 0.004228 |
fixed | NA | count_birth_order3/>5 | -0.006069 | 0.003552 | -1.709 | 3674 | 0.08763 | -0.01604 | 0.003902 |
fixed | NA | count_birth_order4/>5 | -0.006211 | 0.003452 | -1.799 | 3674 | 0.07209 | -0.0159 | 0.00348 |
fixed | NA | count_birth_order5/>5 | -0.006157 | 0.003658 | -1.683 | 3674 | 0.09237 | -0.01642 | 0.004109 |
fixed | NA | count_birth_order>5/>5 | -0.004098 | 0.002734 | -1.499 | 3674 | 0.134 | -0.01177 | 0.003576 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03678 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -13925 | -13856 | 6973 | -13947 | NA | NA | NA |
12 | -13923 | -13848 | 6973 | -13947 | 0.09692 | 1 | 0.7556 |
16 | -13920 | -13821 | 6976 | -13952 | 5.536 | 4 | 0.2366 |
26 | -13904 | -13743 | 6978 | -13956 | 4.304 | 10 | 0.9326 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.02014 | 0.02484 | -0.8108 | 3601 | 0.4176 | -0.08985 | 0.04958 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002324 | 0.002668 | 0.871 | 3601 | 0.3838 | -0.005166 | 0.009813 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007334 | 0.00009147 | -0.8018 | 3601 | 0.4227 | -0.0003301 | 0.0001834 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000007122 | 0.000001003 | 0.7098 | 3601 | 0.4779 | -0.000002105 | 0.000003529 |
fixed | NA | male | 0.001306 | 0.001257 | 1.039 | 3601 | 0.2987 | -0.002221 | 0.004833 |
fixed | NA | sibling_count3 | -0.002062 | 0.001971 | -1.046 | 3601 | 0.2955 | -0.007594 | 0.00347 |
fixed | NA | sibling_count4 | -0.003122 | 0.002055 | -1.52 | 3601 | 0.1287 | -0.00889 | 0.002646 |
fixed | NA | sibling_count5 | -0.0008557 | 0.002335 | -0.3665 | 3601 | 0.714 | -0.00741 | 0.005698 |
fixed | NA | sibling_count>5 | -0.002037 | 0.001982 | -1.028 | 3601 | 0.3042 | -0.0076 | 0.003527 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03721 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01997 | 0.02484 | -0.804 | 3600 | 0.4215 | -0.08971 | 0.04977 |
fixed | NA | birth_order | 0.0001248 | 0.0003922 | 0.3183 | 3600 | 0.7503 | -0.0009761 | 0.001226 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002292 | 0.00267 | 0.8585 | 3600 | 0.3907 | -0.005203 | 0.009788 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007255 | 0.00009151 | -0.7927 | 3600 | 0.428 | -0.0003294 | 0.0001843 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000007088 | 0.000001004 | 0.7062 | 3600 | 0.4801 | -0.000002109 | 0.000003526 |
fixed | NA | male | 0.001304 | 0.001257 | 1.038 | 3600 | 0.2994 | -0.002224 | 0.004832 |
fixed | NA | sibling_count3 | -0.002125 | 0.001981 | -1.073 | 3600 | 0.2834 | -0.007685 | 0.003435 |
fixed | NA | sibling_count4 | -0.003256 | 0.002098 | -1.552 | 3600 | 0.1207 | -0.009145 | 0.002632 |
fixed | NA | sibling_count5 | -0.001071 | 0.002431 | -0.4406 | 3600 | 0.6596 | -0.007896 | 0.005754 |
fixed | NA | sibling_count>5 | -0.00248 | 0.002422 | -1.024 | 3600 | 0.3061 | -0.00928 | 0.00432 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03721 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01926 | 0.02486 | -0.7748 | 3596 | 0.4385 | -0.08904 | 0.05052 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002317 | 0.00267 | 0.8677 | 3596 | 0.3856 | -0.005178 | 0.009812 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007222 | 0.00009152 | -0.7891 | 3596 | 0.4301 | -0.0003291 | 0.0001847 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000000692 | 0.000001004 | 0.6892 | 3596 | 0.4907 | -0.000002126 | 0.00000351 |
fixed | NA | male | 0.001266 | 0.001257 | 1.008 | 3596 | 0.3137 | -0.002262 | 0.004794 |
fixed | NA | sibling_count3 | -0.00148 | 0.002025 | -0.7309 | 3596 | 0.4649 | -0.007163 | 0.004203 |
fixed | NA | sibling_count4 | -0.002126 | 0.002182 | -0.9744 | 3596 | 0.3299 | -0.008251 | 0.003999 |
fixed | NA | sibling_count5 | 0.0004233 | 0.002547 | 0.1662 | 3596 | 0.868 | -0.006726 | 0.007573 |
fixed | NA | sibling_count>5 | -0.001472 | 0.002497 | -0.5893 | 3596 | 0.5557 | -0.008482 | 0.005538 |
fixed | NA | birth_order_nonlinear2 | -0.003103 | 0.001663 | -1.866 | 3596 | 0.06216 | -0.007772 | 0.001566 |
fixed | NA | birth_order_nonlinear3 | -0.002762 | 0.00196 | -1.409 | 3596 | 0.1589 | -0.008263 | 0.00274 |
fixed | NA | birth_order_nonlinear4 | -0.003046 | 0.002457 | -1.239 | 3596 | 0.2152 | -0.009943 | 0.003852 |
fixed | NA | birth_order_nonlinear5 | -0.003403 | 0.003029 | -1.123 | 3596 | 0.2613 | -0.0119 | 0.005099 |
fixed | NA | birth_order_nonlinear>5 | 0.00008479 | 0.002932 | 0.02891 | 3596 | 0.9769 | -0.008147 | 0.008316 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03721 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01999 | 0.02495 | -0.8009 | 3586 | 0.4232 | -0.09004 | 0.05006 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002455 | 0.002681 | 0.9155 | 3586 | 0.36 | -0.005072 | 0.009981 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00007656 | 0.00009193 | -0.8328 | 3586 | 0.405 | -0.0003346 | 0.0001815 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000007349 | 0.000001009 | 0.7286 | 3586 | 0.4663 | -0.000002097 | 0.000003566 |
fixed | NA | male | 0.00125 | 0.001259 | 0.9929 | 3586 | 0.3208 | -0.002285 | 0.004786 |
fixed | NA | count_birth_order2/2 | -0.004988 | 0.003173 | -1.572 | 3586 | 0.116 | -0.01389 | 0.003918 |
fixed | NA | count_birth_order1/3 | -0.002318 | 0.002649 | -0.8749 | 3586 | 0.3817 | -0.009754 | 0.005119 |
fixed | NA | count_birth_order2/3 | -0.00488 | 0.002948 | -1.655 | 3586 | 0.09796 | -0.01315 | 0.003395 |
fixed | NA | count_birth_order3/3 | -0.004906 | 0.003177 | -1.544 | 3586 | 0.1226 | -0.01382 | 0.004012 |
fixed | NA | count_birth_order1/4 | -0.004633 | 0.00311 | -1.49 | 3586 | 0.1363 | -0.01336 | 0.004095 |
fixed | NA | count_birth_order2/4 | -0.004836 | 0.003269 | -1.479 | 3586 | 0.1392 | -0.01401 | 0.00434 |
fixed | NA | count_birth_order3/4 | -0.004774 | 0.003394 | -1.407 | 3586 | 0.1596 | -0.0143 | 0.004752 |
fixed | NA | count_birth_order4/4 | -0.005074 | 0.003687 | -1.376 | 3586 | 0.1689 | -0.01542 | 0.005276 |
fixed | NA | count_birth_order1/5 | 0.00475 | 0.004066 | 1.168 | 3586 | 0.2427 | -0.006662 | 0.01616 |
fixed | NA | count_birth_order2/5 | -0.004579 | 0.004544 | -1.008 | 3586 | 0.3136 | -0.01734 | 0.008176 |
fixed | NA | count_birth_order3/5 | -0.004708 | 0.004432 | -1.062 | 3586 | 0.2882 | -0.01715 | 0.007733 |
fixed | NA | count_birth_order4/5 | -0.005011 | 0.004267 | -1.174 | 3586 | 0.2403 | -0.01699 | 0.006967 |
fixed | NA | count_birth_order5/5 | -0.005039 | 0.004533 | -1.111 | 3586 | 0.2665 | -0.01776 | 0.007687 |
fixed | NA | count_birth_order1/>5 | -0.004509 | 0.003959 | -1.139 | 3586 | 0.2548 | -0.01562 | 0.006604 |
fixed | NA | count_birth_order2/>5 | -0.004502 | 0.004007 | -1.124 | 3586 | 0.2613 | -0.01575 | 0.006746 |
fixed | NA | count_birth_order3/>5 | -0.00464 | 0.003827 | -1.212 | 3586 | 0.2255 | -0.01538 | 0.006103 |
fixed | NA | count_birth_order4/>5 | -0.00463 | 0.003846 | -1.204 | 3586 | 0.2287 | -0.01543 | 0.006166 |
fixed | NA | count_birth_order5/>5 | -0.00472 | 0.003611 | -1.307 | 3586 | 0.1912 | -0.01486 | 0.005415 |
fixed | NA | count_birth_order>5/>5 | -0.002027 | 0.002777 | -0.7299 | 3586 | 0.4655 | -0.009823 | 0.005769 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.03723 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -13505 | -13437 | 6763 | -13527 | NA | NA | NA |
12 | -13503 | -13429 | 6763 | -13527 | 0.1016 | 1 | 0.75 |
16 | -13500 | -13401 | 6766 | -13532 | 5.511 | 4 | 0.2388 |
26 | -13485 | -13324 | 6768 | -13537 | 4.409 | 10 | 0.927 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Sector_Electricity, gas, water`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01323 | 0.0289 | 0.4577 | 9429 | 0.6472 | -0.0679 | 0.09435 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0002009 | 0.002584 | 0.07776 | 9336 | 0.938 | -0.007053 | 0.007455 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001341 | 0.0000723 | 0.1854 | 9207 | 0.8529 | -0.0001895 | 0.0002163 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000002622 | 0.0000006399 | -0.4098 | 9080 | 0.682 | -0.000002058 | 0.000001534 |
fixed | NA | male | 0.00005814 | 0.002704 | 0.02151 | 9745 | 0.9828 | -0.007531 | 0.007647 |
fixed | NA | sibling_count3 | -0.006514 | 0.005475 | -1.19 | 7729 | 0.2342 | -0.02188 | 0.008854 |
fixed | NA | sibling_count4 | 0.000643 | 0.005507 | 0.1168 | 7189 | 0.9071 | -0.01482 | 0.0161 |
fixed | NA | sibling_count5 | -0.01138 | 0.005702 | -1.996 | 6635 | 0.04598 | -0.02739 | 0.004625 |
fixed | NA | sibling_count>5 | -0.007491 | 0.004458 | -1.68 | 7477 | 0.09295 | -0.02001 | 0.005024 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02111 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1299 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01323 | 0.0289 | 0.4578 | 9428 | 0.6471 | -0.0679 | 0.09436 |
fixed | NA | birth_order | 0.00004661 | 0.0005342 | 0.08725 | 7243 | 0.9305 | -0.001453 | 0.001546 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0001884 | 0.002588 | 0.07278 | 9324 | 0.942 | -0.007077 | 0.007454 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001385 | 0.00007248 | 0.191 | 9168 | 0.8485 | -0.0001896 | 0.0002173 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000002661 | 0.0000006415 | -0.4149 | 9029 | 0.6783 | -0.000002067 | 0.000001534 |
fixed | NA | male | 0.00005681 | 0.002704 | 0.02101 | 9744 | 0.9832 | -0.007533 | 0.007647 |
fixed | NA | sibling_count3 | -0.006527 | 0.005477 | -1.192 | 7738 | 0.2334 | -0.0219 | 0.008848 |
fixed | NA | sibling_count4 | 0.000612 | 0.005519 | 0.1109 | 7229 | 0.9117 | -0.01488 | 0.0161 |
fixed | NA | sibling_count5 | -0.01143 | 0.005733 | -1.994 | 6708 | 0.04618 | -0.02753 | 0.004661 |
fixed | NA | sibling_count>5 | -0.007659 | 0.004856 | -1.577 | 8054 | 0.1148 | -0.02129 | 0.005971 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02113 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1299 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.01097 | 0.02895 | 0.3791 | 9435 | 0.7047 | -0.07029 | 0.09224 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0002738 | 0.002591 | 0.1057 | 9329 | 0.9159 | -0.006999 | 0.007547 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000009056 | 0.00007253 | 0.1249 | 9175 | 0.9006 | -0.0001945 | 0.0002126 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000002072 | 0.0000006418 | -0.3228 | 9033 | 0.7469 | -0.000002009 | 0.000001594 |
fixed | NA | male | 0.00005961 | 0.002704 | 0.02205 | 9740 | 0.9824 | -0.007531 | 0.00765 |
fixed | NA | sibling_count3 | -0.006954 | 0.005568 | -1.249 | 7978 | 0.2117 | -0.02258 | 0.008675 |
fixed | NA | sibling_count4 | 0.0003152 | 0.00569 | 0.0554 | 7705 | 0.9558 | -0.01566 | 0.01629 |
fixed | NA | sibling_count5 | -0.01083 | 0.005956 | -1.819 | 7339 | 0.069 | -0.02755 | 0.005886 |
fixed | NA | sibling_count>5 | -0.005929 | 0.005111 | -1.16 | 8707 | 0.2461 | -0.02027 | 0.008417 |
fixed | NA | birth_order_nonlinear2 | 0.006418 | 0.003984 | 1.611 | 9149 | 0.1073 | -0.004766 | 0.0176 |
fixed | NA | birth_order_nonlinear3 | 0.003461 | 0.004631 | 0.7474 | 9088 | 0.4549 | -0.009538 | 0.01646 |
fixed | NA | birth_order_nonlinear4 | 0.001524 | 0.005203 | 0.2928 | 9196 | 0.7696 | -0.01308 | 0.01613 |
fixed | NA | birth_order_nonlinear5 | -0.002664 | 0.005841 | -0.456 | 9273 | 0.6484 | -0.01906 | 0.01373 |
fixed | NA | birth_order_nonlinear>5 | -0.0001668 | 0.004776 | -0.03492 | 9649 | 0.9721 | -0.01357 | 0.01324 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02114 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1299 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.008777 | 0.02906 | 0.302 | 9441 | 0.7627 | -0.0728 | 0.09035 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0003881 | 0.002593 | 0.1496 | 9319 | 0.8811 | -0.006892 | 0.007668 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000006036 | 0.00007257 | 0.08317 | 9164 | 0.9337 | -0.0001977 | 0.0002097 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000001841 | 0.0000006421 | -0.2867 | 9020 | 0.7743 | -0.000001986 | 0.000001618 |
fixed | NA | male | -0.0001087 | 0.002705 | -0.04017 | 9730 | 0.968 | -0.007702 | 0.007485 |
fixed | NA | count_birth_order2/2 | 0.009253 | 0.00795 | 1.164 | 8855 | 0.2445 | -0.01306 | 0.03157 |
fixed | NA | count_birth_order1/3 | -0.002485 | 0.007543 | -0.3295 | 9723 | 0.7418 | -0.02366 | 0.01869 |
fixed | NA | count_birth_order2/3 | -0.003798 | 0.008393 | -0.4525 | 9726 | 0.6509 | -0.02736 | 0.01976 |
fixed | NA | count_birth_order3/3 | -0.003063 | 0.009215 | -0.3324 | 9726 | 0.7396 | -0.02893 | 0.02281 |
fixed | NA | count_birth_order1/4 | -0.006877 | 0.008305 | -0.8281 | 9727 | 0.4076 | -0.03019 | 0.01643 |
fixed | NA | count_birth_order2/4 | 0.02091 | 0.008908 | 2.347 | 9725 | 0.01892 | -0.004094 | 0.04591 |
fixed | NA | count_birth_order3/4 | 0.001834 | 0.009395 | 0.1952 | 9726 | 0.8452 | -0.02454 | 0.02821 |
fixed | NA | count_birth_order4/4 | 0.002255 | 0.01012 | 0.2229 | 9725 | 0.8236 | -0.02614 | 0.03065 |
fixed | NA | count_birth_order1/5 | -0.005294 | 0.009369 | -0.5651 | 9729 | 0.572 | -0.03159 | 0.02101 |
fixed | NA | count_birth_order2/5 | -0.01186 | 0.009948 | -1.192 | 9729 | 0.2334 | -0.03978 | 0.01607 |
fixed | NA | count_birth_order3/5 | -0.01047 | 0.01047 | -1 | 9729 | 0.3173 | -0.03985 | 0.01891 |
fixed | NA | count_birth_order4/5 | 0.008094 | 0.01105 | 0.7322 | 9730 | 0.4641 | -0.02293 | 0.03912 |
fixed | NA | count_birth_order5/5 | -0.01984 | 0.01107 | -1.793 | 9729 | 0.07308 | -0.05092 | 0.01123 |
fixed | NA | count_birth_order1/>5 | -0.003349 | 0.007249 | -0.462 | 9729 | 0.6441 | -0.0237 | 0.017 |
fixed | NA | count_birth_order2/>5 | -0.0008831 | 0.007537 | -0.1172 | 9730 | 0.9067 | -0.02204 | 0.02027 |
fixed | NA | count_birth_order3/>5 | 0.001765 | 0.007461 | 0.2366 | 9730 | 0.813 | -0.01918 | 0.02271 |
fixed | NA | count_birth_order4/>5 | -0.00785 | 0.007308 | -1.074 | 9729 | 0.2827 | -0.02836 | 0.01266 |
fixed | NA | count_birth_order5/>5 | -0.005377 | 0.007388 | -0.7278 | 9730 | 0.4667 | -0.02612 | 0.01536 |
fixed | NA | count_birth_order>5/>5 | -0.005087 | 0.005909 | -0.861 | 9032 | 0.3893 | -0.02167 | 0.0115 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02122 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1299 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -11872 | -11793 | 5947 | -11894 | NA | NA | NA |
12 | -11870 | -11783 | 5947 | -11894 | 0.007754 | 1 | 0.9298 |
16 | -11866 | -11751 | 5949 | -11898 | 4.007 | 4 | 0.405 |
26 | -11858 | -11671 | 5955 | -11910 | 12.21 | 10 | 0.271 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.06892 | 0.08321 | -0.8282 | 3661 | 0.4076 | -0.3025 | 0.1647 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009208 | 0.008926 | 1.032 | 3660 | 0.3023 | -0.01585 | 0.03426 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003094 | 0.0003058 | -1.012 | 3659 | 0.3117 | -0.001168 | 0.0005489 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003375 | 0.000003352 | 1.007 | 3657 | 0.314 | -0.000006033 | 0.00001278 |
fixed | NA | male | -0.003225 | 0.004207 | -0.7666 | 3664 | 0.4434 | -0.01503 | 0.008584 |
fixed | NA | sibling_count3 | -0.004733 | 0.006873 | -0.6886 | 3135 | 0.4911 | -0.02403 | 0.01456 |
fixed | NA | sibling_count4 | 0.0002426 | 0.007083 | 0.03425 | 2921 | 0.9727 | -0.01964 | 0.02013 |
fixed | NA | sibling_count5 | -0.003574 | 0.007875 | -0.4539 | 2600 | 0.65 | -0.02568 | 0.01853 |
fixed | NA | sibling_count>5 | 0.000262 | 0.006798 | 0.03854 | 2552 | 0.9693 | -0.01882 | 0.01935 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02884 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1224 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0693 | 0.08324 | -0.8326 | 3659 | 0.4051 | -0.3029 | 0.1643 |
fixed | NA | birth_order | -0.0003813 | 0.001296 | -0.2942 | 3433 | 0.7686 | -0.00402 | 0.003257 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009293 | 0.008932 | 1.04 | 3659 | 0.2982 | -0.01578 | 0.03436 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003114 | 0.0003059 | -1.018 | 3658 | 0.3087 | -0.00117 | 0.0005472 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003381 | 0.000003352 | 1.009 | 3656 | 0.3132 | -0.000006029 | 0.00001279 |
fixed | NA | male | -0.00321 | 0.004208 | -0.7627 | 3663 | 0.4457 | -0.01502 | 0.008602 |
fixed | NA | sibling_count3 | -0.004544 | 0.006904 | -0.6581 | 3134 | 0.5105 | -0.02392 | 0.01484 |
fixed | NA | sibling_count4 | 0.0006594 | 0.007225 | 0.09126 | 2915 | 0.9273 | -0.01962 | 0.02094 |
fixed | NA | sibling_count5 | -0.002889 | 0.008215 | -0.3516 | 2625 | 0.7251 | -0.02595 | 0.02017 |
fixed | NA | sibling_count>5 | 0.001623 | 0.008225 | 0.1974 | 2655 | 0.8435 | -0.02146 | 0.02471 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02889 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1224 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07098 | 0.08333 | -0.8518 | 3655 | 0.3944 | -0.3049 | 0.1629 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00929 | 0.008936 | 1.04 | 3655 | 0.2986 | -0.01579 | 0.03437 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003122 | 0.0003061 | -1.02 | 3654 | 0.3078 | -0.001171 | 0.000547 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003395 | 0.000003355 | 1.012 | 3653 | 0.3116 | -0.000006022 | 0.00001281 |
fixed | NA | male | -0.003165 | 0.00421 | -0.7517 | 3659 | 0.4523 | -0.01498 | 0.008654 |
fixed | NA | sibling_count3 | -0.00357 | 0.007046 | -0.5067 | 3210 | 0.6124 | -0.02335 | 0.01621 |
fixed | NA | sibling_count4 | 0.002033 | 0.007502 | 0.271 | 3076 | 0.7864 | -0.01902 | 0.02309 |
fixed | NA | sibling_count5 | -0.001211 | 0.00862 | -0.1405 | 2875 | 0.8883 | -0.02541 | 0.02299 |
fixed | NA | sibling_count>5 | 0.003208 | 0.008457 | 0.3793 | 2803 | 0.7045 | -0.02053 | 0.02695 |
fixed | NA | birth_order_nonlinear2 | 0.004487 | 0.005605 | 0.8006 | 3363 | 0.4234 | -0.01125 | 0.02022 |
fixed | NA | birth_order_nonlinear3 | -0.004523 | 0.006574 | -0.688 | 3425 | 0.4915 | -0.02297 | 0.01393 |
fixed | NA | birth_order_nonlinear4 | -0.001963 | 0.00802 | -0.2447 | 3480 | 0.8067 | -0.02448 | 0.02055 |
fixed | NA | birth_order_nonlinear5 | -0.001521 | 0.009835 | -0.1547 | 3497 | 0.8771 | -0.02913 | 0.02609 |
fixed | NA | birth_order_nonlinear>5 | -0.002346 | 0.009645 | -0.2432 | 3610 | 0.8078 | -0.02942 | 0.02473 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02914 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1224 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07149 | 0.08369 | -0.8543 | 3645 | 0.393 | -0.3064 | 0.1634 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009321 | 0.008976 | 1.038 | 3645 | 0.2992 | -0.01588 | 0.03452 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000314 | 0.0003075 | -1.021 | 3644 | 0.3074 | -0.001177 | 0.0005493 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003412 | 0.000003372 | 1.012 | 3642 | 0.3117 | -0.000006053 | 0.00001288 |
fixed | NA | male | -0.002905 | 0.004218 | -0.6887 | 3649 | 0.4911 | -0.01475 | 0.008936 |
fixed | NA | count_birth_order2/2 | 0.005885 | 0.01094 | 0.5379 | 3367 | 0.5907 | -0.02483 | 0.0366 |
fixed | NA | count_birth_order1/3 | -0.004307 | 0.009118 | -0.4724 | 3648 | 0.6367 | -0.0299 | 0.02129 |
fixed | NA | count_birth_order2/3 | 0.001187 | 0.01014 | 0.1171 | 3650 | 0.9068 | -0.02727 | 0.02965 |
fixed | NA | count_birth_order3/3 | -0.005007 | 0.01105 | -0.4533 | 3650 | 0.6504 | -0.03601 | 0.026 |
fixed | NA | count_birth_order1/4 | 0.0067 | 0.01046 | 0.6405 | 3649 | 0.5219 | -0.02267 | 0.03607 |
fixed | NA | count_birth_order2/4 | 0.005103 | 0.01109 | 0.4601 | 3650 | 0.6455 | -0.02603 | 0.03624 |
fixed | NA | count_birth_order3/4 | 0.001785 | 0.0115 | 0.1551 | 3649 | 0.8767 | -0.03051 | 0.03408 |
fixed | NA | count_birth_order4/4 | -0.008181 | 0.01232 | -0.6643 | 3649 | 0.5065 | -0.04275 | 0.02639 |
fixed | NA | count_birth_order1/5 | -0.005837 | 0.01378 | -0.4236 | 3650 | 0.6719 | -0.04452 | 0.03285 |
fixed | NA | count_birth_order2/5 | 0.01789 | 0.01487 | 1.203 | 3649 | 0.2291 | -0.02385 | 0.05963 |
fixed | NA | count_birth_order3/5 | -0.01558 | 0.01414 | -1.102 | 3648 | 0.2705 | -0.05526 | 0.0241 |
fixed | NA | count_birth_order4/5 | -0.006235 | 0.01379 | -0.4522 | 3647 | 0.6512 | -0.04494 | 0.03247 |
fixed | NA | count_birth_order5/5 | 0.005751 | 0.01451 | 0.3963 | 3646 | 0.6919 | -0.03499 | 0.04649 |
fixed | NA | count_birth_order1/>5 | 0.005701 | 0.01305 | 0.4368 | 3648 | 0.6623 | -0.03093 | 0.04233 |
fixed | NA | count_birth_order2/>5 | 0.0003942 | 0.01316 | 0.02996 | 3650 | 0.9761 | -0.03654 | 0.03733 |
fixed | NA | count_birth_order3/>5 | -0.001544 | 0.01284 | -0.1203 | 3649 | 0.9043 | -0.03759 | 0.0345 |
fixed | NA | count_birth_order4/>5 | 0.01352 | 0.01257 | 1.076 | 3647 | 0.2821 | -0.02176 | 0.04881 |
fixed | NA | count_birth_order5/>5 | -0.002532 | 0.01201 | -0.2108 | 3648 | 0.8331 | -0.03626 | 0.03119 |
fixed | NA | count_birth_order>5/>5 | 0.001374 | 0.009344 | 0.147 | 3463 | 0.8831 | -0.02485 | 0.0276 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02937 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1224 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -4799 | -4731 | 2410 | -4821 | NA | NA | NA |
12 | -4797 | -4723 | 2411 | -4821 | 0.08637 | 1 | 0.7688 |
16 | -4791 | -4692 | 2411 | -4823 | 1.815 | 4 | 0.7697 |
26 | -4777 | -4615 | 2414 | -4829 | 5.762 | 10 | 0.8349 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07294 | 0.08327 | -0.8759 | 3684 | 0.3811 | -0.3067 | 0.1608 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009914 | 0.00894 | 1.109 | 3684 | 0.2676 | -0.01518 | 0.03501 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003348 | 0.0003063 | -1.093 | 3683 | 0.2745 | -0.001195 | 0.0005251 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003659 | 0.000003359 | 1.089 | 3680 | 0.276 | -0.000005769 | 0.00001309 |
fixed | NA | male | -0.003755 | 0.004214 | -0.8909 | 3688 | 0.373 | -0.01558 | 0.008075 |
fixed | NA | sibling_count3 | -0.005675 | 0.007576 | -0.7491 | 3192 | 0.4538 | -0.02694 | 0.01559 |
fixed | NA | sibling_count4 | -0.005706 | 0.007633 | -0.7476 | 3051 | 0.4548 | -0.02713 | 0.01572 |
fixed | NA | sibling_count5 | -0.00168 | 0.008027 | -0.2093 | 2841 | 0.8342 | -0.02421 | 0.02085 |
fixed | NA | sibling_count>5 | -0.00157 | 0.007039 | -0.2231 | 2877 | 0.8235 | -0.02133 | 0.01819 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02896 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.123 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07311 | 0.08329 | -0.8777 | 3683 | 0.3801 | -0.3069 | 0.1607 |
fixed | NA | birth_order | -0.0002085 | 0.001148 | -0.1815 | 3335 | 0.856 | -0.003432 | 0.003015 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009956 | 0.008945 | 1.113 | 3682 | 0.2658 | -0.01515 | 0.03506 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003358 | 0.0003064 | -1.096 | 3681 | 0.2733 | -0.001196 | 0.0005244 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000366 | 0.000003359 | 1.09 | 3679 | 0.2759 | -0.000005769 | 0.00001309 |
fixed | NA | male | -0.003746 | 0.004215 | -0.8887 | 3687 | 0.3742 | -0.01558 | 0.008086 |
fixed | NA | sibling_count3 | -0.005571 | 0.007599 | -0.7331 | 3188 | 0.4636 | -0.0269 | 0.01576 |
fixed | NA | sibling_count4 | -0.005497 | 0.007721 | -0.7119 | 3038 | 0.4766 | -0.02717 | 0.01618 |
fixed | NA | sibling_count5 | -0.001332 | 0.008257 | -0.1613 | 2837 | 0.8719 | -0.02451 | 0.02184 |
fixed | NA | sibling_count>5 | -0.0008368 | 0.008118 | -0.1031 | 2879 | 0.9179 | -0.02362 | 0.02195 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02901 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1231 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07406 | 0.08335 | -0.8886 | 3679 | 0.3743 | -0.308 | 0.1599 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.009711 | 0.008946 | 1.086 | 3679 | 0.2778 | -0.0154 | 0.03482 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0003301 | 0.0003065 | -1.077 | 3678 | 0.2815 | -0.001191 | 0.0005302 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003623 | 0.000003361 | 1.078 | 3676 | 0.281 | -0.00000581 | 0.00001306 |
fixed | NA | male | -0.003724 | 0.004215 | -0.8835 | 3683 | 0.377 | -0.01556 | 0.008108 |
fixed | NA | sibling_count3 | -0.005213 | 0.00773 | -0.6743 | 3246 | 0.5001 | -0.02691 | 0.01649 |
fixed | NA | sibling_count4 | -0.005691 | 0.007954 | -0.7155 | 3154 | 0.4744 | -0.02802 | 0.01664 |
fixed | NA | sibling_count5 | -0.0003466 | 0.008631 | -0.04016 | 3035 | 0.968 | -0.02457 | 0.02388 |
fixed | NA | sibling_count>5 | 0.0007911 | 0.008365 | 0.09457 | 3023 | 0.9247 | -0.02269 | 0.02427 |
fixed | NA | birth_order_nonlinear2 | 0.011 | 0.005694 | 1.933 | 3397 | 0.05337 | -0.00498 | 0.02699 |
fixed | NA | birth_order_nonlinear3 | -0.001224 | 0.006636 | -0.1845 | 3474 | 0.8536 | -0.01985 | 0.0174 |
fixed | NA | birth_order_nonlinear4 | 0.005638 | 0.007857 | 0.7176 | 3538 | 0.4731 | -0.01642 | 0.02769 |
fixed | NA | birth_order_nonlinear5 | -0.003972 | 0.009571 | -0.415 | 3542 | 0.6782 | -0.03084 | 0.02289 |
fixed | NA | birth_order_nonlinear>5 | -0.00001819 | 0.008764 | -0.002076 | 3603 | 0.9983 | -0.02462 | 0.02458 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0295 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1229 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.06463 | 0.08354 | -0.7736 | 3669 | 0.4392 | -0.2991 | 0.1699 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.008684 | 0.008969 | 0.9682 | 3669 | 0.333 | -0.01649 | 0.03386 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002926 | 0.0003074 | -0.9519 | 3667 | 0.3412 | -0.001155 | 0.0005702 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000003186 | 0.000003371 | 0.9452 | 3665 | 0.3446 | -0.000006276 | 0.00001265 |
fixed | NA | male | -0.003631 | 0.004221 | -0.8603 | 3672 | 0.3897 | -0.01548 | 0.008218 |
fixed | NA | count_birth_order2/2 | 0.009313 | 0.01203 | 0.7738 | 3441 | 0.4391 | -0.02447 | 0.04309 |
fixed | NA | count_birth_order1/3 | -0.01236 | 0.01012 | -1.221 | 3672 | 0.2222 | -0.04077 | 0.01605 |
fixed | NA | count_birth_order2/3 | 0.0116 | 0.01102 | 1.052 | 3673 | 0.2927 | -0.01935 | 0.04255 |
fixed | NA | count_birth_order3/3 | -0.003213 | 0.01222 | -0.2628 | 3674 | 0.7927 | -0.03752 | 0.0311 |
fixed | NA | count_birth_order1/4 | -0.01075 | 0.01098 | -0.9789 | 3672 | 0.3277 | -0.04159 | 0.02008 |
fixed | NA | count_birth_order2/4 | 0.01045 | 0.01158 | 0.9025 | 3674 | 0.3668 | -0.02205 | 0.04294 |
fixed | NA | count_birth_order3/4 | -0.002847 | 0.01253 | -0.2271 | 3674 | 0.8203 | -0.03802 | 0.03233 |
fixed | NA | count_birth_order4/4 | -0.007088 | 0.01361 | -0.5207 | 3673 | 0.6026 | -0.0453 | 0.03113 |
fixed | NA | count_birth_order1/5 | 0.01516 | 0.01328 | 1.141 | 3674 | 0.2538 | -0.02212 | 0.05243 |
fixed | NA | count_birth_order2/5 | 0.008984 | 0.01362 | 0.6598 | 3674 | 0.5094 | -0.02924 | 0.04721 |
fixed | NA | count_birth_order3/5 | -0.01683 | 0.01401 | -1.201 | 3673 | 0.2298 | -0.05617 | 0.0225 |
fixed | NA | count_birth_order4/5 | -0.007029 | 0.01427 | -0.4927 | 3672 | 0.6223 | -0.04708 | 0.03302 |
fixed | NA | count_birth_order5/5 | 0.003691 | 0.01449 | 0.2548 | 3670 | 0.7989 | -0.03697 | 0.04436 |
fixed | NA | count_birth_order1/>5 | 0.004812 | 0.01198 | 0.4017 | 3671 | 0.6879 | -0.02881 | 0.03843 |
fixed | NA | count_birth_order2/>5 | -0.003156 | 0.01266 | -0.2493 | 3674 | 0.8032 | -0.03869 | 0.03238 |
fixed | NA | count_birth_order3/>5 | 0.0007469 | 0.0122 | 0.06123 | 3674 | 0.9512 | -0.03349 | 0.03499 |
fixed | NA | count_birth_order4/>5 | 0.01669 | 0.01185 | 1.408 | 3673 | 0.1592 | -0.01658 | 0.04995 |
fixed | NA | count_birth_order5/>5 | -0.009497 | 0.01255 | -0.7565 | 3670 | 0.4494 | -0.04473 | 0.02574 |
fixed | NA | count_birth_order>5/>5 | 0.000137 | 0.009443 | 0.01451 | 3530 | 0.9884 | -0.02637 | 0.02664 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03021 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1227 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -4793 | -4725 | 2408 | -4815 | NA | NA | NA |
12 | -4791 | -4717 | 2408 | -4815 | 0.03277 | 1 | 0.8563 |
16 | -4789 | -4689 | 2410 | -4821 | 5.725 | 4 | 0.2207 |
26 | -4781 | -4619 | 2416 | -4833 | 11.8 | 10 | 0.2989 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0498 | 0.0826 | -0.603 | 3596 | 0.5466 | -0.2817 | 0.182 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007002 | 0.008874 | 0.789 | 3596 | 0.4302 | -0.01791 | 0.03191 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002367 | 0.0003043 | -0.778 | 3594 | 0.4366 | -0.001091 | 0.0006174 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002649 | 0.000003339 | 0.7933 | 3592 | 0.4277 | -0.000006724 | 0.00001202 |
fixed | NA | male | -0.002382 | 0.004174 | -0.5707 | 3600 | 0.5683 | -0.0141 | 0.009334 |
fixed | NA | sibling_count3 | -0.00575 | 0.00661 | -0.8699 | 3113 | 0.3844 | -0.02431 | 0.0128 |
fixed | NA | sibling_count4 | 0.002621 | 0.006909 | 0.3793 | 2913 | 0.7045 | -0.01677 | 0.02202 |
fixed | NA | sibling_count5 | -0.001736 | 0.007888 | -0.22 | 2508 | 0.8259 | -0.02388 | 0.02041 |
fixed | NA | sibling_count>5 | -0.001253 | 0.006699 | -0.187 | 2492 | 0.8517 | -0.02006 | 0.01755 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02772 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1205 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.04939 | 0.08263 | -0.5978 | 3595 | 0.55 | -0.2813 | 0.1825 |
fixed | NA | birth_order | 0.0003003 | 0.001312 | 0.2289 | 3402 | 0.819 | -0.003383 | 0.003984 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.006922 | 0.008882 | 0.7793 | 3593 | 0.4358 | -0.01801 | 0.03186 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002347 | 0.0003045 | -0.7709 | 3592 | 0.4408 | -0.001089 | 0.0006199 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00000264 | 0.00000334 | 0.7903 | 3590 | 0.4294 | -0.000006736 | 0.00001201 |
fixed | NA | male | -0.002386 | 0.004174 | -0.5716 | 3599 | 0.5676 | -0.0141 | 0.009331 |
fixed | NA | sibling_count3 | -0.005903 | 0.006644 | -0.8883 | 3110 | 0.3744 | -0.02455 | 0.01275 |
fixed | NA | sibling_count4 | 0.002296 | 0.007054 | 0.3255 | 2911 | 0.7449 | -0.01751 | 0.0221 |
fixed | NA | sibling_count5 | -0.002258 | 0.008213 | -0.2749 | 2532 | 0.7834 | -0.02531 | 0.0208 |
fixed | NA | sibling_count>5 | -0.002324 | 0.008174 | -0.2844 | 2644 | 0.7762 | -0.02527 | 0.02062 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02771 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1205 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.05159 | 0.08271 | -0.6238 | 3591 | 0.5328 | -0.2837 | 0.1806 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007037 | 0.008885 | 0.792 | 3590 | 0.4284 | -0.0179 | 0.03198 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002395 | 0.0003046 | -0.7862 | 3589 | 0.4318 | -0.001094 | 0.0006156 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000027 | 0.000003342 | 0.8077 | 3587 | 0.4193 | -0.000006682 | 0.00001208 |
fixed | NA | male | -0.002368 | 0.004176 | -0.567 | 3595 | 0.5708 | -0.01409 | 0.009354 |
fixed | NA | sibling_count3 | -0.00439 | 0.006788 | -0.6468 | 3184 | 0.5178 | -0.02344 | 0.01466 |
fixed | NA | sibling_count4 | 0.00465 | 0.007327 | 0.6346 | 3063 | 0.5257 | -0.01592 | 0.02522 |
fixed | NA | sibling_count5 | 0.00009162 | 0.008584 | 0.01067 | 2760 | 0.9915 | -0.02401 | 0.02419 |
fixed | NA | sibling_count>5 | -0.0008097 | 0.008416 | -0.09621 | 2796 | 0.9234 | -0.02443 | 0.02281 |
fixed | NA | birth_order_nonlinear2 | 0.005265 | 0.005486 | 0.9597 | 3320 | 0.3373 | -0.01014 | 0.02067 |
fixed | NA | birth_order_nonlinear3 | -0.005105 | 0.006471 | -0.7888 | 3379 | 0.4303 | -0.02327 | 0.01306 |
fixed | NA | birth_order_nonlinear4 | -0.002657 | 0.008121 | -0.3272 | 3434 | 0.7435 | -0.02545 | 0.02014 |
fixed | NA | birth_order_nonlinear5 | 0.002499 | 0.01001 | 0.2497 | 3430 | 0.8029 | -0.0256 | 0.0306 |
fixed | NA | birth_order_nonlinear>5 | 0.003725 | 0.009781 | 0.3809 | 3554 | 0.7033 | -0.02373 | 0.03118 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02781 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1205 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.05244 | 0.08302 | -0.6316 | 3580 | 0.5277 | -0.2855 | 0.1806 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.007219 | 0.008922 | 0.8091 | 3579 | 0.4185 | -0.01783 | 0.03226 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0002477 | 0.000306 | -0.8097 | 3578 | 0.4182 | -0.001107 | 0.0006111 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000002801 | 0.000003358 | 0.8341 | 3575 | 0.4043 | -0.000006625 | 0.00001223 |
fixed | NA | male | -0.002176 | 0.004184 | -0.5202 | 3585 | 0.603 | -0.01392 | 0.009568 |
fixed | NA | count_birth_order2/2 | 0.004609 | 0.01046 | 0.4405 | 3320 | 0.6596 | -0.02476 | 0.03398 |
fixed | NA | count_birth_order1/3 | -0.004567 | 0.008804 | -0.5187 | 3584 | 0.604 | -0.02928 | 0.02015 |
fixed | NA | count_birth_order2/3 | -0.002892 | 0.009793 | -0.2953 | 3586 | 0.7678 | -0.03038 | 0.0246 |
fixed | NA | count_birth_order3/3 | -0.00515 | 0.01055 | -0.4882 | 3586 | 0.6255 | -0.03476 | 0.02446 |
fixed | NA | count_birth_order1/4 | 0.007362 | 0.01033 | 0.7125 | 3585 | 0.4762 | -0.02164 | 0.03637 |
fixed | NA | count_birth_order2/4 | 0.01055 | 0.01086 | 0.972 | 3586 | 0.3311 | -0.01993 | 0.04103 |
fixed | NA | count_birth_order3/4 | 0.00207 | 0.01127 | 0.1836 | 3585 | 0.8543 | -0.02957 | 0.03371 |
fixed | NA | count_birth_order4/4 | -0.007332 | 0.01224 | -0.5988 | 3585 | 0.5494 | -0.0417 | 0.02704 |
fixed | NA | count_birth_order1/5 | -0.006338 | 0.01351 | -0.4691 | 3586 | 0.639 | -0.04426 | 0.03159 |
fixed | NA | count_birth_order2/5 | 0.02056 | 0.01509 | 1.362 | 3585 | 0.1732 | -0.02181 | 0.06293 |
fixed | NA | count_birth_order3/5 | -0.01572 | 0.01472 | -1.068 | 3584 | 0.2855 | -0.05704 | 0.02559 |
fixed | NA | count_birth_order4/5 | -0.004808 | 0.01417 | -0.3393 | 3583 | 0.7344 | -0.04458 | 0.03496 |
fixed | NA | count_birth_order5/5 | 0.009342 | 0.01505 | 0.6207 | 3582 | 0.5349 | -0.03291 | 0.05159 |
fixed | NA | count_birth_order1/>5 | -0.001178 | 0.01317 | -0.0895 | 3584 | 0.9287 | -0.03814 | 0.03578 |
fixed | NA | count_birth_order2/>5 | 0.001312 | 0.01332 | 0.0985 | 3586 | 0.9215 | -0.03607 | 0.0387 |
fixed | NA | count_birth_order3/>5 | -0.009649 | 0.01272 | -0.7588 | 3586 | 0.448 | -0.04534 | 0.02605 |
fixed | NA | count_birth_order4/>5 | 0.007954 | 0.01277 | 0.6227 | 3583 | 0.5335 | -0.0279 | 0.04381 |
fixed | NA | count_birth_order5/>5 | -0.002177 | 0.01199 | -0.1815 | 3584 | 0.856 | -0.03584 | 0.03148 |
fixed | NA | count_birth_order>5/>5 | 0.002798 | 0.009292 | 0.3011 | 3378 | 0.7634 | -0.02329 | 0.02888 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.02796 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1206 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -4839 | -4771 | 2430 | -4861 | NA | NA | NA |
12 | -4837 | -4762 | 2430 | -4861 | 0.05301 | 1 | 0.8179 |
16 | -4832 | -4732 | 2432 | -4864 | 2.872 | 4 | 0.5795 |
26 | -4817 | -4656 | 2434 | -4869 | 5.404 | 10 | 0.8626 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Sector_Finance, insurance, real estate and business services`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07441 | 0.09233 | -0.8059 | 9530 | 0.4203 | -0.3336 | 0.1848 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02539 | 0.008265 | 3.072 | 9465 | 0.002134 | 0.002188 | 0.04859 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0006471 | 0.0002316 | -2.795 | 9346 | 0.005207 | -0.001297 | 0.000002882 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005081 | 0.000002052 | 2.476 | 9211 | 0.01331 | -0.0000006795 | 0.00001084 |
fixed | NA | male | 0.0594 | 0.008556 | 6.943 | 9661 | 4.073e-12 | 0.03539 | 0.08342 |
fixed | NA | sibling_count3 | -0.007552 | 0.01779 | -0.4245 | 7229 | 0.6712 | -0.05748 | 0.04238 |
fixed | NA | sibling_count4 | -0.02384 | 0.01795 | -1.328 | 6797 | 0.1842 | -0.07424 | 0.02655 |
fixed | NA | sibling_count5 | -0.02626 | 0.01865 | -1.407 | 6338 | 0.1593 | -0.07862 | 0.02611 |
fixed | NA | sibling_count>5 | -0.05315 | 0.0145 | -3.664 | 7081 | 0.00025 | -0.09386 | -0.01243 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1381 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3954 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07441 | 0.09233 | -0.8059 | 9528 | 0.4203 | -0.3336 | 0.1848 |
fixed | NA | birth_order | 0.0000267 | 0.001729 | 0.01544 | 8590 | 0.9877 | -0.004828 | 0.004881 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02538 | 0.008279 | 3.066 | 9455 | 0.002179 | 0.00214 | 0.04862 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0006469 | 0.0002322 | -2.785 | 9308 | 0.005357 | -0.001299 | 0.000005026 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005079 | 0.000002058 | 2.467 | 9156 | 0.01363 | -0.0000006991 | 0.00001086 |
fixed | NA | male | 0.0594 | 0.008556 | 6.943 | 9660 | 4.087e-12 | 0.03539 | 0.08342 |
fixed | NA | sibling_count3 | -0.007559 | 0.01779 | -0.4248 | 7240 | 0.671 | -0.05751 | 0.04239 |
fixed | NA | sibling_count4 | -0.02386 | 0.01799 | -1.327 | 6843 | 0.1847 | -0.07435 | 0.02663 |
fixed | NA | sibling_count5 | -0.02628 | 0.01875 | -1.402 | 6425 | 0.1609 | -0.07891 | 0.02634 |
fixed | NA | sibling_count>5 | -0.05324 | 0.01573 | -3.386 | 7806 | 0.0007137 | -0.09738 | -0.009099 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1381 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3954 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.07779 | 0.09248 | -0.8411 | 9533 | 0.4003 | -0.3374 | 0.1818 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02597 | 0.008287 | 3.134 | 9457 | 0.001729 | 0.002711 | 0.04923 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0006675 | 0.0002324 | -2.872 | 9313 | 0.004084 | -0.00132 | -0.00001518 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005269 | 0.000002059 | 2.558 | 9158 | 0.01053 | -0.000000512 | 0.00001105 |
fixed | NA | male | 0.05941 | 0.008557 | 6.943 | 9656 | 4.091e-12 | 0.03539 | 0.08343 |
fixed | NA | sibling_count3 | -0.01047 | 0.01806 | -0.58 | 7487 | 0.5619 | -0.06116 | 0.04021 |
fixed | NA | sibling_count4 | -0.02378 | 0.01848 | -1.287 | 7308 | 0.1981 | -0.07566 | 0.02809 |
fixed | NA | sibling_count5 | -0.02538 | 0.01939 | -1.309 | 7012 | 0.1906 | -0.0798 | 0.02904 |
fixed | NA | sibling_count>5 | -0.0482 | 0.01647 | -2.927 | 8436 | 0.003436 | -0.09444 | -0.001969 |
fixed | NA | birth_order_nonlinear2 | -0.0008122 | 0.01249 | -0.06505 | 8957 | 0.9481 | -0.03586 | 0.03423 |
fixed | NA | birth_order_nonlinear3 | 0.01115 | 0.0145 | 0.7694 | 8796 | 0.4417 | -0.02954 | 0.05185 |
fixed | NA | birth_order_nonlinear4 | -0.01657 | 0.0163 | -1.016 | 8869 | 0.3094 | -0.06233 | 0.02919 |
fixed | NA | birth_order_nonlinear5 | -0.005199 | 0.01831 | -0.2839 | 8915 | 0.7765 | -0.0566 | 0.04621 |
fixed | NA | birth_order_nonlinear>5 | -0.01029 | 0.01518 | -0.6782 | 9740 | 0.4976 | -0.0529 | 0.03231 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1378 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3955 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.06935 | 0.09283 | -0.7471 | 9535 | 0.455 | -0.3299 | 0.1912 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02651 | 0.008296 | 3.195 | 9448 | 0.001401 | 0.003222 | 0.04979 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0006742 | 0.0002325 | -2.899 | 9302 | 0.003748 | -0.001327 | -0.00002148 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000005249 | 0.00000206 | 2.548 | 9145 | 0.01087 | -0.0000005347 | 0.00001103 |
fixed | NA | male | 0.05988 | 0.008562 | 6.994 | 9646 | 2.849e-12 | 0.03585 | 0.08391 |
fixed | NA | count_birth_order2/2 | -0.04629 | 0.02487 | -1.861 | 8848 | 0.06278 | -0.1161 | 0.02353 |
fixed | NA | count_birth_order1/3 | -0.01612 | 0.02398 | -0.6721 | 9657 | 0.5015 | -0.08345 | 0.05121 |
fixed | NA | count_birth_order2/3 | -0.02574 | 0.02667 | -0.9651 | 9693 | 0.3345 | -0.1006 | 0.04912 |
fixed | NA | count_birth_order3/3 | -0.04184 | 0.02927 | -1.429 | 9712 | 0.1529 | -0.124 | 0.04032 |
fixed | NA | count_birth_order1/4 | -0.05395 | 0.02639 | -2.044 | 9695 | 0.04093 | -0.128 | 0.02012 |
fixed | NA | count_birth_order2/4 | -0.02768 | 0.0283 | -0.978 | 9706 | 0.3281 | -0.1071 | 0.05176 |
fixed | NA | count_birth_order3/4 | -0.02782 | 0.02984 | -0.9325 | 9718 | 0.3511 | -0.1116 | 0.05593 |
fixed | NA | count_birth_order4/4 | -0.05826 | 0.03211 | -1.814 | 9726 | 0.06971 | -0.1484 | 0.03189 |
fixed | NA | count_birth_order1/5 | -0.05281 | 0.02975 | -1.775 | 9720 | 0.07586 | -0.1363 | 0.03069 |
fixed | NA | count_birth_order2/5 | -0.02327 | 0.03158 | -0.7369 | 9724 | 0.4612 | -0.1119 | 0.06537 |
fixed | NA | count_birth_order3/5 | -0.02847 | 0.03321 | -0.8573 | 9729 | 0.3913 | -0.1217 | 0.06476 |
fixed | NA | count_birth_order4/5 | -0.09112 | 0.03505 | -2.6 | 9727 | 0.009348 | -0.1895 | 0.007271 |
fixed | NA | count_birth_order5/5 | -0.03226 | 0.03512 | -0.9184 | 9730 | 0.3584 | -0.1309 | 0.06634 |
fixed | NA | count_birth_order1/>5 | -0.08272 | 0.023 | -3.596 | 9728 | 0.0003251 | -0.1473 | -0.01814 |
fixed | NA | count_birth_order2/>5 | -0.06344 | 0.02391 | -2.654 | 9730 | 0.007977 | -0.1306 | 0.003668 |
fixed | NA | count_birth_order3/>5 | -0.04458 | 0.02366 | -1.884 | 9730 | 0.05959 | -0.111 | 0.02184 |
fixed | NA | count_birth_order4/>5 | -0.07335 | 0.02319 | -3.163 | 9729 | 0.001565 | -0.1384 | -0.008259 |
fixed | NA | count_birth_order5/>5 | -0.0759 | 0.02343 | -3.239 | 9730 | 0.001205 | -0.1417 | -0.01012 |
fixed | NA | count_birth_order>5/>5 | -0.07606 | 0.01898 | -4.007 | 8923 | 0.00006187 | -0.1293 | -0.02278 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1378 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3956 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 10644 | 10723 | -5311 | 10622 | NA | NA | NA |
12 | 10646 | 10732 | -5311 | 10622 | 0.0002311 | 1 | 0.9879 |
16 | 10651 | 10766 | -5309 | 10619 | 3.022 | 4 | 0.5542 |
26 | 10661 | 10848 | -5305 | 10609 | 9.616 | 10 | 0.4748 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5687 | 0.2886 | -1.971 | 3661 | 0.04884 | -1.379 | 0.2413 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0821 | 0.03095 | 2.653 | 3661 | 0.008023 | -0.004781 | 0.169 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002522 | 0.00106 | -2.378 | 3661 | 0.01744 | -0.005498 | 0.0004544 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002507 | 0.00001162 | 2.157 | 3659 | 0.03108 | -0.000007557 | 0.0000577 |
fixed | NA | male | 0.05418 | 0.01459 | 3.715 | 3662 | 0.0002064 | 0.01324 | 0.09512 |
fixed | NA | sibling_count3 | -0.03401 | 0.02387 | -1.424 | 3039 | 0.1544 | -0.101 | 0.03301 |
fixed | NA | sibling_count4 | -0.04521 | 0.02461 | -1.837 | 2803 | 0.06634 | -0.1143 | 0.02388 |
fixed | NA | sibling_count5 | -0.09774 | 0.02738 | -3.57 | 2460 | 0.000364 | -0.1746 | -0.02089 |
fixed | NA | sibling_count>5 | -0.08594 | 0.02364 | -3.636 | 2414 | 0.0002831 | -0.1523 | -0.01959 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1082 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4226 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5687 | 0.2886 | -1.97 | 3660 | 0.04887 | -1.379 | 0.2415 |
fixed | NA | birth_order | -0.00005679 | 0.004499 | -0.01262 | 3418 | 0.9899 | -0.01269 | 0.01257 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08212 | 0.03097 | 2.651 | 3659 | 0.008057 | -0.004829 | 0.1691 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002522 | 0.001061 | -2.378 | 3659 | 0.01747 | -0.0055 | 0.0004554 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002507 | 0.00001163 | 2.157 | 3657 | 0.0311 | -0.000007561 | 0.0000577 |
fixed | NA | male | 0.05418 | 0.01459 | 3.714 | 3661 | 0.0002069 | 0.01323 | 0.09514 |
fixed | NA | sibling_count3 | -0.03398 | 0.02398 | -1.417 | 3036 | 0.1566 | -0.1013 | 0.03334 |
fixed | NA | sibling_count4 | -0.04515 | 0.02511 | -1.798 | 2796 | 0.07225 | -0.1156 | 0.02533 |
fixed | NA | sibling_count5 | -0.09764 | 0.02856 | -3.419 | 2488 | 0.0006391 | -0.1778 | -0.01747 |
fixed | NA | sibling_count>5 | -0.08574 | 0.02859 | -2.999 | 2527 | 0.002739 | -0.166 | -0.005476 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1083 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4226 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5737 | 0.2889 | -1.986 | 3656 | 0.04713 | -1.385 | 0.2373 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08249 | 0.03098 | 2.662 | 3656 | 0.007795 | -0.004485 | 0.1695 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002533 | 0.001061 | -2.387 | 3655 | 0.01703 | -0.005512 | 0.0004457 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002515 | 0.00001163 | 2.162 | 3654 | 0.03067 | -0.000007502 | 0.00005781 |
fixed | NA | male | 0.05423 | 0.01459 | 3.715 | 3657 | 0.0002059 | 0.01326 | 0.09519 |
fixed | NA | sibling_count3 | -0.02672 | 0.02446 | -1.092 | 3126 | 0.2748 | -0.09537 | 0.04194 |
fixed | NA | sibling_count4 | -0.03303 | 0.02605 | -1.268 | 2977 | 0.2049 | -0.1061 | 0.04009 |
fixed | NA | sibling_count5 | -0.08304 | 0.02994 | -2.773 | 2757 | 0.005585 | -0.1671 | 0.001008 |
fixed | NA | sibling_count>5 | -0.07479 | 0.02938 | -2.546 | 2686 | 0.01096 | -0.1573 | 0.007675 |
fixed | NA | birth_order_nonlinear2 | 0.004422 | 0.01941 | 0.2278 | 3302 | 0.8198 | -0.05006 | 0.0589 |
fixed | NA | birth_order_nonlinear3 | -0.03044 | 0.02277 | -1.337 | 3372 | 0.1813 | -0.09435 | 0.03346 |
fixed | NA | birth_order_nonlinear4 | -0.02453 | 0.02778 | -0.8831 | 3436 | 0.3772 | -0.1025 | 0.05345 |
fixed | NA | birth_order_nonlinear5 | -0.01353 | 0.03407 | -0.3972 | 3455 | 0.6913 | -0.1092 | 0.0821 |
fixed | NA | birth_order_nonlinear>5 | -0.002097 | 0.03345 | -0.06269 | 3611 | 0.95 | -0.096 | 0.09181 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1081 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4227 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5355 | 0.2901 | -1.846 | 3645 | 0.06495 | -1.35 | 0.2787 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07959 | 0.03111 | 2.558 | 3645 | 0.01057 | -0.007747 | 0.1669 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002426 | 0.001066 | -2.276 | 3644 | 0.02293 | -0.005418 | 0.0005666 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002391 | 0.00001169 | 2.046 | 3642 | 0.04087 | -0.000008899 | 0.00005671 |
fixed | NA | male | 0.05452 | 0.01462 | 3.73 | 3647 | 0.0001947 | 0.01349 | 0.09556 |
fixed | NA | count_birth_order2/2 | -0.03903 | 0.03789 | -1.03 | 3315 | 0.3031 | -0.1454 | 0.06733 |
fixed | NA | count_birth_order1/3 | -0.04971 | 0.03161 | -1.573 | 3647 | 0.1158 | -0.1384 | 0.039 |
fixed | NA | count_birth_order2/3 | -0.01491 | 0.03514 | -0.4244 | 3649 | 0.6713 | -0.1135 | 0.08372 |
fixed | NA | count_birth_order3/3 | -0.08276 | 0.03828 | -2.162 | 3650 | 0.0307 | -0.1902 | 0.0247 |
fixed | NA | count_birth_order1/4 | -0.05126 | 0.03626 | -1.414 | 3648 | 0.1576 | -0.153 | 0.05053 |
fixed | NA | count_birth_order2/4 | -0.05105 | 0.03844 | -1.328 | 3650 | 0.1843 | -0.159 | 0.05687 |
fixed | NA | count_birth_order3/4 | -0.09079 | 0.03987 | -2.277 | 3649 | 0.02283 | -0.2027 | 0.02113 |
fixed | NA | count_birth_order4/4 | -0.03882 | 0.04268 | -0.9094 | 3649 | 0.3632 | -0.1586 | 0.08099 |
fixed | NA | count_birth_order1/5 | -0.1067 | 0.04777 | -2.234 | 3650 | 0.02554 | -0.2408 | 0.02737 |
fixed | NA | count_birth_order2/5 | -0.08707 | 0.05153 | -1.69 | 3648 | 0.0912 | -0.2317 | 0.05759 |
fixed | NA | count_birth_order3/5 | -0.1337 | 0.04899 | -2.728 | 3648 | 0.006396 | -0.2712 | 0.003856 |
fixed | NA | count_birth_order4/5 | -0.1599 | 0.04779 | -3.345 | 3646 | 0.0008298 | -0.294 | -0.02573 |
fixed | NA | count_birth_order5/5 | -0.05661 | 0.0503 | -1.126 | 3644 | 0.2604 | -0.1978 | 0.08457 |
fixed | NA | count_birth_order1/>5 | -0.09304 | 0.04523 | -2.057 | 3648 | 0.03977 | -0.22 | 0.03393 |
fixed | NA | count_birth_order2/>5 | -0.07479 | 0.0456 | -1.64 | 3650 | 0.101 | -0.2028 | 0.0532 |
fixed | NA | count_birth_order3/>5 | -0.08138 | 0.0445 | -1.829 | 3648 | 0.06752 | -0.2063 | 0.04353 |
fixed | NA | count_birth_order4/>5 | -0.1182 | 0.04357 | -2.712 | 3646 | 0.006714 | -0.2404 | 0.004128 |
fixed | NA | count_birth_order5/>5 | -0.1354 | 0.04163 | -3.253 | 3646 | 0.001154 | -0.2523 | -0.01855 |
fixed | NA | count_birth_order>5/>5 | -0.0913 | 0.03241 | -2.817 | 3435 | 0.004868 | -0.1823 | -0.0003379 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1074 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.423 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4337 | 4406 | -2158 | 4315 | NA | NA | NA |
12 | 4339 | 4414 | -2158 | 4315 | 0.00009047 | 1 | 0.9924 |
16 | 4344 | 4444 | -2156 | 4312 | 2.997 | 4 | 0.5583 |
26 | 4357 | 4518 | -2152 | 4305 | 7.716 | 10 | 0.6566 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5662 | 0.2875 | -1.97 | 3685 | 0.04896 | -1.373 | 0.2407 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08105 | 0.03086 | 2.626 | 3685 | 0.008667 | -0.005577 | 0.1677 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002488 | 0.001058 | -2.353 | 3684 | 0.01867 | -0.005457 | 0.00048 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002469 | 0.0000116 | 2.129 | 3682 | 0.03331 | -0.000007861 | 0.00005723 |
fixed | NA | male | 0.05379 | 0.01454 | 3.699 | 3686 | 0.0002198 | 0.01297 | 0.09462 |
fixed | NA | sibling_count3 | -0.01975 | 0.0262 | -0.7539 | 3108 | 0.4509 | -0.09329 | 0.05379 |
fixed | NA | sibling_count4 | -0.03216 | 0.0264 | -1.218 | 2954 | 0.2233 | -0.1063 | 0.04196 |
fixed | NA | sibling_count5 | -0.07215 | 0.02778 | -2.597 | 2729 | 0.00945 | -0.1501 | 0.00583 |
fixed | NA | sibling_count>5 | -0.07094 | 0.02436 | -2.912 | 2772 | 0.003615 | -0.1393 | -0.002567 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1094 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4225 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5664 | 0.2875 | -1.97 | 3684 | 0.04893 | -1.373 | 0.2407 |
fixed | NA | birth_order | -0.0002095 | 0.00397 | -0.05278 | 3318 | 0.9579 | -0.01135 | 0.01093 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0811 | 0.03088 | 2.626 | 3683 | 0.008664 | -0.005577 | 0.1678 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002489 | 0.001058 | -2.353 | 3683 | 0.01866 | -0.005459 | 0.0004799 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002469 | 0.0000116 | 2.129 | 3681 | 0.03332 | -0.000007863 | 0.00005724 |
fixed | NA | male | 0.0538 | 0.01455 | 3.699 | 3685 | 0.0002199 | 0.01297 | 0.09464 |
fixed | NA | sibling_count3 | -0.01965 | 0.02628 | -0.7476 | 3102 | 0.4547 | -0.09341 | 0.05412 |
fixed | NA | sibling_count4 | -0.03195 | 0.02671 | -1.196 | 2940 | 0.2317 | -0.1069 | 0.04302 |
fixed | NA | sibling_count5 | -0.0718 | 0.02857 | -2.513 | 2725 | 0.01204 | -0.152 | 0.008414 |
fixed | NA | sibling_count>5 | -0.0702 | 0.02809 | -2.499 | 2777 | 0.01251 | -0.1491 | 0.00865 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1096 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4225 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.578 | 0.2878 | -2.008 | 3680 | 0.04468 | -1.386 | 0.2298 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08201 | 0.03089 | 2.655 | 3680 | 0.007962 | -0.004692 | 0.1687 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002519 | 0.001058 | -2.38 | 3680 | 0.01736 | -0.005489 | 0.0004519 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002491 | 0.0000116 | 2.147 | 3678 | 0.03186 | -0.000007659 | 0.00005749 |
fixed | NA | male | 0.05398 | 0.01455 | 3.71 | 3681 | 0.0002105 | 0.01314 | 0.09482 |
fixed | NA | sibling_count3 | -0.01423 | 0.02673 | -0.5325 | 3168 | 0.5945 | -0.08927 | 0.0608 |
fixed | NA | sibling_count4 | -0.01948 | 0.02751 | -0.7081 | 3066 | 0.4789 | -0.09671 | 0.05775 |
fixed | NA | sibling_count5 | -0.05724 | 0.02986 | -1.917 | 2939 | 0.05532 | -0.1411 | 0.02657 |
fixed | NA | sibling_count>5 | -0.05202 | 0.02894 | -1.798 | 2932 | 0.07236 | -0.1333 | 0.02922 |
fixed | NA | birth_order_nonlinear2 | 0.01072 | 0.01963 | 0.5459 | 3341 | 0.5851 | -0.04439 | 0.06582 |
fixed | NA | birth_order_nonlinear3 | -0.02222 | 0.02288 | -0.9713 | 3427 | 0.3315 | -0.08645 | 0.042 |
fixed | NA | birth_order_nonlinear4 | -0.03943 | 0.0271 | -1.455 | 3502 | 0.1457 | -0.1155 | 0.03663 |
fixed | NA | birth_order_nonlinear5 | -0.007367 | 0.03301 | -0.2232 | 3504 | 0.8234 | -0.1 | 0.08529 |
fixed | NA | birth_order_nonlinear>5 | -0.01766 | 0.03028 | -0.5834 | 3604 | 0.5597 | -0.1026 | 0.06732 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1108 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4222 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.512 | 0.2882 | -1.776 | 3669 | 0.07576 | -1.321 | 0.2971 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.07721 | 0.03094 | 2.495 | 3669 | 0.01263 | -0.009649 | 0.1641 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002343 | 0.001061 | -2.209 | 3668 | 0.02725 | -0.005319 | 0.0006344 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002292 | 0.00001163 | 1.97 | 3666 | 0.04887 | -0.000009731 | 0.00005556 |
fixed | NA | male | 0.05323 | 0.01456 | 3.656 | 3671 | 0.0002601 | 0.01236 | 0.09411 |
fixed | NA | count_birth_order2/2 | -0.06461 | 0.04148 | -1.558 | 3403 | 0.1194 | -0.1811 | 0.05183 |
fixed | NA | count_birth_order1/3 | -0.0366 | 0.03492 | -1.048 | 3670 | 0.2946 | -0.1346 | 0.06142 |
fixed | NA | count_birth_order2/3 | -0.01324 | 0.03804 | -0.348 | 3673 | 0.7279 | -0.12 | 0.09353 |
fixed | NA | count_birth_order3/3 | -0.08953 | 0.04217 | -2.123 | 3674 | 0.0338 | -0.2079 | 0.02884 |
fixed | NA | count_birth_order1/4 | -0.08289 | 0.0379 | -2.187 | 3672 | 0.02879 | -0.1893 | 0.02349 |
fixed | NA | count_birth_order2/4 | 0.00127 | 0.03994 | 0.03181 | 3674 | 0.9746 | -0.1108 | 0.1134 |
fixed | NA | count_birth_order3/4 | -0.08315 | 0.04323 | -1.923 | 3673 | 0.05453 | -0.2045 | 0.03821 |
fixed | NA | count_birth_order4/4 | -0.04866 | 0.04696 | -1.036 | 3672 | 0.3002 | -0.1805 | 0.08316 |
fixed | NA | count_birth_order1/5 | -0.06946 | 0.04581 | -1.516 | 3674 | 0.1296 | -0.1981 | 0.05914 |
fixed | NA | count_birth_order2/5 | -0.1132 | 0.04698 | -2.409 | 3674 | 0.01604 | -0.245 | 0.01869 |
fixed | NA | count_birth_order3/5 | -0.1311 | 0.04834 | -2.712 | 3672 | 0.006716 | -0.2668 | 0.004586 |
fixed | NA | count_birth_order4/5 | -0.1211 | 0.04921 | -2.46 | 3671 | 0.01395 | -0.2592 | 0.0171 |
fixed | NA | count_birth_order5/5 | -0.03203 | 0.04997 | -0.641 | 3668 | 0.5216 | -0.1723 | 0.1082 |
fixed | NA | count_birth_order1/>5 | -0.08991 | 0.04133 | -2.176 | 3670 | 0.02964 | -0.2059 | 0.02609 |
fixed | NA | count_birth_order2/>5 | -0.04979 | 0.04368 | -1.14 | 3674 | 0.2543 | -0.1724 | 0.0728 |
fixed | NA | count_birth_order3/>5 | -0.04301 | 0.04208 | -1.022 | 3673 | 0.3068 | -0.1611 | 0.07511 |
fixed | NA | count_birth_order4/>5 | -0.1407 | 0.04088 | -3.442 | 3672 | 0.0005847 | -0.2555 | -0.02594 |
fixed | NA | count_birth_order5/>5 | -0.1239 | 0.0433 | -2.86 | 3668 | 0.004254 | -0.2454 | -0.002313 |
fixed | NA | count_birth_order>5/>5 | -0.09545 | 0.0326 | -2.928 | 3509 | 0.003433 | -0.1869 | -0.003945 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1099 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.422 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4369 | 4437 | -2173 | 4347 | NA | NA | NA |
12 | 4371 | 4445 | -2173 | 4347 | 0.00247 | 1 | 0.9604 |
16 | 4375 | 4474 | -2171 | 4343 | 4.144 | 4 | 0.3868 |
26 | 4378 | 4539 | -2163 | 4326 | 16.88 | 10 | 0.07713 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5595 | 0.2914 | -1.92 | 3597 | 0.05495 | -1.377 | 0.2585 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0817 | 0.03131 | 2.609 | 3597 | 0.009112 | -0.006192 | 0.1696 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0025 | 0.001074 | -2.329 | 3597 | 0.01992 | -0.005514 | 0.0005134 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002474 | 0.00001178 | 2.1 | 3595 | 0.03583 | -0.000008335 | 0.00005781 |
fixed | NA | male | 0.05654 | 0.01472 | 3.841 | 3598 | 0.0001245 | 0.01522 | 0.09786 |
fixed | NA | sibling_count3 | -0.05676 | 0.02338 | -2.427 | 2984 | 0.01526 | -0.1224 | 0.008876 |
fixed | NA | sibling_count4 | -0.04937 | 0.02446 | -2.019 | 2758 | 0.04362 | -0.118 | 0.01928 |
fixed | NA | sibling_count5 | -0.1102 | 0.02796 | -3.94 | 2318 | 0.00008386 | -0.1886 | -0.03168 |
fixed | NA | sibling_count>5 | -0.09375 | 0.02374 | -3.949 | 2307 | 0.00008091 | -0.1604 | -0.02711 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1108 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.422 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5626 | 0.2915 | -1.93 | 3596 | 0.0537 | -1.381 | 0.2557 |
fixed | NA | birth_order | -0.002165 | 0.004637 | -0.467 | 3394 | 0.6405 | -0.01518 | 0.01085 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08229 | 0.03134 | 2.626 | 3595 | 0.008682 | -0.00568 | 0.1703 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002516 | 0.001074 | -2.342 | 3595 | 0.01924 | -0.005531 | 0.0004997 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002481 | 0.00001178 | 2.105 | 3593 | 0.03532 | -0.000008268 | 0.00005789 |
fixed | NA | male | 0.05657 | 0.01472 | 3.843 | 3597 | 0.0001237 | 0.01525 | 0.0979 |
fixed | NA | sibling_count3 | -0.05566 | 0.02351 | -2.368 | 2981 | 0.01796 | -0.1216 | 0.01033 |
fixed | NA | sibling_count4 | -0.04701 | 0.02497 | -1.882 | 2757 | 0.05988 | -0.1171 | 0.02309 |
fixed | NA | sibling_count5 | -0.1064 | 0.02911 | -3.654 | 2347 | 0.0002637 | -0.1881 | -0.02466 |
fixed | NA | sibling_count>5 | -0.08602 | 0.02896 | -2.97 | 2481 | 0.003008 | -0.1673 | -0.004717 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1114 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4219 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5677 | 0.2918 | -1.946 | 3592 | 0.05178 | -1.387 | 0.2514 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08282 | 0.03135 | 2.642 | 3592 | 0.008283 | -0.005181 | 0.1708 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002528 | 0.001075 | -2.352 | 3591 | 0.01871 | -0.005545 | 0.0004888 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002487 | 0.00001179 | 2.108 | 3590 | 0.03506 | -0.000008238 | 0.00005797 |
fixed | NA | male | 0.05634 | 0.01473 | 3.826 | 3593 | 0.0001327 | 0.015 | 0.09768 |
fixed | NA | sibling_count3 | -0.04861 | 0.024 | -2.025 | 3073 | 0.04297 | -0.116 | 0.01878 |
fixed | NA | sibling_count4 | -0.03533 | 0.02592 | -1.363 | 2934 | 0.1731 | -0.1081 | 0.03744 |
fixed | NA | sibling_count5 | -0.09458 | 0.0304 | -3.111 | 2597 | 0.001882 | -0.1799 | -0.009255 |
fixed | NA | sibling_count>5 | -0.07499 | 0.0298 | -2.517 | 2648 | 0.01191 | -0.1586 | 0.008652 |
fixed | NA | birth_order_nonlinear2 | -0.01061 | 0.01931 | -0.5491 | 3236 | 0.5829 | -0.06482 | 0.04361 |
fixed | NA | birth_order_nonlinear3 | -0.03414 | 0.02279 | -1.499 | 3306 | 0.1341 | -0.0981 | 0.02982 |
fixed | NA | birth_order_nonlinear4 | -0.03378 | 0.0286 | -1.181 | 3372 | 0.2377 | -0.1141 | 0.04651 |
fixed | NA | birth_order_nonlinear5 | -0.01735 | 0.03526 | -0.4922 | 3364 | 0.6226 | -0.1163 | 0.08161 |
fixed | NA | birth_order_nonlinear>5 | -0.0251 | 0.03452 | -0.727 | 3560 | 0.4672 | -0.122 | 0.07181 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.111 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4221 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.5353 | 0.2929 | -1.827 | 3581 | 0.06771 | -1.358 | 0.2869 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08019 | 0.03148 | 2.547 | 3581 | 0.01089 | -0.008172 | 0.1686 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002433 | 0.00108 | -2.254 | 3580 | 0.02427 | -0.005463 | 0.0005972 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002378 | 0.00001185 | 2.007 | 3578 | 0.04477 | -0.000009473 | 0.00005704 |
fixed | NA | male | 0.0564 | 0.01476 | 3.822 | 3583 | 0.0001344 | 0.01498 | 0.09782 |
fixed | NA | count_birth_order2/2 | -0.04001 | 0.03684 | -1.086 | 3248 | 0.2775 | -0.1434 | 0.06339 |
fixed | NA | count_birth_order1/3 | -0.06363 | 0.03106 | -2.049 | 3582 | 0.04058 | -0.1508 | 0.02356 |
fixed | NA | count_birth_order2/3 | -0.05555 | 0.03455 | -1.608 | 3586 | 0.1079 | -0.1525 | 0.04142 |
fixed | NA | count_birth_order3/3 | -0.09984 | 0.03721 | -2.683 | 3585 | 0.00733 | -0.2043 | 0.004615 |
fixed | NA | count_birth_order1/4 | -0.04157 | 0.03645 | -1.141 | 3585 | 0.2541 | -0.1439 | 0.06075 |
fixed | NA | count_birth_order2/4 | -0.06433 | 0.0383 | -1.68 | 3586 | 0.09312 | -0.1718 | 0.04318 |
fixed | NA | count_birth_order3/4 | -0.09248 | 0.03975 | -2.326 | 3585 | 0.02005 | -0.2041 | 0.0191 |
fixed | NA | count_birth_order4/4 | -0.05644 | 0.04319 | -1.307 | 3584 | 0.1914 | -0.1777 | 0.06479 |
fixed | NA | count_birth_order1/5 | -0.127 | 0.04766 | -2.664 | 3586 | 0.007762 | -0.2607 | 0.00683 |
fixed | NA | count_birth_order2/5 | -0.1031 | 0.05323 | -1.937 | 3583 | 0.05282 | -0.2525 | 0.04631 |
fixed | NA | count_birth_order3/5 | -0.1444 | 0.05191 | -2.782 | 3582 | 0.005427 | -0.2901 | 0.001288 |
fixed | NA | count_birth_order4/5 | -0.1675 | 0.04997 | -3.352 | 3581 | 0.0008116 | -0.3077 | -0.02721 |
fixed | NA | count_birth_order5/5 | -0.06378 | 0.05308 | -1.202 | 3579 | 0.2296 | -0.2128 | 0.08522 |
fixed | NA | count_birth_order1/>5 | -0.08858 | 0.04645 | -1.907 | 3585 | 0.0566 | -0.219 | 0.04181 |
fixed | NA | count_birth_order2/>5 | -0.08499 | 0.04697 | -1.809 | 3585 | 0.07048 | -0.2168 | 0.04687 |
fixed | NA | count_birth_order3/>5 | -0.08575 | 0.04485 | -1.912 | 3584 | 0.05597 | -0.2116 | 0.04015 |
fixed | NA | count_birth_order4/>5 | -0.1208 | 0.04505 | -2.683 | 3580 | 0.00734 | -0.2473 | 0.005608 |
fixed | NA | count_birth_order5/>5 | -0.1342 | 0.04229 | -3.172 | 3581 | 0.001526 | -0.2529 | -0.01544 |
fixed | NA | count_birth_order>5/>5 | -0.11 | 0.03283 | -3.35 | 3344 | 0.0008166 | -0.2021 | -0.01783 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1107 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4224 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4263 | 4331 | -2120 | 4241 | NA | NA | NA |
12 | 4264 | 4339 | -2120 | 4240 | 0.2157 | 1 | 0.6424 |
16 | 4270 | 4369 | -2119 | 4238 | 2.603 | 4 | 0.6264 |
26 | 4284 | 4445 | -2116 | 4232 | 5.553 | 10 | 0.8513 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = Sector_Manufacturing)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5117 | 0.09457 | 5.41 | 9545 | 0.00000006439 | 0.2462 | 0.7772 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01479 | 0.008466 | -1.747 | 9484 | 0.08064 | -0.03856 | 0.008973 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002146 | 0.0002372 | 0.9045 | 9372 | 0.3657 | -0.0004513 | 0.0008805 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006725 | 0.000002103 | -0.3198 | 9243 | 0.7491 | -0.000006575 | 0.00000523 |
fixed | NA | male | -0.02311 | 0.008759 | -2.639 | 9657 | 0.008339 | -0.0477 | 0.001475 |
fixed | NA | sibling_count3 | -0.006571 | 0.01824 | -0.3603 | 7295 | 0.7186 | -0.05776 | 0.04462 |
fixed | NA | sibling_count4 | -0.00687 | 0.01841 | -0.3732 | 6877 | 0.709 | -0.05855 | 0.04481 |
fixed | NA | sibling_count5 | 0.01292 | 0.01913 | 0.6752 | 6430 | 0.4996 | -0.04079 | 0.06662 |
fixed | NA | sibling_count>5 | 0.01186 | 0.01487 | 0.7972 | 7153 | 0.4254 | -0.02989 | 0.0536 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1442 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4041 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5117 | 0.09458 | 5.41 | 9543 | 0.00000006447 | 0.2462 | 0.7772 |
fixed | NA | birth_order | -0.0001019 | 0.001772 | -0.05749 | 8686 | 0.9542 | -0.005077 | 0.004873 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01476 | 0.008481 | -1.741 | 9475 | 0.08175 | -0.03857 | 0.009043 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002136 | 0.0002379 | 0.8976 | 9335 | 0.3694 | -0.0004543 | 0.0008814 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006633 | 0.000002109 | -0.3145 | 9190 | 0.7532 | -0.000006583 | 0.000005257 |
fixed | NA | male | -0.02311 | 0.00876 | -2.638 | 9656 | 0.008349 | -0.0477 | 0.001479 |
fixed | NA | sibling_count3 | -0.006544 | 0.01824 | -0.3587 | 7305 | 0.7198 | -0.05776 | 0.04467 |
fixed | NA | sibling_count4 | -0.006808 | 0.01844 | -0.3691 | 6922 | 0.712 | -0.05858 | 0.04496 |
fixed | NA | sibling_count5 | 0.01303 | 0.01923 | 0.6776 | 6515 | 0.4981 | -0.04094 | 0.06699 |
fixed | NA | sibling_count>5 | 0.01221 | 0.01612 | 0.7577 | 7866 | 0.4487 | -0.03304 | 0.05746 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1442 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4041 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.5096 | 0.09474 | 5.379 | 9548 | 0.00000007651 | 0.2437 | 0.7756 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01469 | 0.008489 | -1.731 | 9478 | 0.08354 | -0.03852 | 0.009137 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002074 | 0.0002381 | 0.8713 | 9341 | 0.3836 | -0.0004609 | 0.0008757 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000005849 | 0.00000211 | -0.2772 | 9193 | 0.7816 | -0.000006508 | 0.000005338 |
fixed | NA | male | -0.02303 | 0.008761 | -2.629 | 9652 | 0.008575 | -0.04763 | 0.001559 |
fixed | NA | sibling_count3 | -0.005231 | 0.01851 | -0.2826 | 7547 | 0.7775 | -0.0572 | 0.04673 |
fixed | NA | sibling_count4 | -0.007222 | 0.01895 | -0.3811 | 7377 | 0.7031 | -0.06041 | 0.04597 |
fixed | NA | sibling_count5 | 0.01484 | 0.01988 | 0.7462 | 7091 | 0.4556 | -0.04097 | 0.07064 |
fixed | NA | sibling_count>5 | 0.01629 | 0.01688 | 0.965 | 8476 | 0.3346 | -0.0311 | 0.06368 |
fixed | NA | birth_order_nonlinear2 | 0.008384 | 0.01278 | 0.6562 | 8982 | 0.5117 | -0.02748 | 0.04425 |
fixed | NA | birth_order_nonlinear3 | -0.003908 | 0.01484 | -0.2634 | 8821 | 0.7922 | -0.04555 | 0.03774 |
fixed | NA | birth_order_nonlinear4 | 0.01104 | 0.01668 | 0.6616 | 8889 | 0.5082 | -0.03579 | 0.05786 |
fixed | NA | birth_order_nonlinear5 | -0.01119 | 0.01874 | -0.5973 | 8932 | 0.5503 | -0.0638 | 0.04141 |
fixed | NA | birth_order_nonlinear>5 | -0.004781 | 0.01554 | -0.3076 | 9740 | 0.7584 | -0.04841 | 0.03885 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1441 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4042 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4939 | 0.09509 | 5.194 | 9550 | 0.00000021 | 0.227 | 0.7608 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01421 | 0.008498 | -1.673 | 9469 | 0.09446 | -0.03807 | 0.009642 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0001951 | 0.0002382 | 0.8191 | 9331 | 0.4128 | -0.0004736 | 0.0008639 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000494 | 0.000002111 | -0.234 | 9181 | 0.815 | -0.00000642 | 0.000005432 |
fixed | NA | male | -0.02312 | 0.008766 | -2.638 | 9642 | 0.008356 | -0.04773 | 0.001483 |
fixed | NA | count_birth_order2/2 | 0.03648 | 0.02545 | 1.433 | 8886 | 0.1519 | -0.03497 | 0.1079 |
fixed | NA | count_birth_order1/3 | 0.01974 | 0.02457 | 0.8034 | 9655 | 0.4218 | -0.04922 | 0.08869 |
fixed | NA | count_birth_order2/3 | 0.009603 | 0.02731 | 0.3516 | 9692 | 0.7252 | -0.06707 | 0.08628 |
fixed | NA | count_birth_order3/3 | -0.02071 | 0.02998 | -0.6908 | 9712 | 0.4897 | -0.1049 | 0.06344 |
fixed | NA | count_birth_order1/4 | 0.008555 | 0.02702 | 0.3166 | 9694 | 0.7516 | -0.0673 | 0.08441 |
fixed | NA | count_birth_order2/4 | 0.0266 | 0.02898 | 0.9179 | 9706 | 0.3587 | -0.05475 | 0.108 |
fixed | NA | count_birth_order3/4 | -0.03689 | 0.03056 | -1.207 | 9718 | 0.2273 | -0.1227 | 0.04888 |
fixed | NA | count_birth_order4/4 | 0.02723 | 0.03289 | 0.8279 | 9726 | 0.4077 | -0.06509 | 0.1195 |
fixed | NA | count_birth_order1/5 | 0.04031 | 0.03046 | 1.323 | 9719 | 0.1858 | -0.0452 | 0.1258 |
fixed | NA | count_birth_order2/5 | 0.02362 | 0.03234 | 0.7304 | 9724 | 0.4651 | -0.06715 | 0.1144 |
fixed | NA | count_birth_order3/5 | 0.03578 | 0.03401 | 1.052 | 9729 | 0.2928 | -0.05969 | 0.1313 |
fixed | NA | count_birth_order4/5 | 0.008249 | 0.03589 | 0.2298 | 9727 | 0.8182 | -0.0925 | 0.109 |
fixed | NA | count_birth_order5/5 | 0.01433 | 0.03597 | 0.3985 | 9730 | 0.6903 | -0.08663 | 0.1153 |
fixed | NA | count_birth_order1/>5 | 0.01689 | 0.02356 | 0.717 | 9728 | 0.4734 | -0.04923 | 0.08302 |
fixed | NA | count_birth_order2/>5 | 0.01899 | 0.02448 | 0.7757 | 9730 | 0.4379 | -0.04973 | 0.08772 |
fixed | NA | count_birth_order3/>5 | 0.04577 | 0.02423 | 1.889 | 9730 | 0.05895 | -0.02225 | 0.1138 |
fixed | NA | count_birth_order4/>5 | 0.04063 | 0.02374 | 1.711 | 9729 | 0.08707 | -0.02602 | 0.1073 |
fixed | NA | count_birth_order5/>5 | 0.01524 | 0.024 | 0.6352 | 9730 | 0.5253 | -0.05212 | 0.0826 |
fixed | NA | count_birth_order>5/>5 | 0.02177 | 0.01945 | 1.119 | 8952 | 0.263 | -0.03282 | 0.07637 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1442 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4041 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 11106 | 11186 | -5542 | 11084 | NA | NA | NA |
12 | 11108 | 11195 | -5542 | 11084 | 0.003397 | 1 | 0.9535 |
16 | 11114 | 11229 | -5541 | 11082 | 2.159 | 4 | 0.7066 |
26 | 11124 | 11311 | -5536 | 11072 | 9.91 | 10 | 0.4484 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6945 | 0.2861 | 2.428 | 3664 | 0.01524 | -0.1085 | 1.498 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03818 | 0.03069 | -1.244 | 3664 | 0.2135 | -0.1243 | 0.04795 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001072 | 0.001051 | 1.02 | 3664 | 0.3077 | -0.001878 | 0.004023 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001043 | 0.00001152 | -0.9051 | 3664 | 0.3655 | -0.00004278 | 0.00002192 |
fixed | NA | male | -0.01913 | 0.01445 | -1.324 | 3657 | 0.1856 | -0.0597 | 0.02143 |
fixed | NA | sibling_count3 | 0.001268 | 0.02378 | 0.05334 | 2960 | 0.9575 | -0.06548 | 0.06801 |
fixed | NA | sibling_count4 | 0.02087 | 0.02454 | 0.8503 | 2724 | 0.3952 | -0.04802 | 0.08975 |
fixed | NA | sibling_count5 | 0.02786 | 0.02734 | 1.019 | 2386 | 0.3083 | -0.04889 | 0.1046 |
fixed | NA | sibling_count>5 | 0.01755 | 0.02361 | 0.7432 | 2351 | 0.4575 | -0.04873 | 0.08382 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1269 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4136 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6924 | 0.2862 | 2.42 | 3663 | 0.01558 | -0.1108 | 1.496 |
fixed | NA | birth_order | -0.001776 | 0.004471 | -0.3974 | 3464 | 0.6911 | -0.01433 | 0.01077 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03775 | 0.03071 | -1.229 | 3663 | 0.2191 | -0.1239 | 0.04845 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001062 | 0.001052 | 1.009 | 3663 | 0.3129 | -0.001891 | 0.004014 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001039 | 0.00001153 | -0.9014 | 3663 | 0.3675 | -0.00004274 | 0.00002196 |
fixed | NA | male | -0.01907 | 0.01445 | -1.32 | 3656 | 0.1871 | -0.05965 | 0.0215 |
fixed | NA | sibling_count3 | 0.002154 | 0.02388 | 0.09018 | 2960 | 0.9281 | -0.06489 | 0.0692 |
fixed | NA | sibling_count4 | 0.02283 | 0.02503 | 0.9121 | 2721 | 0.3618 | -0.04743 | 0.09309 |
fixed | NA | sibling_count5 | 0.03107 | 0.02851 | 1.09 | 2421 | 0.2759 | -0.04896 | 0.1111 |
fixed | NA | sibling_count>5 | 0.02391 | 0.02854 | 0.838 | 2480 | 0.4021 | -0.05619 | 0.104 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1266 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4138 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.7097 | 0.2864 | 2.478 | 3659 | 0.01325 | -0.09416 | 1.514 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04004 | 0.03071 | -1.304 | 3659 | 0.1924 | -0.1262 | 0.04617 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001135 | 0.001052 | 1.079 | 3659 | 0.2808 | -0.001818 | 0.004088 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001111 | 0.00001153 | -0.9635 | 3659 | 0.3354 | -0.00004348 | 0.00002126 |
fixed | NA | male | -0.01949 | 0.01446 | -1.348 | 3651 | 0.1776 | -0.06007 | 0.02109 |
fixed | NA | sibling_count3 | 0.002157 | 0.02435 | 0.08859 | 3053 | 0.9294 | -0.0662 | 0.07051 |
fixed | NA | sibling_count4 | 0.01402 | 0.02595 | 0.5401 | 2906 | 0.5892 | -0.05883 | 0.08687 |
fixed | NA | sibling_count5 | 0.02613 | 0.02986 | 0.875 | 2692 | 0.3817 | -0.05769 | 0.11 |
fixed | NA | sibling_count>5 | 0.02047 | 0.02931 | 0.6984 | 2640 | 0.485 | -0.0618 | 0.1027 |
fixed | NA | birth_order_nonlinear2 | 0.008278 | 0.01916 | 0.4321 | 3242 | 0.6657 | -0.0455 | 0.06206 |
fixed | NA | birth_order_nonlinear3 | -0.003106 | 0.02248 | -0.1381 | 3311 | 0.8901 | -0.06622 | 0.06 |
fixed | NA | birth_order_nonlinear4 | 0.0427 | 0.02744 | 1.556 | 3377 | 0.1199 | -0.03434 | 0.1197 |
fixed | NA | birth_order_nonlinear5 | -0.029 | 0.03366 | -0.8614 | 3392 | 0.3891 | -0.1235 | 0.06549 |
fixed | NA | birth_order_nonlinear>5 | -0.005666 | 0.03318 | -0.1707 | 3635 | 0.8644 | -0.09882 | 0.08749 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.128 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4133 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.7378 | 0.2875 | 2.566 | 3649 | 0.01033 | -0.06936 | 1.545 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04289 | 0.03084 | -1.391 | 3649 | 0.1644 | -0.1295 | 0.04368 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001232 | 0.001057 | 1.166 | 3649 | 0.2438 | -0.001734 | 0.004198 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001216 | 0.00001159 | -1.05 | 3649 | 0.2939 | -0.00004468 | 0.00002036 |
fixed | NA | male | -0.01952 | 0.01448 | -1.348 | 3641 | 0.1777 | -0.06017 | 0.02113 |
fixed | NA | count_birth_order2/2 | 0.004085 | 0.0374 | 0.1092 | 3277 | 0.913 | -0.1009 | 0.1091 |
fixed | NA | count_birth_order1/3 | 0.01393 | 0.03133 | 0.4445 | 3643 | 0.6567 | -0.07402 | 0.1019 |
fixed | NA | count_birth_order2/3 | 0.007459 | 0.03483 | 0.2142 | 3649 | 0.8304 | -0.0903 | 0.1052 |
fixed | NA | count_birth_order3/3 | -0.02574 | 0.03793 | -0.6785 | 3650 | 0.4975 | -0.1322 | 0.08074 |
fixed | NA | count_birth_order1/4 | -0.01898 | 0.03594 | -0.528 | 3647 | 0.5975 | -0.1199 | 0.08191 |
fixed | NA | count_birth_order2/4 | 0.0258 | 0.0381 | 0.6772 | 3650 | 0.4983 | -0.08114 | 0.1327 |
fixed | NA | count_birth_order3/4 | 0.04904 | 0.0395 | 1.241 | 3649 | 0.2145 | -0.06184 | 0.1599 |
fixed | NA | count_birth_order4/4 | 0.05322 | 0.04228 | 1.259 | 3647 | 0.2082 | -0.06547 | 0.1719 |
fixed | NA | count_birth_order1/5 | 0.01815 | 0.04733 | 0.3835 | 3650 | 0.7014 | -0.1147 | 0.151 |
fixed | NA | count_birth_order2/5 | 0.08403 | 0.05105 | 1.646 | 3645 | 0.09984 | -0.05927 | 0.2273 |
fixed | NA | count_birth_order3/5 | -0.02305 | 0.04853 | -0.4749 | 3644 | 0.6349 | -0.1593 | 0.1132 |
fixed | NA | count_birth_order4/5 | 0.07164 | 0.04733 | 1.513 | 3642 | 0.1303 | -0.06123 | 0.2045 |
fixed | NA | count_birth_order5/5 | -0.001846 | 0.04981 | -0.03705 | 3639 | 0.9704 | -0.1417 | 0.138 |
fixed | NA | count_birth_order1/>5 | 0.03997 | 0.04483 | 0.8917 | 3650 | 0.3726 | -0.08587 | 0.1658 |
fixed | NA | count_birth_order2/>5 | -0.008876 | 0.04517 | -0.1965 | 3646 | 0.8442 | -0.1357 | 0.1179 |
fixed | NA | count_birth_order3/>5 | 0.03244 | 0.04408 | 0.7359 | 3644 | 0.4618 | -0.0913 | 0.1562 |
fixed | NA | count_birth_order4/>5 | 0.06151 | 0.04315 | 1.426 | 3638 | 0.1541 | -0.0596 | 0.1826 |
fixed | NA | count_birth_order5/>5 | -0.01123 | 0.04124 | -0.2723 | 3641 | 0.7854 | -0.127 | 0.1045 |
fixed | NA | count_birth_order>5/>5 | 0.01346 | 0.0322 | 0.4178 | 3445 | 0.6761 | -0.07694 | 0.1039 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1285 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4133 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4272 | 4341 | -2125 | 4250 | NA | NA | NA |
12 | 4274 | 4349 | -2125 | 4250 | 0.16 | 1 | 0.6892 |
16 | 4277 | 4377 | -2123 | 4245 | 4.804 | 4 | 0.3081 |
26 | 4290 | 4451 | -2119 | 4238 | 7.584 | 10 | 0.6694 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6938 | 0.2847 | 2.437 | 3688 | 0.01485 | -0.1053 | 1.493 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03908 | 0.03056 | -1.279 | 3688 | 0.201 | -0.1249 | 0.04671 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001103 | 0.001047 | 1.053 | 3688 | 0.2925 | -0.001837 | 0.004042 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001075 | 0.00001148 | -0.936 | 3688 | 0.3494 | -0.00004298 | 0.00002149 |
fixed | NA | male | -0.01987 | 0.01439 | -1.381 | 3680 | 0.1675 | -0.06028 | 0.02053 |
fixed | NA | sibling_count3 | 0.02057 | 0.02606 | 0.7896 | 3036 | 0.4298 | -0.05257 | 0.09371 |
fixed | NA | sibling_count4 | 0.01883 | 0.02628 | 0.7167 | 2880 | 0.4736 | -0.05493 | 0.0926 |
fixed | NA | sibling_count5 | 0.02997 | 0.02767 | 1.083 | 2658 | 0.2789 | -0.04771 | 0.1077 |
fixed | NA | sibling_count>5 | 0.02952 | 0.02426 | 1.217 | 2707 | 0.2238 | -0.03858 | 0.09762 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1274 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4132 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6907 | 0.2847 | 2.426 | 3687 | 0.01531 | -0.1085 | 1.49 |
fixed | NA | birth_order | -0.003004 | 0.003942 | -0.7619 | 3366 | 0.4462 | -0.01407 | 0.008063 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0384 | 0.03058 | -1.256 | 3687 | 0.2093 | -0.1242 | 0.04743 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001086 | 0.001048 | 1.037 | 3687 | 0.2999 | -0.001854 | 0.004027 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000107 | 0.00001148 | -0.9316 | 3686 | 0.3516 | -0.00004294 | 0.00002154 |
fixed | NA | male | -0.01978 | 0.0144 | -1.374 | 3680 | 0.1696 | -0.06018 | 0.02063 |
fixed | NA | sibling_count3 | 0.02208 | 0.02613 | 0.8452 | 3032 | 0.3981 | -0.05126 | 0.09543 |
fixed | NA | sibling_count4 | 0.02188 | 0.02657 | 0.8235 | 2868 | 0.4103 | -0.05271 | 0.09648 |
fixed | NA | sibling_count5 | 0.03503 | 0.02845 | 1.231 | 2658 | 0.2185 | -0.04485 | 0.1149 |
fixed | NA | sibling_count>5 | 0.04012 | 0.02797 | 1.435 | 2725 | 0.1515 | -0.03838 | 0.1186 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1267 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4134 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.7126 | 0.2849 | 2.501 | 3683 | 0.01241 | -0.08707 | 1.512 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04117 | 0.03058 | -1.347 | 3683 | 0.1782 | -0.127 | 0.04466 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001175 | 0.001048 | 1.122 | 3683 | 0.262 | -0.001765 | 0.004116 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001154 | 0.00001149 | -1.005 | 3683 | 0.3151 | -0.00004379 | 0.0000207 |
fixed | NA | male | -0.02032 | 0.01439 | -1.412 | 3674 | 0.1581 | -0.06072 | 0.02008 |
fixed | NA | sibling_count3 | 0.02206 | 0.02657 | 0.83 | 3100 | 0.4066 | -0.05254 | 0.09665 |
fixed | NA | sibling_count4 | 0.0125 | 0.02736 | 0.4569 | 2998 | 0.6478 | -0.06431 | 0.08931 |
fixed | NA | sibling_count5 | 0.03038 | 0.02971 | 1.023 | 2876 | 0.3066 | -0.05302 | 0.1138 |
fixed | NA | sibling_count>5 | 0.03026 | 0.0288 | 1.051 | 2882 | 0.2935 | -0.05058 | 0.1111 |
fixed | NA | birth_order_nonlinear2 | 0.000648 | 0.01936 | 0.03347 | 3286 | 0.9733 | -0.0537 | 0.05499 |
fixed | NA | birth_order_nonlinear3 | -0.006387 | 0.02258 | -0.2829 | 3373 | 0.7773 | -0.06976 | 0.05699 |
fixed | NA | birth_order_nonlinear4 | 0.04502 | 0.02675 | 1.683 | 3453 | 0.09249 | -0.03007 | 0.1201 |
fixed | NA | birth_order_nonlinear5 | -0.04231 | 0.03258 | -1.299 | 3450 | 0.1942 | -0.1338 | 0.04915 |
fixed | NA | birth_order_nonlinear>5 | -0.003707 | 0.03001 | -0.1235 | 3630 | 0.9017 | -0.08794 | 0.08052 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1294 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4125 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.715 | 0.2859 | 2.501 | 3673 | 0.01242 | -0.08738 | 1.517 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04177 | 0.03069 | -1.361 | 3673 | 0.1735 | -0.1279 | 0.04437 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001195 | 0.001052 | 1.137 | 3673 | 0.2558 | -0.001757 | 0.004148 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001175 | 0.00001154 | -1.019 | 3672 | 0.3084 | -0.00004413 | 0.00002063 |
fixed | NA | male | -0.02002 | 0.01443 | -1.387 | 3664 | 0.1655 | -0.06052 | 0.02049 |
fixed | NA | count_birth_order2/2 | 0.0098 | 0.041 | 0.239 | 3377 | 0.8111 | -0.1053 | 0.1249 |
fixed | NA | count_birth_order1/3 | 0.03993 | 0.03463 | 1.153 | 3667 | 0.249 | -0.05729 | 0.1371 |
fixed | NA | count_birth_order2/3 | 0.02923 | 0.03772 | 0.7751 | 3672 | 0.4384 | -0.07664 | 0.1351 |
fixed | NA | count_birth_order3/3 | -0.01499 | 0.0418 | -0.3586 | 3674 | 0.7199 | -0.1323 | 0.1023 |
fixed | NA | count_birth_order1/4 | 0.008483 | 0.03758 | 0.2257 | 3670 | 0.8214 | -0.09701 | 0.114 |
fixed | NA | count_birth_order2/4 | 0.00627 | 0.0396 | 0.1583 | 3674 | 0.8742 | -0.1049 | 0.1174 |
fixed | NA | count_birth_order3/4 | 0.02997 | 0.04285 | 0.6994 | 3673 | 0.4843 | -0.09032 | 0.1503 |
fixed | NA | count_birth_order4/4 | 0.06428 | 0.04654 | 1.381 | 3671 | 0.1673 | -0.06637 | 0.1949 |
fixed | NA | count_birth_order1/5 | 0.008951 | 0.04542 | 0.1971 | 3674 | 0.8438 | -0.1186 | 0.1365 |
fixed | NA | count_birth_order2/5 | 0.06832 | 0.04657 | 1.467 | 3674 | 0.1425 | -0.0624 | 0.199 |
fixed | NA | count_birth_order3/5 | 0.02295 | 0.04791 | 0.4791 | 3670 | 0.6319 | -0.1115 | 0.1574 |
fixed | NA | count_birth_order4/5 | 0.07555 | 0.04877 | 1.549 | 3667 | 0.1215 | -0.06136 | 0.2125 |
fixed | NA | count_birth_order5/5 | -0.01083 | 0.04952 | -0.2187 | 3664 | 0.8269 | -0.1498 | 0.1282 |
fixed | NA | count_birth_order1/>5 | 0.03972 | 0.04098 | 0.9691 | 3672 | 0.3325 | -0.07532 | 0.1548 |
fixed | NA | count_birth_order2/>5 | 0.00776 | 0.04329 | 0.1793 | 3672 | 0.8577 | -0.1138 | 0.1293 |
fixed | NA | count_birth_order3/>5 | 0.04269 | 0.04171 | 1.024 | 3671 | 0.3061 | -0.07438 | 0.1598 |
fixed | NA | count_birth_order4/>5 | 0.07782 | 0.04052 | 1.921 | 3669 | 0.05486 | -0.03592 | 0.1916 |
fixed | NA | count_birth_order5/>5 | -0.007665 | 0.04291 | -0.1786 | 3662 | 0.8582 | -0.1281 | 0.1128 |
fixed | NA | count_birth_order>5/>5 | 0.02949 | 0.03239 | 0.9104 | 3508 | 0.3627 | -0.06144 | 0.1204 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1294 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4129 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4295 | 4364 | -2137 | 4273 | NA | NA | NA |
12 | 4297 | 4371 | -2136 | 4273 | 0.585 | 1 | 0.4444 |
16 | 4298 | 4398 | -2133 | 4266 | 6.406 | 4 | 0.1708 |
26 | 4314 | 4476 | -2131 | 4262 | 4.039 | 10 | 0.9455 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6847 | 0.2888 | 2.371 | 3600 | 0.0178 | -0.126 | 1.495 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03708 | 0.03103 | -1.195 | 3600 | 0.2322 | -0.1242 | 0.05003 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001033 | 0.001064 | 0.9707 | 3600 | 0.3318 | -0.001954 | 0.00402 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000009884 | 0.00001168 | -0.8464 | 3599 | 0.3974 | -0.00004267 | 0.0000229 |
fixed | NA | male | -0.02402 | 0.01458 | -1.648 | 3593 | 0.09949 | -0.06495 | 0.0169 |
fixed | NA | sibling_count3 | 0.006789 | 0.02327 | 0.2917 | 2910 | 0.7705 | -0.05853 | 0.07211 |
fixed | NA | sibling_count4 | 0.01743 | 0.02436 | 0.7156 | 2681 | 0.4743 | -0.05095 | 0.08582 |
fixed | NA | sibling_count5 | 0.03358 | 0.0279 | 1.204 | 2245 | 0.2289 | -0.04473 | 0.1119 |
fixed | NA | sibling_count>5 | 0.0147 | 0.02369 | 0.6205 | 2243 | 0.535 | -0.05181 | 0.08121 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1271 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4135 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6811 | 0.2889 | 2.357 | 3598 | 0.01846 | -0.1299 | 1.492 |
fixed | NA | birth_order | -0.002423 | 0.004604 | -0.5263 | 3430 | 0.5987 | -0.01535 | 0.0105 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03639 | 0.03106 | -1.172 | 3598 | 0.2414 | -0.1236 | 0.05079 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001015 | 0.001065 | 0.9533 | 3598 | 0.3405 | -0.001974 | 0.004004 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000009793 | 0.00001168 | -0.8384 | 3598 | 0.4018 | -0.00004258 | 0.00002299 |
fixed | NA | male | -0.024 | 0.01458 | -1.646 | 3592 | 0.09981 | -0.06494 | 0.01693 |
fixed | NA | sibling_count3 | 0.008022 | 0.02339 | 0.343 | 2908 | 0.7317 | -0.05763 | 0.07368 |
fixed | NA | sibling_count4 | 0.02008 | 0.02487 | 0.8073 | 2683 | 0.4196 | -0.04973 | 0.08989 |
fixed | NA | sibling_count5 | 0.03781 | 0.02903 | 1.302 | 2278 | 0.193 | -0.04369 | 0.1193 |
fixed | NA | sibling_count>5 | 0.02339 | 0.02887 | 0.81 | 2429 | 0.418 | -0.05766 | 0.1044 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1268 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4136 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.6914 | 0.2892 | 2.391 | 3594 | 0.01687 | -0.1204 | 1.503 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.03822 | 0.03107 | -1.23 | 3595 | 0.2187 | -0.1254 | 0.04899 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001074 | 0.001065 | 1.008 | 3595 | 0.3135 | -0.001916 | 0.004064 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001037 | 0.00001169 | -0.8876 | 3594 | 0.3748 | -0.00004318 | 0.00002243 |
fixed | NA | male | -0.02434 | 0.01459 | -1.669 | 3588 | 0.09526 | -0.06529 | 0.01661 |
fixed | NA | sibling_count3 | 0.009206 | 0.02388 | 0.3855 | 3004 | 0.6999 | -0.05782 | 0.07623 |
fixed | NA | sibling_count4 | 0.01429 | 0.0258 | 0.5538 | 2866 | 0.5798 | -0.05813 | 0.08671 |
fixed | NA | sibling_count5 | 0.03383 | 0.03029 | 1.117 | 2528 | 0.2643 | -0.05121 | 0.1189 |
fixed | NA | sibling_count>5 | 0.02141 | 0.02969 | 0.7211 | 2597 | 0.4709 | -0.06193 | 0.1047 |
fixed | NA | birth_order_nonlinear2 | 0.01259 | 0.01907 | 0.6599 | 3177 | 0.5093 | -0.04095 | 0.06613 |
fixed | NA | birth_order_nonlinear3 | -0.008404 | 0.02251 | -0.3733 | 3249 | 0.7089 | -0.07159 | 0.05479 |
fixed | NA | birth_order_nonlinear4 | 0.03288 | 0.02827 | 1.163 | 3317 | 0.2448 | -0.04647 | 0.1122 |
fixed | NA | birth_order_nonlinear5 | -0.01862 | 0.03484 | -0.5346 | 3303 | 0.593 | -0.1164 | 0.07918 |
fixed | NA | birth_order_nonlinear>5 | -0.01146 | 0.03423 | -0.3349 | 3577 | 0.7377 | -0.1076 | 0.08463 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.127 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4136 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.7099 | 0.2904 | 2.445 | 3584 | 0.01455 | -0.1053 | 1.525 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.04044 | 0.03121 | -1.296 | 3584 | 0.1951 | -0.128 | 0.04716 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.001151 | 0.00107 | 1.076 | 3584 | 0.2821 | -0.001853 | 0.004155 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00001124 | 0.00001175 | -0.9567 | 3583 | 0.3388 | -0.00004421 | 0.00002173 |
fixed | NA | male | -0.02448 | 0.01462 | -1.675 | 3577 | 0.09408 | -0.06552 | 0.01655 |
fixed | NA | count_birth_order2/2 | 0.01734 | 0.03639 | 0.4765 | 3206 | 0.6338 | -0.08481 | 0.1195 |
fixed | NA | count_birth_order1/3 | 0.01849 | 0.03079 | 0.6004 | 3579 | 0.5483 | -0.06795 | 0.1049 |
fixed | NA | count_birth_order2/3 | 0.02155 | 0.03424 | 0.6293 | 3585 | 0.5292 | -0.07457 | 0.1177 |
fixed | NA | count_birth_order3/3 | -0.009869 | 0.03687 | -0.2676 | 3585 | 0.789 | -0.1134 | 0.09364 |
fixed | NA | count_birth_order1/4 | -0.01049 | 0.03613 | -0.2903 | 3584 | 0.7716 | -0.1119 | 0.09094 |
fixed | NA | count_birth_order2/4 | 0.027 | 0.03796 | 0.7113 | 3586 | 0.477 | -0.07955 | 0.1335 |
fixed | NA | count_birth_order3/4 | 0.03907 | 0.03939 | 0.992 | 3584 | 0.3213 | -0.07149 | 0.1496 |
fixed | NA | count_birth_order4/4 | 0.05482 | 0.04279 | 1.281 | 3583 | 0.2002 | -0.06529 | 0.1749 |
fixed | NA | count_birth_order1/5 | 0.03448 | 0.04724 | 0.73 | 3586 | 0.4654 | -0.09812 | 0.1671 |
fixed | NA | count_birth_order2/5 | 0.06907 | 0.05274 | 1.31 | 3579 | 0.1904 | -0.07897 | 0.2171 |
fixed | NA | count_birth_order3/5 | 0.004936 | 0.05143 | 0.09599 | 3577 | 0.9235 | -0.1394 | 0.1493 |
fixed | NA | count_birth_order4/5 | 0.06178 | 0.0495 | 1.248 | 3577 | 0.2121 | -0.07717 | 0.2007 |
fixed | NA | count_birth_order5/5 | 0.02736 | 0.05258 | 0.5203 | 3574 | 0.6029 | -0.1202 | 0.175 |
fixed | NA | count_birth_order1/>5 | 0.05413 | 0.04604 | 1.176 | 3586 | 0.2398 | -0.07511 | 0.1834 |
fixed | NA | count_birth_order2/>5 | 0.02108 | 0.04654 | 0.4529 | 3582 | 0.6507 | -0.1096 | 0.1517 |
fixed | NA | count_birth_order3/>5 | 0.006787 | 0.04444 | 0.1527 | 3581 | 0.8786 | -0.118 | 0.1315 |
fixed | NA | count_birth_order4/>5 | 0.05472 | 0.04463 | 1.226 | 3572 | 0.2202 | -0.07054 | 0.18 |
fixed | NA | count_birth_order5/>5 | -0.00152 | 0.0419 | -0.03627 | 3576 | 0.9711 | -0.1191 | 0.1161 |
fixed | NA | count_birth_order>5/>5 | 0.01146 | 0.03262 | 0.3515 | 3348 | 0.7253 | -0.0801 | 0.103 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1273 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.4139 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4196 | 4264 | -2087 | 4174 | NA | NA | NA |
12 | 4198 | 4272 | -2087 | 4174 | 0.2797 | 1 | 0.5969 |
16 | 4203 | 4302 | -2085 | 4171 | 3.113 | 4 | 0.5391 |
26 | 4219 | 4380 | -2084 | 4167 | 3.496 | 10 | 0.9672 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Sector_Mining and quarrying`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.03035 | 0.03991 | -0.7605 | 9543 | 0.447 | -0.1424 | 0.08168 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002784 | 0.003572 | 0.7794 | 9482 | 0.4357 | -0.007243 | 0.01281 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00004645 | 0.0001001 | -0.4641 | 9372 | 0.6426 | -0.0003274 | 0.0002345 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000002049 | 0.000000887 | 0.231 | 9246 | 0.8173 | -0.000002285 | 0.000002695 |
fixed | NA | male | 0.02971 | 0.0037 | 8.03 | 9672 | 1.089e-15 | 0.01932 | 0.04009 |
fixed | NA | sibling_count3 | -0.0008367 | 0.007684 | -0.1089 | 7398 | 0.9133 | -0.02241 | 0.02073 |
fixed | NA | sibling_count4 | 0.004985 | 0.007755 | 0.6429 | 6978 | 0.5203 | -0.01678 | 0.02675 |
fixed | NA | sibling_count5 | 0.006666 | 0.008057 | 0.8274 | 6531 | 0.408 | -0.01595 | 0.02928 |
fixed | NA | sibling_count>5 | 0.001122 | 0.006266 | 0.179 | 7252 | 0.8579 | -0.01647 | 0.01871 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05891 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1712 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.03038 | 0.03991 | -0.7613 | 9542 | 0.4465 | -0.1424 | 0.08165 |
fixed | NA | birth_order | 0.0005056 | 0.0007473 | 0.6765 | 8641 | 0.4987 | -0.001592 | 0.002603 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002644 | 0.003579 | 0.7388 | 9473 | 0.46 | -0.007401 | 0.01269 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00004135 | 0.0001004 | -0.412 | 9336 | 0.6804 | -0.0003231 | 0.0002404 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000001591 | 0.0000008896 | 0.1788 | 9196 | 0.8581 | -0.000002338 | 0.000002656 |
fixed | NA | male | 0.0297 | 0.0037 | 8.027 | 9671 | 1.117e-15 | 0.01931 | 0.04008 |
fixed | NA | sibling_count3 | -0.0009676 | 0.007687 | -0.1259 | 7408 | 0.8998 | -0.02254 | 0.02061 |
fixed | NA | sibling_count4 | 0.004674 | 0.007769 | 0.6016 | 7024 | 0.5474 | -0.01713 | 0.02648 |
fixed | NA | sibling_count5 | 0.006127 | 0.008097 | 0.7568 | 6616 | 0.4492 | -0.0166 | 0.02885 |
fixed | NA | sibling_count>5 | -0.000655 | 0.006794 | -0.09641 | 7942 | 0.9232 | -0.01973 | 0.01842 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05893 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1712 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.02744 | 0.03998 | -0.6864 | 9547 | 0.4925 | -0.1397 | 0.08478 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002552 | 0.003582 | 0.7125 | 9477 | 0.4762 | -0.007503 | 0.01261 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00003768 | 0.0001004 | -0.3752 | 9342 | 0.7076 | -0.0003196 | 0.0002443 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000001159 | 0.0000008902 | 0.1301 | 9199 | 0.8965 | -0.000002383 | 0.000002615 |
fixed | NA | male | 0.02973 | 0.0037 | 8.035 | 9666 | 1.047e-15 | 0.01934 | 0.04012 |
fixed | NA | sibling_count3 | 0.0002275 | 0.007802 | 0.02916 | 7639 | 0.9767 | -0.02167 | 0.02213 |
fixed | NA | sibling_count4 | 0.004558 | 0.007985 | 0.5709 | 7466 | 0.5681 | -0.01786 | 0.02697 |
fixed | NA | sibling_count5 | 0.00631 | 0.008377 | 0.7532 | 7181 | 0.4513 | -0.0172 | 0.02982 |
fixed | NA | sibling_count>5 | -0.0008504 | 0.007119 | -0.1195 | 8534 | 0.9049 | -0.02083 | 0.01913 |
fixed | NA | birth_order_nonlinear2 | -0.004173 | 0.0054 | -0.7729 | 9020 | 0.4396 | -0.01933 | 0.01098 |
fixed | NA | birth_order_nonlinear3 | -0.005299 | 0.00627 | -0.8451 | 8872 | 0.3981 | -0.0229 | 0.0123 |
fixed | NA | birth_order_nonlinear4 | 0.006777 | 0.00705 | 0.9613 | 8941 | 0.3364 | -0.01301 | 0.02657 |
fixed | NA | birth_order_nonlinear5 | -0.00166 | 0.00792 | -0.2096 | 8985 | 0.834 | -0.02389 | 0.02057 |
fixed | NA | birth_order_nonlinear>5 | 0.002234 | 0.006562 | 0.3404 | 9740 | 0.7335 | -0.01619 | 0.02065 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05905 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1712 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0343 | 0.04011 | -0.8551 | 9548 | 0.3925 | -0.1469 | 0.0783 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.002683 | 0.003585 | 0.7484 | 9467 | 0.4542 | -0.007379 | 0.01275 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00004222 | 0.0001005 | -0.4202 | 9331 | 0.6744 | -0.0003243 | 0.0002398 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000001617 | 0.0000008903 | 0.1816 | 9186 | 0.8559 | -0.000002337 | 0.000002661 |
fixed | NA | male | 0.0297 | 0.003701 | 8.025 | 9657 | 1.132e-15 | 0.01931 | 0.04009 |
fixed | NA | count_birth_order2/2 | 0.01138 | 0.01075 | 1.058 | 8914 | 0.29 | -0.01881 | 0.04157 |
fixed | NA | count_birth_order1/3 | 0.005769 | 0.01037 | 0.5566 | 9665 | 0.5778 | -0.02333 | 0.03486 |
fixed | NA | count_birth_order2/3 | 0.01716 | 0.01153 | 1.489 | 9697 | 0.1365 | -0.01519 | 0.04952 |
fixed | NA | count_birth_order3/3 | -0.01888 | 0.01265 | -1.492 | 9714 | 0.1357 | -0.05439 | 0.01664 |
fixed | NA | count_birth_order1/4 | 0.01393 | 0.0114 | 1.222 | 9699 | 0.2218 | -0.01808 | 0.04594 |
fixed | NA | count_birth_order2/4 | -0.005393 | 0.01223 | -0.441 | 9709 | 0.6592 | -0.03972 | 0.02894 |
fixed | NA | count_birth_order3/4 | 0.009254 | 0.01289 | 0.7177 | 9719 | 0.473 | -0.02694 | 0.04545 |
fixed | NA | count_birth_order4/4 | 0.02237 | 0.01388 | 1.612 | 9726 | 0.107 | -0.01659 | 0.06134 |
fixed | NA | count_birth_order1/5 | 0.005794 | 0.01286 | 0.4507 | 9721 | 0.6522 | -0.03029 | 0.04188 |
fixed | NA | count_birth_order2/5 | 0.009803 | 0.01365 | 0.7183 | 9725 | 0.4726 | -0.0285 | 0.04811 |
fixed | NA | count_birth_order3/5 | 0.007786 | 0.01435 | 0.5424 | 9729 | 0.5876 | -0.03251 | 0.04808 |
fixed | NA | count_birth_order4/5 | 0.01815 | 0.01515 | 1.198 | 9728 | 0.2309 | -0.02437 | 0.06068 |
fixed | NA | count_birth_order5/5 | 0.01756 | 0.01518 | 1.157 | 9730 | 0.2473 | -0.02505 | 0.06018 |
fixed | NA | count_birth_order1/>5 | 0.01252 | 0.009942 | 1.259 | 9729 | 0.2079 | -0.01539 | 0.04043 |
fixed | NA | count_birth_order2/>5 | -0.01148 | 0.01033 | -1.111 | 9730 | 0.2666 | -0.04049 | 0.01752 |
fixed | NA | count_birth_order3/>5 | 0.007394 | 0.01023 | 0.723 | 9730 | 0.4697 | -0.02131 | 0.0361 |
fixed | NA | count_birth_order4/>5 | 0.01005 | 0.01002 | 1.003 | 9730 | 0.316 | -0.01808 | 0.03818 |
fixed | NA | count_birth_order5/>5 | 0.001259 | 0.01013 | 0.1243 | 9730 | 0.9011 | -0.02717 | 0.02969 |
fixed | NA | count_birth_order>5/>5 | 0.007163 | 0.0082 | 0.8736 | 8987 | 0.3824 | -0.01585 | 0.03018 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05892 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1712 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -5714 | -5635 | 2868 | -5736 | NA | NA | NA |
12 | -5712 | -5626 | 2868 | -5736 | 0.4579 | 1 | 0.4986 |
16 | -5707 | -5592 | 2870 | -5739 | 3.207 | 4 | 0.5238 |
26 | -5703 | -5517 | 2878 | -5755 | 16.09 | 10 | 0.09704 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0135 | 0.1052 | -0.1283 | 3665 | 0.8979 | -0.3088 | 0.2818 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0004965 | 0.01128 | 0.044 | 3665 | 0.9649 | -0.03117 | 0.03217 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00002584 | 0.0003865 | 0.06685 | 3665 | 0.9467 | -0.001059 | 0.001111 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008291 | 0.000004237 | -0.1957 | 3665 | 0.8449 | -0.00001272 | 0.00001107 |
fixed | NA | male | 0.02643 | 0.005311 | 4.977 | 3645 | 0.0000006762 | 0.01152 | 0.04134 |
fixed | NA | sibling_count3 | 0.01414 | 0.008772 | 1.612 | 2714 | 0.1071 | -0.01048 | 0.03877 |
fixed | NA | sibling_count4 | 0.01755 | 0.00906 | 1.937 | 2445 | 0.05282 | -0.00788 | 0.04298 |
fixed | NA | sibling_count5 | 0.004679 | 0.0101 | 0.4631 | 2080 | 0.6433 | -0.02368 | 0.03304 |
fixed | NA | sibling_count>5 | 0.01454 | 0.008725 | 1.666 | 2049 | 0.09587 | -0.009956 | 0.03903 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05107 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1508 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01511 | 0.1052 | -0.1436 | 3664 | 0.8859 | -0.3105 | 0.2802 |
fixed | NA | birth_order | -0.00126 | 0.001647 | -0.7652 | 3446 | 0.4442 | -0.005882 | 0.003362 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0008181 | 0.01129 | 0.07246 | 3664 | 0.9422 | -0.03088 | 0.03251 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001765 | 0.0003867 | 0.04563 | 3664 | 0.9636 | -0.001068 | 0.001103 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000007941 | 0.000004238 | -0.1874 | 3664 | 0.8514 | -0.00001269 | 0.0000111 |
fixed | NA | male | 0.02649 | 0.005312 | 4.987 | 3643 | 0.0000006412 | 0.01158 | 0.0414 |
fixed | NA | sibling_count3 | 0.01478 | 0.008814 | 1.676 | 2712 | 0.09376 | -0.009965 | 0.03952 |
fixed | NA | sibling_count4 | 0.01895 | 0.009244 | 2.05 | 2441 | 0.04051 | -0.007001 | 0.0449 |
fixed | NA | sibling_count5 | 0.006955 | 0.01054 | 0.6599 | 2121 | 0.5094 | -0.02263 | 0.03654 |
fixed | NA | sibling_count>5 | 0.01908 | 0.01055 | 1.809 | 2201 | 0.07064 | -0.01053 | 0.04868 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05147 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1506 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01618 | 0.1053 | -0.1537 | 3660 | 0.8779 | -0.3118 | 0.2794 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00098 | 0.01129 | 0.08678 | 3660 | 0.9309 | -0.03072 | 0.03268 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0000145 | 0.0003868 | 0.03749 | 3660 | 0.9701 | -0.001071 | 0.0011 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000007877 | 0.00000424 | -0.1858 | 3660 | 0.8526 | -0.00001269 | 0.00001112 |
fixed | NA | male | 0.02645 | 0.005314 | 4.978 | 3639 | 0.0000006708 | 0.01154 | 0.04137 |
fixed | NA | sibling_count3 | 0.01569 | 0.008983 | 1.747 | 2831 | 0.08078 | -0.009523 | 0.04091 |
fixed | NA | sibling_count4 | 0.02248 | 0.009577 | 2.347 | 2661 | 0.01901 | -0.004408 | 0.04936 |
fixed | NA | sibling_count5 | 0.01117 | 0.01103 | 1.013 | 2422 | 0.3113 | -0.01978 | 0.04212 |
fixed | NA | sibling_count>5 | 0.02095 | 0.01082 | 1.936 | 2377 | 0.05301 | -0.00943 | 0.05133 |
fixed | NA | birth_order_nonlinear2 | -0.008145 | 0.007027 | -1.159 | 3067 | 0.2466 | -0.02787 | 0.01158 |
fixed | NA | birth_order_nonlinear3 | -0.006853 | 0.008248 | -0.8308 | 3151 | 0.4062 | -0.03001 | 0.0163 |
fixed | NA | birth_order_nonlinear4 | -0.01932 | 0.01007 | -1.919 | 3235 | 0.0551 | -0.04759 | 0.008946 |
fixed | NA | birth_order_nonlinear5 | -0.01062 | 0.01235 | -0.8596 | 3250 | 0.3901 | -0.04529 | 0.02406 |
fixed | NA | birth_order_nonlinear>5 | -0.007731 | 0.01221 | -0.6332 | 3642 | 0.5266 | -0.042 | 0.02654 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05144 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1507 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.009966 | 0.1058 | -0.09421 | 3649 | 0.9249 | -0.3069 | 0.287 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0004782 | 0.01135 | 0.04215 | 3650 | 0.9664 | -0.03137 | 0.03233 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00003556 | 0.0003887 | 0.09147 | 3650 | 0.9271 | -0.001056 | 0.001127 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000001051 | 0.000004262 | -0.2466 | 3650 | 0.8052 | -0.00001302 | 0.00001091 |
fixed | NA | male | 0.0264 | 0.005325 | 4.957 | 3629 | 0.0000007477 | 0.01145 | 0.04134 |
fixed | NA | count_birth_order2/2 | -0.01641 | 0.01373 | -1.195 | 3135 | 0.2321 | -0.05495 | 0.02213 |
fixed | NA | count_birth_order1/3 | 0.00795 | 0.01153 | 0.6896 | 3638 | 0.4905 | -0.02441 | 0.04031 |
fixed | NA | count_birth_order2/3 | 0.0165 | 0.01281 | 1.288 | 3648 | 0.1978 | -0.01946 | 0.05247 |
fixed | NA | count_birth_order3/3 | 0.0005857 | 0.01395 | 0.04198 | 3650 | 0.9665 | -0.03858 | 0.03975 |
fixed | NA | count_birth_order1/4 | 0.0207 | 0.01322 | 1.565 | 3646 | 0.1176 | -0.01642 | 0.05781 |
fixed | NA | count_birth_order2/4 | 0.005796 | 0.01401 | 0.4136 | 3650 | 0.6792 | -0.03354 | 0.04513 |
fixed | NA | count_birth_order3/4 | 0.008942 | 0.01453 | 0.6155 | 3648 | 0.5383 | -0.03184 | 0.04972 |
fixed | NA | count_birth_order4/4 | 0.01142 | 0.01555 | 0.734 | 3645 | 0.463 | -0.03224 | 0.05507 |
fixed | NA | count_birth_order1/5 | 0.007885 | 0.01741 | 0.4528 | 3650 | 0.6507 | -0.04099 | 0.05676 |
fixed | NA | count_birth_order2/5 | -0.006315 | 0.01877 | -0.3363 | 3640 | 0.7366 | -0.05901 | 0.04639 |
fixed | NA | count_birth_order3/5 | 0.008757 | 0.01785 | 0.4907 | 3639 | 0.6237 | -0.04134 | 0.05885 |
fixed | NA | count_birth_order4/5 | -0.01357 | 0.01741 | -0.7797 | 3636 | 0.4356 | -0.06243 | 0.03529 |
fixed | NA | count_birth_order5/5 | -0.0001377 | 0.01832 | -0.007518 | 3630 | 0.994 | -0.05155 | 0.05128 |
fixed | NA | count_birth_order1/>5 | 0.02285 | 0.01649 | 1.385 | 3650 | 0.166 | -0.02345 | 0.06914 |
fixed | NA | count_birth_order2/>5 | 0.008602 | 0.01661 | 0.5177 | 3640 | 0.6047 | -0.03803 | 0.05524 |
fixed | NA | count_birth_order3/>5 | 0.01917 | 0.01621 | 1.182 | 3636 | 0.2371 | -0.02634 | 0.06467 |
fixed | NA | count_birth_order4/>5 | -0.01033 | 0.01587 | -0.651 | 3626 | 0.5151 | -0.05486 | 0.03421 |
fixed | NA | count_birth_order5/>5 | 0.006311 | 0.01516 | 0.4162 | 3632 | 0.6773 | -0.03625 | 0.04888 |
fixed | NA | count_birth_order>5/>5 | 0.01036 | 0.01186 | 0.8735 | 3382 | 0.3824 | -0.02294 | 0.04367 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05117 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1509 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -3080 | -3011 | 1551 | -3102 | NA | NA | NA |
12 | -3078 | -3004 | 1551 | -3102 | 0.5788 | 1 | 0.4468 |
16 | -3074 | -2975 | 1553 | -3106 | 3.483 | 4 | 0.4804 |
26 | -3059 | -2897 | 1555 | -3111 | 4.848 | 10 | 0.9011 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01139 | 0.1044 | -0.1092 | 3689 | 0.9131 | -0.3044 | 0.2816 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0004498 | 0.0112 | 0.04014 | 3689 | 0.968 | -0.031 | 0.0319 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00002628 | 0.000384 | 0.06844 | 3689 | 0.9454 | -0.001051 | 0.001104 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008199 | 0.00000421 | -0.1948 | 3689 | 0.8456 | -0.00001264 | 0.000011 |
fixed | NA | male | 0.02609 | 0.005275 | 4.946 | 3670 | 0.0000007934 | 0.01128 | 0.0409 |
fixed | NA | sibling_count3 | 0.008191 | 0.009579 | 0.8551 | 2809 | 0.3926 | -0.0187 | 0.03508 |
fixed | NA | sibling_count4 | 0.02248 | 0.009664 | 2.326 | 2627 | 0.02009 | -0.004648 | 0.04961 |
fixed | NA | sibling_count5 | -0.0006205 | 0.01018 | -0.06093 | 2378 | 0.9514 | -0.02921 | 0.02796 |
fixed | NA | sibling_count>5 | 0.01265 | 0.008926 | 1.417 | 2437 | 0.1567 | -0.01241 | 0.0377 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05052 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1503 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01242 | 0.1044 | -0.119 | 3688 | 0.9053 | -0.3054 | 0.2806 |
fixed | NA | birth_order | -0.0009043 | 0.001448 | -0.6243 | 3314 | 0.5324 | -0.00497 | 0.003161 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0006657 | 0.01121 | 0.05938 | 3688 | 0.9527 | -0.0308 | 0.03214 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00002094 | 0.0003841 | 0.05452 | 3688 | 0.9565 | -0.001057 | 0.001099 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008013 | 0.000004211 | -0.1903 | 3688 | 0.8491 | -0.00001262 | 0.00001102 |
fixed | NA | male | 0.02613 | 0.005276 | 4.953 | 3668 | 0.0000007638 | 0.01132 | 0.04094 |
fixed | NA | sibling_count3 | 0.008654 | 0.00961 | 0.9005 | 2802 | 0.3679 | -0.01832 | 0.03563 |
fixed | NA | sibling_count4 | 0.0234 | 0.009779 | 2.393 | 2611 | 0.01677 | -0.004047 | 0.05085 |
fixed | NA | sibling_count5 | 0.000899 | 0.01048 | 0.08581 | 2380 | 0.9316 | -0.02851 | 0.03031 |
fixed | NA | sibling_count>5 | 0.01586 | 0.0103 | 1.54 | 2467 | 0.1237 | -0.01304 | 0.04475 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05085 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1502 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01457 | 0.1045 | -0.1394 | 3684 | 0.8891 | -0.3079 | 0.2787 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.000977 | 0.01121 | 0.08712 | 3684 | 0.9306 | -0.0305 | 0.03246 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001225 | 0.0003842 | 0.03189 | 3684 | 0.9746 | -0.001066 | 0.001091 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000007374 | 0.000004213 | -0.175 | 3684 | 0.8611 | -0.00001256 | 0.00001109 |
fixed | NA | male | 0.0261 | 0.005277 | 4.946 | 3663 | 0.0000007933 | 0.01128 | 0.04091 |
fixed | NA | sibling_count3 | 0.009587 | 0.00977 | 0.9813 | 2894 | 0.3265 | -0.01784 | 0.03701 |
fixed | NA | sibling_count4 | 0.02691 | 0.01006 | 2.674 | 2774 | 0.007531 | -0.001335 | 0.05516 |
fixed | NA | sibling_count5 | 0.004979 | 0.01093 | 0.4555 | 2635 | 0.6488 | -0.0257 | 0.03566 |
fixed | NA | sibling_count>5 | 0.01859 | 0.01059 | 1.755 | 2650 | 0.07933 | -0.01114 | 0.04833 |
fixed | NA | birth_order_nonlinear2 | -0.006724 | 0.007086 | -0.9489 | 3128 | 0.3428 | -0.02661 | 0.01317 |
fixed | NA | birth_order_nonlinear3 | -0.00603 | 0.008265 | -0.7296 | 3237 | 0.4657 | -0.02923 | 0.01717 |
fixed | NA | birth_order_nonlinear4 | -0.01962 | 0.009795 | -2.003 | 3342 | 0.04525 | -0.04712 | 0.007875 |
fixed | NA | birth_order_nonlinear5 | -0.008111 | 0.01193 | -0.6798 | 3334 | 0.4967 | -0.0416 | 0.02538 |
fixed | NA | birth_order_nonlinear>5 | -0.007123 | 0.01101 | -0.6469 | 3628 | 0.5178 | -0.03803 | 0.02379 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05104 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1502 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01177 | 0.1048 | -0.1123 | 3673 | 0.9106 | -0.306 | 0.2824 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0009535 | 0.01125 | 0.08475 | 3674 | 0.9325 | -0.03063 | 0.03254 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001652 | 0.0003856 | 0.04284 | 3674 | 0.9658 | -0.001066 | 0.001099 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000813 | 0.000004229 | -0.1922 | 3674 | 0.8476 | -0.00001268 | 0.00001106 |
fixed | NA | male | 0.02624 | 0.005288 | 4.961 | 3653 | 0.0000007322 | 0.01139 | 0.04108 |
fixed | NA | count_birth_order2/2 | -0.01773 | 0.01501 | -1.182 | 3271 | 0.2375 | -0.05985 | 0.02439 |
fixed | NA | count_birth_order1/3 | -0.0005947 | 0.0127 | -0.04683 | 3661 | 0.9626 | -0.03624 | 0.03505 |
fixed | NA | count_birth_order2/3 | 0.01466 | 0.01383 | 1.06 | 3671 | 0.289 | -0.02415 | 0.05348 |
fixed | NA | count_birth_order3/3 | -0.009318 | 0.01532 | -0.608 | 3674 | 0.5432 | -0.05233 | 0.0337 |
fixed | NA | count_birth_order1/4 | 0.03084 | 0.01378 | 2.238 | 3667 | 0.02527 | -0.007839 | 0.06953 |
fixed | NA | count_birth_order2/4 | 0.009355 | 0.01452 | 0.6444 | 3673 | 0.5193 | -0.0314 | 0.05011 |
fixed | NA | count_birth_order3/4 | 0.01186 | 0.01571 | 0.7549 | 3672 | 0.4504 | -0.03224 | 0.05595 |
fixed | NA | count_birth_order4/4 | 0.006457 | 0.01706 | 0.3785 | 3668 | 0.7051 | -0.04143 | 0.05435 |
fixed | NA | count_birth_order1/5 | 0.0004113 | 0.01665 | 0.0247 | 3674 | 0.9803 | -0.04634 | 0.04716 |
fixed | NA | count_birth_order2/5 | -0.01248 | 0.01707 | -0.731 | 3673 | 0.4648 | -0.0604 | 0.03544 |
fixed | NA | count_birth_order3/5 | -0.004494 | 0.01756 | -0.2559 | 3667 | 0.798 | -0.05379 | 0.0448 |
fixed | NA | count_birth_order4/5 | -0.01346 | 0.01788 | -0.753 | 3662 | 0.4515 | -0.06364 | 0.03672 |
fixed | NA | count_birth_order5/5 | -0.002927 | 0.01815 | -0.1613 | 3657 | 0.8719 | -0.05387 | 0.04801 |
fixed | NA | count_birth_order1/>5 | 0.009889 | 0.01503 | 0.6581 | 3671 | 0.5105 | -0.03229 | 0.05207 |
fixed | NA | count_birth_order2/>5 | 0.007599 | 0.01587 | 0.4788 | 3669 | 0.6321 | -0.03695 | 0.05214 |
fixed | NA | count_birth_order3/>5 | 0.02187 | 0.01529 | 1.43 | 3668 | 0.1527 | -0.02104 | 0.06478 |
fixed | NA | count_birth_order4/>5 | -0.009521 | 0.01485 | -0.6411 | 3665 | 0.5215 | -0.05121 | 0.03217 |
fixed | NA | count_birth_order5/>5 | 0.004109 | 0.01572 | 0.2613 | 3653 | 0.7939 | -0.04003 | 0.04825 |
fixed | NA | count_birth_order>5/>5 | 0.00764 | 0.01189 | 0.6425 | 3454 | 0.5206 | -0.02574 | 0.04101 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05089 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1503 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -3126 | -3058 | 1574 | -3148 | NA | NA | NA |
12 | -3125 | -3050 | 1574 | -3149 | 0.3851 | 1 | 0.5349 |
16 | -3121 | -3021 | 1576 | -3153 | 3.745 | 4 | 0.4416 |
26 | -3108 | -2946 | 1580 | -3160 | 6.999 | 10 | 0.7256 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01066 | 0.1071 | -0.09954 | 3601 | 0.9207 | -0.3114 | 0.2901 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0003278 | 0.01151 | 0.02848 | 3601 | 0.9773 | -0.03198 | 0.03264 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00003105 | 0.0003947 | 0.07867 | 3601 | 0.9373 | -0.001077 | 0.001139 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008807 | 0.000004332 | -0.2033 | 3601 | 0.8389 | -0.00001304 | 0.00001128 |
fixed | NA | male | 0.02676 | 0.005405 | 4.952 | 3576 | 0.000000768 | 0.01159 | 0.04194 |
fixed | NA | sibling_count3 | 0.01389 | 0.008671 | 1.602 | 2619 | 0.1094 | -0.01045 | 0.03823 |
fixed | NA | sibling_count4 | 0.01566 | 0.009086 | 1.723 | 2354 | 0.08493 | -0.009845 | 0.04116 |
fixed | NA | sibling_count5 | 0.003031 | 0.01042 | 0.2908 | 1889 | 0.7712 | -0.02622 | 0.03229 |
fixed | NA | sibling_count>5 | 0.01426 | 0.008852 | 1.611 | 1894 | 0.1074 | -0.01059 | 0.0391 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05302 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1516 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01296 | 0.1072 | -0.1209 | 3600 | 0.9038 | -0.3138 | 0.2879 |
fixed | NA | birth_order | -0.001449 | 0.001711 | -0.8467 | 3426 | 0.3972 | -0.006251 | 0.003354 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.00075 | 0.01152 | 0.0651 | 3600 | 0.9481 | -0.03159 | 0.03309 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00001983 | 0.0003949 | 0.05021 | 3600 | 0.96 | -0.001089 | 0.001128 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000008209 | 0.000004332 | -0.1895 | 3600 | 0.8497 | -0.00001298 | 0.00001134 |
fixed | NA | male | 0.02679 | 0.005405 | 4.957 | 3574 | 0.000000749 | 0.01162 | 0.04196 |
fixed | NA | sibling_count3 | 0.01463 | 0.008718 | 1.679 | 2615 | 0.09335 | -0.009838 | 0.03911 |
fixed | NA | sibling_count4 | 0.01724 | 0.009279 | 1.858 | 2358 | 0.06327 | -0.008805 | 0.04329 |
fixed | NA | sibling_count5 | 0.005559 | 0.01085 | 0.5122 | 1928 | 0.6085 | -0.0249 | 0.03602 |
fixed | NA | sibling_count>5 | 0.01948 | 0.01078 | 1.806 | 2110 | 0.07106 | -0.01079 | 0.04975 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05347 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1514 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01281 | 0.1072 | -0.1194 | 3596 | 0.9049 | -0.3138 | 0.2882 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0007721 | 0.01152 | 0.06702 | 3596 | 0.9466 | -0.03157 | 0.03311 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0000206 | 0.0003949 | 0.05216 | 3596 | 0.9584 | -0.001088 | 0.001129 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000849 | 0.000004334 | -0.1959 | 3596 | 0.8447 | -0.00001301 | 0.00001132 |
fixed | NA | male | 0.02683 | 0.005405 | 4.963 | 3571 | 0.0000007255 | 0.01166 | 0.042 |
fixed | NA | sibling_count3 | 0.01413 | 0.008893 | 1.588 | 2740 | 0.1123 | -0.01084 | 0.03909 |
fixed | NA | sibling_count4 | 0.01947 | 0.009615 | 2.025 | 2579 | 0.04293 | -0.007515 | 0.04646 |
fixed | NA | sibling_count5 | 0.009835 | 0.01131 | 0.8699 | 2200 | 0.3845 | -0.0219 | 0.04157 |
fixed | NA | sibling_count>5 | 0.02072 | 0.01108 | 1.871 | 2297 | 0.06154 | -0.01037 | 0.05181 |
fixed | NA | birth_order_nonlinear2 | -0.007982 | 0.007046 | -1.133 | 2958 | 0.2574 | -0.02776 | 0.0118 |
fixed | NA | birth_order_nonlinear3 | -0.001416 | 0.008319 | -0.1702 | 3049 | 0.8649 | -0.02477 | 0.02193 |
fixed | NA | birth_order_nonlinear4 | -0.02045 | 0.01045 | -1.957 | 3135 | 0.05041 | -0.04978 | 0.00888 |
fixed | NA | birth_order_nonlinear5 | -0.01796 | 0.01288 | -1.395 | 3107 | 0.1631 | -0.05411 | 0.01819 |
fixed | NA | birth_order_nonlinear>5 | -0.006144 | 0.0127 | -0.4838 | 3588 | 0.6286 | -0.04179 | 0.02951 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0534 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1514 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.01112 | 0.1077 | -0.1032 | 3586 | 0.9178 | -0.3134 | 0.2912 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0006036 | 0.01157 | 0.05216 | 3586 | 0.9584 | -0.03188 | 0.03309 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00002941 | 0.0003968 | 0.07411 | 3586 | 0.9409 | -0.001085 | 0.001143 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000009731 | 0.000004356 | -0.2234 | 3586 | 0.8232 | -0.0000132 | 0.00001125 |
fixed | NA | male | 0.02685 | 0.005417 | 4.956 | 3559 | 0.0000007513 | 0.01164 | 0.04205 |
fixed | NA | count_birth_order2/2 | -0.01103 | 0.01345 | -0.8202 | 3028 | 0.4122 | -0.04877 | 0.02672 |
fixed | NA | count_birth_order1/3 | 0.007516 | 0.01142 | 0.658 | 3571 | 0.5106 | -0.02455 | 0.03958 |
fixed | NA | count_birth_order2/3 | 0.01549 | 0.0127 | 1.22 | 3585 | 0.2225 | -0.02015 | 0.05113 |
fixed | NA | count_birth_order3/3 | 0.009049 | 0.01367 | 0.6619 | 3585 | 0.5081 | -0.02932 | 0.04742 |
fixed | NA | count_birth_order1/4 | 0.02297 | 0.0134 | 1.714 | 3582 | 0.08658 | -0.01464 | 0.06059 |
fixed | NA | count_birth_order2/4 | 0.0009928 | 0.01407 | 0.07055 | 3586 | 0.9438 | -0.03851 | 0.04049 |
fixed | NA | count_birth_order3/4 | 0.01526 | 0.0146 | 1.045 | 3582 | 0.2959 | -0.02572 | 0.05624 |
fixed | NA | count_birth_order4/4 | 0.005978 | 0.01586 | 0.3769 | 3578 | 0.7063 | -0.03854 | 0.0505 |
fixed | NA | count_birth_order1/5 | 0.007985 | 0.01752 | 0.4559 | 3586 | 0.6485 | -0.04118 | 0.05715 |
fixed | NA | count_birth_order2/5 | -0.005466 | 0.01954 | -0.2797 | 3567 | 0.7797 | -0.06032 | 0.04939 |
fixed | NA | count_birth_order3/5 | 0.01416 | 0.01906 | 0.7431 | 3564 | 0.4575 | -0.03933 | 0.06765 |
fixed | NA | count_birth_order4/5 | -0.01167 | 0.01834 | -0.636 | 3566 | 0.5248 | -0.06316 | 0.03982 |
fixed | NA | count_birth_order5/5 | -0.009098 | 0.01948 | -0.467 | 3558 | 0.6405 | -0.06379 | 0.04559 |
fixed | NA | count_birth_order1/>5 | 0.02622 | 0.01707 | 1.536 | 3585 | 0.1246 | -0.02169 | 0.07413 |
fixed | NA | count_birth_order2/>5 | 0.01201 | 0.01725 | 0.6963 | 3569 | 0.4863 | -0.03641 | 0.06043 |
fixed | NA | count_birth_order3/>5 | 0.02036 | 0.01647 | 1.236 | 3570 | 0.2165 | -0.02587 | 0.06658 |
fixed | NA | count_birth_order4/>5 | -0.009475 | 0.01653 | -0.573 | 3550 | 0.5667 | -0.05589 | 0.03694 |
fixed | NA | count_birth_order5/>5 | 0.00164 | 0.01552 | 0.1056 | 3561 | 0.9159 | -0.04194 | 0.04522 |
fixed | NA | count_birth_order>5/>5 | 0.01344 | 0.01213 | 1.108 | 3274 | 0.2679 | -0.0206 | 0.04747 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.05348 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1516 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -2965 | -2897 | 1493 | -2987 | NA | NA | NA |
12 | -2963 | -2889 | 1494 | -2987 | 0.7092 | 1 | 0.3997 |
16 | -2960 | -2861 | 1496 | -2992 | 4.896 | 4 | 0.2981 |
26 | -2944 | -2783 | 1498 | -2996 | 3.888 | 10 | 0.9523 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = `Sector_Transportation, storage and communications`)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.0652 | 0.04159 | 1.568 | 9516 | 0.1169 | -0.05153 | 0.1819 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003102 | 0.003721 | -0.8336 | 9447 | 0.4045 | -0.01355 | 0.007343 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00007889 | 0.0001042 | 0.7573 | 9338 | 0.4489 | -0.0002135 | 0.0003713 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000005583 | 0.0000009226 | -0.6052 | 9222 | 0.5451 | -0.000003148 | 0.000002031 |
fixed | NA | male | -0.01246 | 0.003874 | -3.218 | 9725 | 0.001296 | -0.02334 | -0.001591 |
fixed | NA | sibling_count3 | 0.008001 | 0.007939 | 1.008 | 7753 | 0.3136 | -0.01428 | 0.03029 |
fixed | NA | sibling_count4 | 0.009834 | 0.008 | 1.229 | 7307 | 0.219 | -0.01262 | 0.03229 |
fixed | NA | sibling_count5 | 0.02201 | 0.008298 | 2.653 | 6836 | 0.008005 | -0.001281 | 0.04531 |
fixed | NA | sibling_count>5 | 0.01792 | 0.00647 | 2.769 | 7576 | 0.005634 | -0.000245 | 0.03608 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04837 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1826 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.06522 | 0.04159 | 1.568 | 9515 | 0.1169 | -0.05152 | 0.182 |
fixed | NA | birth_order | 0.0004447 | 0.0007746 | 0.5741 | 8215 | 0.5659 | -0.00173 | 0.002619 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003224 | 0.003727 | -0.865 | 9437 | 0.3871 | -0.01369 | 0.007238 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008323 | 0.0001044 | 0.7969 | 9304 | 0.4256 | -0.00021 | 0.0003764 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000000597 | 0.0000009251 | -0.6454 | 9175 | 0.5187 | -0.000003194 | 0.000002 |
fixed | NA | male | -0.01247 | 0.003874 | -3.22 | 9724 | 0.001284 | -0.02335 | -0.001601 |
fixed | NA | sibling_count3 | 0.007879 | 0.007942 | 0.992 | 7762 | 0.3212 | -0.01442 | 0.03017 |
fixed | NA | sibling_count4 | 0.00955 | 0.008016 | 1.191 | 7347 | 0.2336 | -0.01295 | 0.03205 |
fixed | NA | sibling_count5 | 0.02153 | 0.008341 | 2.581 | 6912 | 0.009879 | -0.001888 | 0.04494 |
fixed | NA | sibling_count>5 | 0.01634 | 0.007032 | 2.323 | 8169 | 0.02019 | -0.003402 | 0.03607 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04838 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1826 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.06535 | 0.04165 | 1.569 | 9519 | 0.1167 | -0.05157 | 0.1823 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003216 | 0.00373 | -0.8623 | 9440 | 0.3886 | -0.01369 | 0.007254 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0000849 | 0.0001045 | 0.8124 | 9310 | 0.4166 | -0.0002085 | 0.0003783 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006214 | 0.0000009255 | -0.6715 | 9178 | 0.5019 | -0.000003219 | 0.000001976 |
fixed | NA | male | -0.01255 | 0.003874 | -3.241 | 9720 | 0.001196 | -0.02343 | -0.00168 |
fixed | NA | sibling_count3 | 0.007229 | 0.008066 | 0.8962 | 7983 | 0.3702 | -0.01541 | 0.02987 |
fixed | NA | sibling_count4 | 0.01056 | 0.008249 | 1.28 | 7779 | 0.2006 | -0.0126 | 0.03372 |
fixed | NA | sibling_count5 | 0.02083 | 0.008646 | 2.409 | 7477 | 0.01603 | -0.003444 | 0.04509 |
fixed | NA | sibling_count>5 | 0.01412 | 0.007382 | 1.913 | 8737 | 0.05576 | -0.006599 | 0.03485 |
fixed | NA | birth_order_nonlinear2 | -0.001514 | 0.005678 | -0.2667 | 9157 | 0.7897 | -0.01745 | 0.01442 |
fixed | NA | birth_order_nonlinear3 | 0.003304 | 0.006598 | 0.5007 | 9063 | 0.6166 | -0.01522 | 0.02182 |
fixed | NA | birth_order_nonlinear4 | -0.007857 | 0.007416 | -1.06 | 9143 | 0.2894 | -0.02867 | 0.01296 |
fixed | NA | birth_order_nonlinear5 | 0.01102 | 0.008329 | 1.324 | 9198 | 0.1857 | -0.01236 | 0.0344 |
fixed | NA | birth_order_nonlinear>5 | 0.007088 | 0.006857 | 1.034 | 9722 | 0.3013 | -0.01216 | 0.02633 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04841 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1826 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.06713 | 0.04182 | 1.605 | 9521 | 0.1085 | -0.05027 | 0.1845 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.003226 | 0.003735 | -0.8637 | 9431 | 0.3878 | -0.01371 | 0.007259 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.00008514 | 0.0001046 | 0.8139 | 9299 | 0.4157 | -0.0002085 | 0.0003788 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.0000006217 | 0.0000009261 | -0.6713 | 9165 | 0.502 | -0.000003221 | 0.000001978 |
fixed | NA | male | -0.01247 | 0.003877 | -3.216 | 9710 | 0.001304 | -0.02335 | -0.001586 |
fixed | NA | count_birth_order2/2 | -0.006295 | 0.01132 | -0.556 | 8978 | 0.5783 | -0.03808 | 0.02549 |
fixed | NA | count_birth_order1/3 | 0.003135 | 0.01083 | 0.2896 | 9704 | 0.7721 | -0.02725 | 0.03352 |
fixed | NA | count_birth_order2/3 | 0.00541 | 0.01204 | 0.4493 | 9716 | 0.6533 | -0.02839 | 0.03921 |
fixed | NA | count_birth_order3/3 | 0.01109 | 0.01322 | 0.8389 | 9721 | 0.4016 | -0.02602 | 0.04821 |
fixed | NA | count_birth_order1/4 | 0.01225 | 0.01192 | 1.028 | 9718 | 0.3038 | -0.02119 | 0.0457 |
fixed | NA | count_birth_order2/4 | 0.00659 | 0.01278 | 0.5156 | 9720 | 0.6062 | -0.02929 | 0.04247 |
fixed | NA | count_birth_order3/4 | 0.01458 | 0.01348 | 1.082 | 9724 | 0.2793 | -0.02325 | 0.05242 |
fixed | NA | count_birth_order4/4 | -0.007248 | 0.01451 | -0.4995 | 9726 | 0.6175 | -0.04798 | 0.03349 |
fixed | NA | count_birth_order1/5 | 0.004284 | 0.01344 | 0.3188 | 9726 | 0.7499 | -0.03344 | 0.04201 |
fixed | NA | count_birth_order2/5 | 0.02675 | 0.01427 | 1.875 | 9728 | 0.06086 | -0.0133 | 0.0668 |
fixed | NA | count_birth_order3/5 | 0.0287 | 0.01501 | 1.912 | 9729 | 0.05592 | -0.01344 | 0.07084 |
fixed | NA | count_birth_order4/5 | 0.008712 | 0.01585 | 0.5497 | 9730 | 0.5826 | -0.03578 | 0.0532 |
fixed | NA | count_birth_order5/5 | 0.03591 | 0.01588 | 2.261 | 9730 | 0.02375 | -0.008663 | 0.08048 |
fixed | NA | count_birth_order1/>5 | 0.0164 | 0.0104 | 1.577 | 9729 | 0.1148 | -0.01279 | 0.04558 |
fixed | NA | count_birth_order2/>5 | 0.008682 | 0.01081 | 0.8033 | 9730 | 0.4218 | -0.02166 | 0.03902 |
fixed | NA | count_birth_order3/>5 | 0.01101 | 0.0107 | 1.029 | 9730 | 0.3035 | -0.01902 | 0.04104 |
fixed | NA | count_birth_order4/>5 | 0.008169 | 0.01048 | 0.7795 | 9730 | 0.4357 | -0.02125 | 0.03759 |
fixed | NA | count_birth_order5/>5 | 0.02166 | 0.01059 | 2.044 | 9730 | 0.04096 | -0.008081 | 0.0514 |
fixed | NA | count_birth_order>5/>5 | 0.01945 | 0.008525 | 2.281 | 9095 | 0.02255 | -0.004481 | 0.04338 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.04833 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1826 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -4846 | -4767 | 2434 | -4868 | NA | NA | NA |
12 | -4844 | -4758 | 2434 | -4868 | 0.33 | 1 | 0.5656 |
16 | -4842 | -4727 | 2437 | -4874 | 5.859 | 4 | 0.2099 |
26 | -4827 | -4640 | 2439 | -4879 | 4.714 | 10 | 0.9094 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.147 | 0.1226 | 1.199 | 3656 | 0.2306 | -0.1971 | 0.491 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01108 | 0.01315 | -0.8429 | 3654 | 0.3993 | -0.04798 | 0.02582 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003627 | 0.0004503 | 0.8054 | 3651 | 0.4207 | -0.0009014 | 0.001627 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000004015 | 0.000004936 | -0.8135 | 3646 | 0.416 | -0.00001787 | 0.000009839 |
fixed | NA | male | -0.016 | 0.006199 | -2.581 | 3665 | 0.009896 | -0.0334 | 0.001403 |
fixed | NA | sibling_count3 | 0.004867 | 0.01008 | 0.4826 | 3099 | 0.6294 | -0.02344 | 0.03318 |
fixed | NA | sibling_count4 | 0.006221 | 0.01038 | 0.5992 | 2858 | 0.5491 | -0.02292 | 0.03537 |
fixed | NA | sibling_count5 | 0.0261 | 0.01153 | 2.264 | 2501 | 0.02364 | -0.006256 | 0.05846 |
fixed | NA | sibling_count>5 | 0.01793 | 0.009949 | 1.802 | 2435 | 0.07163 | -0.009997 | 0.04586 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03293 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1823 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1438 | 0.1225 | 1.173 | 3654 | 0.2408 | -0.2002 | 0.4877 |
fixed | NA | birth_order | -0.00308 | 0.001903 | -1.618 | 3333 | 0.1057 | -0.008423 | 0.002263 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01039 | 0.01315 | -0.7901 | 3652 | 0.4295 | -0.0473 | 0.02652 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003461 | 0.0004503 | 0.7686 | 3649 | 0.4422 | -0.0009179 | 0.00161 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003965 | 0.000004934 | -0.8035 | 3645 | 0.4218 | -0.00001782 | 0.000009887 |
fixed | NA | male | -0.01587 | 0.006198 | -2.56 | 3664 | 0.01049 | -0.03327 | 0.001528 |
fixed | NA | sibling_count3 | 0.006395 | 0.01013 | 0.6316 | 3105 | 0.5277 | -0.02203 | 0.03482 |
fixed | NA | sibling_count4 | 0.009575 | 0.01058 | 0.9046 | 2858 | 0.3657 | -0.02014 | 0.03929 |
fixed | NA | sibling_count5 | 0.03163 | 0.01202 | 2.632 | 2534 | 0.008551 | -0.002109 | 0.06536 |
fixed | NA | sibling_count>5 | 0.0289 | 0.01203 | 2.401 | 2545 | 0.01641 | -0.004883 | 0.06268 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03253 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1823 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1472 | 0.1227 | 1.2 | 3650 | 0.2301 | -0.1971 | 0.4915 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.0108 | 0.01315 | -0.821 | 3648 | 0.4117 | -0.04772 | 0.02612 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003645 | 0.0004505 | 0.809 | 3646 | 0.4185 | -0.0009001 | 0.001629 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000422 | 0.000004938 | -0.8547 | 3641 | 0.3928 | -0.00001808 | 0.00000964 |
fixed | NA | male | -0.01611 | 0.006201 | -2.598 | 3660 | 0.009409 | -0.03352 | 0.001295 |
fixed | NA | sibling_count3 | 0.007144 | 0.01033 | 0.6914 | 3191 | 0.4894 | -0.02186 | 0.03615 |
fixed | NA | sibling_count4 | 0.01067 | 0.01099 | 0.971 | 3037 | 0.3316 | -0.02018 | 0.04153 |
fixed | NA | sibling_count5 | 0.03423 | 0.01262 | 2.713 | 2807 | 0.006716 | -0.001192 | 0.06965 |
fixed | NA | sibling_count>5 | 0.03208 | 0.01238 | 2.592 | 2709 | 0.009583 | -0.002657 | 0.06682 |
fixed | NA | birth_order_nonlinear2 | -0.01406 | 0.008281 | -1.698 | 3355 | 0.08955 | -0.03731 | 0.009181 |
fixed | NA | birth_order_nonlinear3 | -0.01005 | 0.009708 | -1.035 | 3426 | 0.3006 | -0.0373 | 0.0172 |
fixed | NA | birth_order_nonlinear4 | -0.01388 | 0.01184 | -1.172 | 3488 | 0.2412 | -0.04711 | 0.01936 |
fixed | NA | birth_order_nonlinear5 | -0.02517 | 0.01452 | -1.734 | 3512 | 0.08299 | -0.06592 | 0.01558 |
fixed | NA | birth_order_nonlinear>5 | -0.02715 | 0.01418 | -1.915 | 3567 | 0.05562 | -0.06696 | 0.01266 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03234 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1824 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1428 | 0.1231 | 1.16 | 3639 | 0.2461 | -0.2028 | 0.4884 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01111 | 0.01321 | -0.8416 | 3637 | 0.4001 | -0.04818 | 0.02596 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003788 | 0.0004524 | 0.8374 | 3634 | 0.4024 | -0.0008911 | 0.001649 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000004428 | 0.00000496 | -0.8929 | 3629 | 0.372 | -0.00001835 | 0.000009493 |
fixed | NA | male | -0.0164 | 0.00621 | -2.64 | 3650 | 0.008318 | -0.03383 | 0.001035 |
fixed | NA | count_birth_order2/2 | 0.006857 | 0.01616 | 0.4242 | 3347 | 0.6714 | -0.03851 | 0.05223 |
fixed | NA | count_birth_order1/3 | 0.009847 | 0.01342 | 0.7337 | 3649 | 0.4632 | -0.02782 | 0.04752 |
fixed | NA | count_birth_order2/3 | -0.0002712 | 0.01492 | -0.01818 | 3650 | 0.9855 | -0.04216 | 0.04162 |
fixed | NA | count_birth_order3/3 | 0.01219 | 0.01626 | 0.7498 | 3650 | 0.4534 | -0.03345 | 0.05784 |
fixed | NA | count_birth_order1/4 | 0.02105 | 0.0154 | 1.367 | 3649 | 0.1717 | -0.02217 | 0.06427 |
fixed | NA | count_birth_order2/4 | 0.009409 | 0.01633 | 0.5762 | 3650 | 0.5645 | -0.03642 | 0.05524 |
fixed | NA | count_birth_order3/4 | 0.0003186 | 0.01694 | 0.01881 | 3650 | 0.985 | -0.04722 | 0.04786 |
fixed | NA | count_birth_order4/4 | -0.001352 | 0.01813 | -0.07459 | 3650 | 0.9405 | -0.05225 | 0.04954 |
fixed | NA | count_birth_order1/5 | 0.04666 | 0.02029 | 2.3 | 3650 | 0.0215 | -0.01028 | 0.1036 |
fixed | NA | count_birth_order2/5 | 0.0226 | 0.02189 | 1.032 | 3650 | 0.302 | -0.03886 | 0.08405 |
fixed | NA | count_birth_order3/5 | 0.03762 | 0.02081 | 1.808 | 3649 | 0.07072 | -0.0208 | 0.09605 |
fixed | NA | count_birth_order4/5 | 0.02517 | 0.0203 | 1.24 | 3649 | 0.2152 | -0.03182 | 0.08217 |
fixed | NA | count_birth_order5/5 | 0.009177 | 0.02137 | 0.4294 | 3648 | 0.6677 | -0.05081 | 0.06917 |
fixed | NA | count_birth_order1/>5 | 0.06168 | 0.0192 | 3.212 | 3643 | 0.001328 | 0.007783 | 0.1156 |
fixed | NA | count_birth_order2/>5 | -0.002437 | 0.01937 | -0.1258 | 3649 | 0.8999 | -0.0568 | 0.05192 |
fixed | NA | count_birth_order3/>5 | 0.02147 | 0.0189 | 1.136 | 3650 | 0.256 | -0.03159 | 0.07453 |
fixed | NA | count_birth_order4/>5 | 0.03178 | 0.01851 | 1.717 | 3650 | 0.08603 | -0.02017 | 0.08374 |
fixed | NA | count_birth_order5/>5 | 0.01785 | 0.01769 | 1.009 | 3649 | 0.3131 | -0.0318 | 0.0675 |
fixed | NA | count_birth_order>5/>5 | 0.01175 | 0.01371 | 0.8568 | 3413 | 0.3916 | -0.02675 | 0.05025 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.0318 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1825 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -1951 | -1883 | 986.6 | -1973 | NA | NA | NA |
12 | -1952 | -1877 | 987.9 | -1976 | 2.627 | 1 | 0.105 |
16 | -1947 | -1848 | 989.5 | -1979 | 3.289 | 4 | 0.5106 |
26 | -1936 | -1774 | 993.8 | -1988 | 8.507 | 10 | 0.5795 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1348 | 0.122 | 1.105 | 3679 | 0.2692 | -0.2076 | 0.4773 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01021 | 0.0131 | -0.7795 | 3677 | 0.4357 | -0.04698 | 0.02656 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003311 | 0.0004488 | 0.7378 | 3673 | 0.4607 | -0.0009287 | 0.001591 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003669 | 0.00000492 | -0.7457 | 3668 | 0.4559 | -0.00001748 | 0.00001014 |
fixed | NA | male | -0.0162 | 0.006178 | -2.622 | 3689 | 0.008788 | -0.03354 | 0.001146 |
fixed | NA | sibling_count3 | 0.009527 | 0.01106 | 0.8615 | 3170 | 0.389 | -0.02151 | 0.04057 |
fixed | NA | sibling_count4 | 0.006535 | 0.01113 | 0.5869 | 3013 | 0.5573 | -0.02472 | 0.03779 |
fixed | NA | sibling_count5 | 0.0336 | 0.0117 | 2.872 | 2778 | 0.004105 | 0.0007643 | 0.06644 |
fixed | NA | sibling_count>5 | 0.02293 | 0.01026 | 2.235 | 2809 | 0.02552 | -0.005873 | 0.05173 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03225 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1824 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.133 | 0.122 | 1.09 | 3677 | 0.2758 | -0.2095 | 0.4754 |
fixed | NA | birth_order | -0.002138 | 0.001677 | -1.275 | 3214 | 0.2023 | -0.006845 | 0.002568 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.009771 | 0.0131 | -0.7458 | 3675 | 0.4558 | -0.04655 | 0.02701 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000321 | 0.0004488 | 0.7153 | 3672 | 0.4745 | -0.0009388 | 0.001581 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000365 | 0.00000492 | -0.7418 | 3667 | 0.4582 | -0.00001746 | 0.00001016 |
fixed | NA | male | -0.01611 | 0.006178 | -2.607 | 3688 | 0.009167 | -0.03345 | 0.001235 |
fixed | NA | sibling_count3 | 0.0106 | 0.01109 | 0.9557 | 3172 | 0.3393 | -0.02053 | 0.04173 |
fixed | NA | sibling_count4 | 0.008674 | 0.01126 | 0.7704 | 3006 | 0.4411 | -0.02293 | 0.04028 |
fixed | NA | sibling_count5 | 0.03718 | 0.01203 | 3.091 | 2779 | 0.002015 | 0.003415 | 0.07095 |
fixed | NA | sibling_count>5 | 0.03044 | 0.01183 | 2.573 | 2809 | 0.01013 | -0.002767 | 0.06364 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03218 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1824 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1407 | 0.1221 | 1.152 | 3673 | 0.2494 | -0.2021 | 0.4834 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.01045 | 0.01311 | -0.797 | 3672 | 0.4255 | -0.04724 | 0.02634 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003477 | 0.000449 | 0.7743 | 3668 | 0.4388 | -0.0009128 | 0.001608 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000398 | 0.000004923 | -0.8085 | 3663 | 0.4189 | -0.0000178 | 0.000009839 |
fixed | NA | male | -0.01637 | 0.006179 | -2.649 | 3684 | 0.008096 | -0.03372 | 0.0009735 |
fixed | NA | sibling_count3 | 0.01284 | 0.01128 | 1.138 | 3235 | 0.2551 | -0.01883 | 0.04452 |
fixed | NA | sibling_count4 | 0.01034 | 0.0116 | 0.8908 | 3132 | 0.3731 | -0.02224 | 0.04291 |
fixed | NA | sibling_count5 | 0.03911 | 0.01258 | 3.108 | 2993 | 0.001902 | 0.003786 | 0.07443 |
fixed | NA | sibling_count>5 | 0.03291 | 0.01219 | 2.699 | 2967 | 0.006998 | -0.001319 | 0.06714 |
fixed | NA | birth_order_nonlinear2 | -0.015 | 0.008375 | -1.791 | 3394 | 0.07345 | -0.03851 | 0.008513 |
fixed | NA | birth_order_nonlinear3 | -0.01467 | 0.009754 | -1.504 | 3481 | 0.1327 | -0.04205 | 0.01271 |
fixed | NA | birth_order_nonlinear4 | -0.007381 | 0.01154 | -0.6394 | 3550 | 0.5226 | -0.03978 | 0.02502 |
fixed | NA | birth_order_nonlinear5 | -0.01601 | 0.01406 | -1.138 | 3559 | 0.255 | -0.05547 | 0.02346 |
fixed | NA | birth_order_nonlinear>5 | -0.02288 | 0.01282 | -1.785 | 3554 | 0.07439 | -0.05888 | 0.01311 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03209 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1824 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1241 | 0.1221 | 1.016 | 3662 | 0.3096 | -0.2187 | 0.467 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.009842 | 0.01311 | -0.7506 | 3660 | 0.453 | -0.04665 | 0.02697 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.000332 | 0.0004494 | 0.7389 | 3656 | 0.46 | -0.0009293 | 0.001593 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003868 | 0.000004927 | -0.785 | 3650 | 0.4325 | -0.0000177 | 0.000009963 |
fixed | NA | male | -0.01598 | 0.006177 | -2.587 | 3674 | 0.00971 | -0.03332 | 0.001357 |
fixed | NA | count_birth_order2/2 | 0.0135 | 0.01767 | 0.7641 | 3428 | 0.4449 | -0.0361 | 0.0631 |
fixed | NA | count_birth_order1/3 | 0.01416 | 0.0148 | 0.9565 | 3673 | 0.3389 | -0.02739 | 0.05571 |
fixed | NA | count_birth_order2/3 | 0.00501 | 0.01613 | 0.3106 | 3674 | 0.7561 | -0.04026 | 0.05028 |
fixed | NA | count_birth_order3/3 | 0.0268 | 0.01788 | 1.499 | 3674 | 0.134 | -0.0234 | 0.07701 |
fixed | NA | count_birth_order1/4 | 0.04209 | 0.01607 | 2.62 | 3673 | 0.008829 | -0.003005 | 0.08719 |
fixed | NA | count_birth_order2/4 | 0.001262 | 0.01694 | 0.07454 | 3674 | 0.9406 | -0.04628 | 0.0488 |
fixed | NA | count_birth_order3/4 | -0.01579 | 0.01834 | -0.861 | 3674 | 0.3893 | -0.06726 | 0.03569 |
fixed | NA | count_birth_order4/4 | 0.001377 | 0.01992 | 0.06911 | 3674 | 0.9449 | -0.05454 | 0.05729 |
fixed | NA | count_birth_order1/5 | 0.01152 | 0.01943 | 0.5932 | 3674 | 0.5531 | -0.043 | 0.06605 |
fixed | NA | count_birth_order2/5 | 0.04278 | 0.01992 | 2.147 | 3674 | 0.03184 | -0.01315 | 0.0987 |
fixed | NA | count_birth_order3/5 | 0.05774 | 0.02051 | 2.816 | 3674 | 0.004893 | 0.0001778 | 0.1153 |
fixed | NA | count_birth_order4/5 | 0.05098 | 0.02088 | 2.441 | 3673 | 0.01467 | -0.007632 | 0.1096 |
fixed | NA | count_birth_order5/5 | 0.03361 | 0.0212 | 1.585 | 3672 | 0.113 | -0.02591 | 0.09313 |
fixed | NA | count_birth_order1/>5 | 0.0718 | 0.01752 | 4.099 | 3668 | 0.00004242 | 0.02263 | 0.121 |
fixed | NA | count_birth_order2/>5 | 0.00797 | 0.01852 | 0.4303 | 3673 | 0.667 | -0.04402 | 0.05996 |
fixed | NA | count_birth_order3/>5 | 0.01289 | 0.01785 | 0.7224 | 3674 | 0.4701 | -0.0372 | 0.06299 |
fixed | NA | count_birth_order4/>5 | 0.03653 | 0.01734 | 2.106 | 3674 | 0.03524 | -0.01215 | 0.08521 |
fixed | NA | count_birth_order5/>5 | 0.02583 | 0.01837 | 1.406 | 3673 | 0.1599 | -0.02574 | 0.0774 |
fixed | NA | count_birth_order>5/>5 | 0.01946 | 0.01378 | 1.412 | 3502 | 0.158 | -0.01921 | 0.05812 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03092 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1822 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -1965 | -1897 | 993.5 | -1987 | NA | NA | NA |
12 | -1965 | -1890 | 994.3 | -1989 | 1.631 | 1 | 0.2015 |
16 | -1961 | -1861 | 996.3 | -1993 | 3.928 | 4 | 0.4158 |
26 | -1966 | -1805 | 1009 | -2018 | 25.91 | 10 | 0.003867 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1323 | 0.1239 | 1.068 | 3591 | 0.2857 | -0.2154 | 0.4799 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.009582 | 0.01331 | -0.72 | 3590 | 0.4715 | -0.04694 | 0.02777 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003121 | 0.0004563 | 0.684 | 3587 | 0.494 | -0.0009687 | 0.001593 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003541 | 0.000005007 | -0.7072 | 3582 | 0.4795 | -0.0000176 | 0.00001051 |
fixed | NA | male | -0.01515 | 0.006261 | -2.42 | 3601 | 0.01558 | -0.03272 | 0.002424 |
fixed | NA | sibling_count3 | 0.006555 | 0.009888 | 0.6629 | 3008 | 0.5074 | -0.0212 | 0.03431 |
fixed | NA | sibling_count4 | 0.0103 | 0.01033 | 0.9976 | 2766 | 0.3186 | -0.01869 | 0.0393 |
fixed | NA | sibling_count5 | 0.03153 | 0.01178 | 2.677 | 2297 | 0.007475 | -0.001528 | 0.06459 |
fixed | NA | sibling_count>5 | 0.02033 | 0.01 | 2.032 | 2269 | 0.04224 | -0.007749 | 0.0484 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03537 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.182 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1282 | 0.1239 | 1.035 | 3589 | 0.3006 | -0.2195 | 0.4759 |
fixed | NA | birth_order | -0.002884 | 0.001964 | -1.469 | 3298 | 0.142 | -0.008398 | 0.002629 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.008817 | 0.01331 | -0.6622 | 3587 | 0.5079 | -0.04619 | 0.02856 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002926 | 0.0004564 | 0.6411 | 3584 | 0.5215 | -0.0009885 | 0.001574 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.00000345 | 0.000005006 | -0.6891 | 3580 | 0.4908 | -0.0000175 | 0.0000106 |
fixed | NA | male | -0.01511 | 0.00626 | -2.414 | 3600 | 0.01585 | -0.03268 | 0.002463 |
fixed | NA | sibling_count3 | 0.008016 | 0.009934 | 0.8069 | 3012 | 0.4198 | -0.01987 | 0.0359 |
fixed | NA | sibling_count4 | 0.01341 | 0.01054 | 1.272 | 2771 | 0.2035 | -0.01618 | 0.04299 |
fixed | NA | sibling_count5 | 0.03653 | 0.01225 | 2.98 | 2330 | 0.002908 | 0.002125 | 0.07093 |
fixed | NA | sibling_count>5 | 0.0306 | 0.0122 | 2.508 | 2442 | 0.01221 | -0.003649 | 0.06486 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03485 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1821 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.1321 | 0.124 | 1.066 | 3585 | 0.2867 | -0.2159 | 0.4802 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.009326 | 0.01332 | -0.7001 | 3584 | 0.4839 | -0.04672 | 0.02806 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0003124 | 0.0004566 | 0.6841 | 3581 | 0.494 | -0.0009694 | 0.001594 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003693 | 0.00000501 | -0.7371 | 3576 | 0.4611 | -0.00001776 | 0.00001037 |
fixed | NA | male | -0.01529 | 0.006263 | -2.441 | 3596 | 0.01471 | -0.03287 | 0.002295 |
fixed | NA | sibling_count3 | 0.008291 | 0.01015 | 0.8167 | 3103 | 0.4142 | -0.02021 | 0.03679 |
fixed | NA | sibling_count4 | 0.0134 | 0.01095 | 1.224 | 2952 | 0.2211 | -0.01734 | 0.04415 |
fixed | NA | sibling_count5 | 0.03807 | 0.01282 | 2.97 | 2591 | 0.003006 | 0.002088 | 0.07405 |
fixed | NA | sibling_count>5 | 0.03212 | 0.01257 | 2.556 | 2617 | 0.01065 | -0.003157 | 0.0674 |
fixed | NA | birth_order_nonlinear2 | -0.01056 | 0.008247 | -1.281 | 3267 | 0.2004 | -0.03371 | 0.01259 |
fixed | NA | birth_order_nonlinear3 | -0.007715 | 0.009724 | -0.7933 | 3342 | 0.4276 | -0.03501 | 0.01958 |
fixed | NA | birth_order_nonlinear4 | -0.009011 | 0.0122 | -0.7386 | 3412 | 0.4602 | -0.04326 | 0.02524 |
fixed | NA | birth_order_nonlinear5 | -0.02419 | 0.01504 | -1.609 | 3411 | 0.1078 | -0.06641 | 0.01802 |
fixed | NA | birth_order_nonlinear>5 | -0.0218 | 0.01465 | -1.488 | 3518 | 0.137 | -0.06294 | 0.01934 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03468 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1822 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.121 | 0.1244 | 0.9726 | 3574 | 0.3308 | -0.2282 | 0.4703 |
fixed | NA | poly(age, 3, raw = TRUE)1 | -0.008724 | 0.01337 | -0.6525 | 3572 | 0.5141 | -0.04625 | 0.02881 |
fixed | NA | poly(age, 3, raw = TRUE)2 | 0.0002937 | 0.0004585 | 0.6407 | 3568 | 0.5218 | -0.0009932 | 0.001581 |
fixed | NA | poly(age, 3, raw = TRUE)3 | -0.000003527 | 0.000005032 | -0.7009 | 3563 | 0.4834 | -0.00001765 | 0.0000106 |
fixed | NA | male | -0.0155 | 0.006273 | -2.471 | 3586 | 0.01351 | -0.03311 | 0.002107 |
fixed | NA | count_birth_order2/2 | 0.005899 | 0.01572 | 0.3752 | 3261 | 0.7076 | -0.03824 | 0.05003 |
fixed | NA | count_birth_order1/3 | 0.01002 | 0.0132 | 0.7592 | 3585 | 0.4478 | -0.02702 | 0.04706 |
fixed | NA | count_birth_order2/3 | 0.004641 | 0.01468 | 0.3161 | 3586 | 0.7519 | -0.03657 | 0.04585 |
fixed | NA | count_birth_order3/3 | 0.01141 | 0.01582 | 0.721 | 3585 | 0.4709 | -0.033 | 0.05581 |
fixed | NA | count_birth_order1/4 | 0.02893 | 0.01549 | 1.868 | 3585 | 0.06189 | -0.01455 | 0.07241 |
fixed | NA | count_birth_order2/4 | 0.01144 | 0.01628 | 0.7029 | 3586 | 0.4822 | -0.03425 | 0.05714 |
fixed | NA | count_birth_order3/4 | 0.002006 | 0.0169 | 0.1187 | 3585 | 0.9055 | -0.04543 | 0.04944 |
fixed | NA | count_birth_order4/4 | 0.0008381 | 0.01836 | 0.04565 | 3585 | 0.9636 | -0.0507 | 0.05237 |
fixed | NA | count_birth_order1/5 | 0.04949 | 0.02025 | 2.443 | 3585 | 0.0146 | -0.007367 | 0.1063 |
fixed | NA | count_birth_order2/5 | 0.02977 | 0.02263 | 1.316 | 3586 | 0.1884 | -0.03375 | 0.0933 |
fixed | NA | count_birth_order3/5 | 0.04936 | 0.02207 | 2.236 | 3585 | 0.02539 | -0.01259 | 0.1113 |
fixed | NA | count_birth_order4/5 | 0.02171 | 0.02125 | 1.022 | 3584 | 0.307 | -0.03793 | 0.08134 |
fixed | NA | count_birth_order5/5 | 0.01596 | 0.02257 | 0.7072 | 3583 | 0.4795 | -0.0474 | 0.07932 |
fixed | NA | count_birth_order1/>5 | 0.04549 | 0.01974 | 2.305 | 3580 | 0.02123 | -0.009911 | 0.1009 |
fixed | NA | count_birth_order2/>5 | 0.001633 | 0.01997 | 0.08179 | 3585 | 0.9348 | -0.05441 | 0.05768 |
fixed | NA | count_birth_order3/>5 | 0.02498 | 0.01907 | 1.31 | 3586 | 0.1903 | -0.02854 | 0.07849 |
fixed | NA | count_birth_order4/>5 | 0.04811 | 0.01915 | 2.512 | 3585 | 0.01205 | -0.005655 | 0.1019 |
fixed | NA | count_birth_order5/>5 | 0.01544 | 0.01798 | 0.8588 | 3585 | 0.3905 | -0.03503 | 0.06592 |
fixed | NA | count_birth_order>5/>5 | 0.01582 | 0.0139 | 1.138 | 3299 | 0.2552 | -0.0232 | 0.05484 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03447 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.1823 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | -1911 | -1843 | 966.6 | -1933 | NA | NA | NA |
12 | -1911 | -1837 | 967.7 | -1935 | 2.166 | 1 | 0.1411 |
16 | -1905 | -1806 | 968.7 | -1937 | 1.891 | 4 | 0.7558 |
26 | -1893 | -1732 | 972.6 | -1945 | 7.916 | 10 | 0.637 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = ever_smoked)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.03 | 0.0503 | -20.47 | 14536 | 7.361e-92 | -1.171 | -0.8886 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08253 | 0.004782 | 17.26 | 14464 | 4.481e-66 | 0.0691 | 0.09595 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001978 | 0.0001393 | -14.2 | 14316 | 1.824e-45 | -0.002369 | -0.001587 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001503 | 0.000001267 | 11.86 | 14149 | 2.761e-32 | 0.00001147 | 0.00001859 |
fixed | NA | male | 0.6583 | 0.005408 | 121.7 | 14448 | 0 | 0.6431 | 0.6735 |
fixed | NA | sibling_count3 | -0.01002 | 0.01094 | -0.9159 | 10423 | 0.3597 | -0.04075 | 0.0207 |
fixed | NA | sibling_count4 | -0.001492 | 0.01126 | -0.1325 | 9429 | 0.8946 | -0.03311 | 0.03012 |
fixed | NA | sibling_count5 | 0.01039 | 0.01177 | 0.8824 | 8451 | 0.3776 | -0.02265 | 0.04342 |
fixed | NA | sibling_count>5 | 0.01886 | 0.009216 | 2.047 | 9579 | 0.04069 | -0.007005 | 0.04473 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1122 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.311 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.03 | 0.0503 | -20.48 | 14537 | 6.656e-92 | -1.171 | -0.8889 |
fixed | NA | birth_order | -0.0009195 | 0.001144 | -0.8039 | 12993 | 0.4215 | -0.00413 | 0.002291 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0828 | 0.004794 | 17.27 | 14453 | 3.558e-66 | 0.06934 | 0.09626 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001988 | 0.0001398 | -14.22 | 14261 | 1.463e-45 | -0.00238 | -0.001595 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001512 | 0.000001272 | 11.88 | 14068 | 2.065e-32 | 0.00001155 | 0.00001869 |
fixed | NA | male | 0.6583 | 0.005408 | 121.7 | 14447 | 0 | 0.6431 | 0.6735 |
fixed | NA | sibling_count3 | -0.009801 | 0.01095 | -0.8952 | 10442 | 0.3707 | -0.04053 | 0.02093 |
fixed | NA | sibling_count4 | -0.0008537 | 0.01129 | -0.07562 | 9502 | 0.9397 | -0.03255 | 0.03084 |
fixed | NA | sibling_count5 | 0.01149 | 0.01185 | 0.9696 | 8573 | 0.3323 | -0.02177 | 0.04475 |
fixed | NA | sibling_count>5 | 0.02234 | 0.01018 | 2.195 | 10757 | 0.02821 | -0.006234 | 0.05091 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1122 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.311 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.035 | 0.05044 | -20.52 | 14539 | 2.673e-92 | -1.177 | -0.8936 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08307 | 0.004796 | 17.32 | 14460 | 1.516e-66 | 0.06961 | 0.09653 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.001998 | 0.0001399 | -14.29 | 14270 | 5.403e-46 | -0.002391 | -0.001606 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001522 | 0.000001273 | 11.96 | 14066 | 8.39e-33 | 0.00001165 | 0.00001879 |
fixed | NA | male | 0.6584 | 0.005408 | 121.7 | 14443 | 0 | 0.6432 | 0.6736 |
fixed | NA | sibling_count3 | -0.008598 | 0.0111 | -0.7743 | 10829 | 0.4388 | -0.03977 | 0.02257 |
fixed | NA | sibling_count4 | -0.000003608 | 0.01161 | -0.0003108 | 10265 | 0.9998 | -0.03259 | 0.03258 |
fixed | NA | sibling_count5 | 0.01432 | 0.0123 | 1.164 | 9553 | 0.2443 | -0.02021 | 0.04886 |
fixed | NA | sibling_count>5 | 0.02736 | 0.01069 | 2.558 | 11943 | 0.01054 | -0.002663 | 0.05738 |
fixed | NA | birth_order_nonlinear2 | 0.006211 | 0.007852 | 0.791 | 13189 | 0.4289 | -0.01583 | 0.02825 |
fixed | NA | birth_order_nonlinear3 | -0.005846 | 0.009241 | -0.6326 | 12978 | 0.527 | -0.03178 | 0.02009 |
fixed | NA | birth_order_nonlinear4 | 0.0003569 | 0.01056 | 0.0338 | 13112 | 0.973 | -0.02928 | 0.02999 |
fixed | NA | birth_order_nonlinear5 | -0.01352 | 0.01202 | -1.125 | 13128 | 0.2608 | -0.04726 | 0.02022 |
fixed | NA | birth_order_nonlinear>5 | -0.01148 | 0.009959 | -1.153 | 14660 | 0.249 | -0.03943 | 0.01647 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1122 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.311 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.041 | 0.05065 | -20.55 | 14538 | 1.64e-92 | -1.183 | -0.8985 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08302 | 0.004795 | 17.31 | 14451 | 1.774e-66 | 0.06956 | 0.09648 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002001 | 0.0001399 | -14.31 | 14255 | 3.99e-46 | -0.002394 | -0.001609 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00001528 | 0.000001273 | 12.01 | 14043 | 4.727e-33 | 0.00001171 | 0.00001886 |
fixed | NA | male | 0.6581 | 0.005408 | 121.7 | 14434 | 0 | 0.6429 | 0.6733 |
fixed | NA | count_birth_order2/2 | 0.02629 | 0.01527 | 1.722 | 13066 | 0.08507 | -0.01656 | 0.06915 |
fixed | NA | count_birth_order1/3 | -0.01405 | 0.0145 | -0.9691 | 14488 | 0.3325 | -0.05477 | 0.02666 |
fixed | NA | count_birth_order2/3 | 0.01445 | 0.01621 | 0.8916 | 14567 | 0.3726 | -0.03105 | 0.05996 |
fixed | NA | count_birth_order3/3 | 0.00651 | 0.01806 | 0.3604 | 14630 | 0.7186 | -0.0442 | 0.05722 |
fixed | NA | count_birth_order1/4 | 0.01338 | 0.01641 | 0.8149 | 14572 | 0.4151 | -0.0327 | 0.05945 |
fixed | NA | count_birth_order2/4 | 0.006355 | 0.01745 | 0.3641 | 14605 | 0.7158 | -0.04264 | 0.05535 |
fixed | NA | count_birth_order3/4 | -0.001847 | 0.01893 | -0.09757 | 14645 | 0.9223 | -0.05499 | 0.0513 |
fixed | NA | count_birth_order4/4 | 0.01231 | 0.01984 | 0.6205 | 14658 | 0.535 | -0.04338 | 0.068 |
fixed | NA | count_birth_order1/5 | 0.03854 | 0.01879 | 2.051 | 14632 | 0.0403 | -0.01421 | 0.09129 |
fixed | NA | count_birth_order2/5 | 0.005322 | 0.01985 | 0.2681 | 14656 | 0.7886 | -0.0504 | 0.06104 |
fixed | NA | count_birth_order3/5 | 0.003385 | 0.02026 | 0.167 | 14661 | 0.8673 | -0.05349 | 0.06026 |
fixed | NA | count_birth_order4/5 | 0.05807 | 0.0217 | 2.676 | 14670 | 0.007462 | -0.002847 | 0.119 |
fixed | NA | count_birth_order5/5 | -0.008625 | 0.02211 | -0.3901 | 14670 | 0.6964 | -0.07069 | 0.05344 |
fixed | NA | count_birth_order1/>5 | 0.04767 | 0.01512 | 3.152 | 14665 | 0.001622 | 0.005223 | 0.09011 |
fixed | NA | count_birth_order2/>5 | 0.03767 | 0.01564 | 2.409 | 14670 | 0.01603 | -0.006233 | 0.08158 |
fixed | NA | count_birth_order3/>5 | 0.02911 | 0.01529 | 1.903 | 14670 | 0.057 | -0.01382 | 0.07204 |
fixed | NA | count_birth_order4/>5 | 0.0213 | 0.01504 | 1.417 | 14670 | 0.1566 | -0.02091 | 0.06352 |
fixed | NA | count_birth_order5/>5 | 0.02724 | 0.01511 | 1.802 | 14670 | 0.07149 | -0.01518 | 0.06967 |
fixed | NA | count_birth_order>5/>5 | 0.02345 | 0.01185 | 1.979 | 13115 | 0.04789 | -0.009818 | 0.05671 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1121 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.311 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 9037 | 9120 | -4507 | 9015 | NA | NA | NA |
12 | 9038 | 9129 | -4507 | 9014 | 0.6469 | 1 | 0.4212 |
16 | 9042 | 9164 | -4505 | 9010 | 3.709 | 4 | 0.4468 |
26 | 9046 | 9244 | -4497 | 8994 | 16.27 | 10 | 0.09213 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.811 | 0.1473 | -12.3 | 6155 | 2.244e-34 | -2.225 | -1.398 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.175 | 0.01672 | 10.47 | 6159 | 2.005e-25 | 0.1281 | 0.222 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005302 | 0.0005975 | -8.873 | 6165 | 9.192e-19 | -0.006979 | -0.003625 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005222 | 0.000006778 | 7.704 | 6172 | 1.527e-14 | 0.00003319 | 0.00007124 |
fixed | NA | male | 0.5873 | 0.008561 | 68.6 | 6083 | 0 | 0.5633 | 0.6113 |
fixed | NA | sibling_count3 | 0.007451 | 0.0136 | 0.5479 | 4527 | 0.5838 | -0.03072 | 0.04562 |
fixed | NA | sibling_count4 | 0.004702 | 0.01467 | 0.3206 | 4014 | 0.7486 | -0.03647 | 0.04587 |
fixed | NA | sibling_count5 | 0.03346 | 0.01688 | 1.982 | 3606 | 0.04754 | -0.01393 | 0.08085 |
fixed | NA | sibling_count>5 | 0.0422 | 0.01476 | 2.859 | 3391 | 0.004274 | 0.0007688 | 0.08363 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.135 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3135 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.811 | 0.1473 | -12.29 | 6154 | 2.438e-34 | -2.224 | -1.397 |
fixed | NA | birth_order | -0.0006785 | 0.002855 | -0.2377 | 6160 | 0.8122 | -0.008693 | 0.007335 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1751 | 0.01672 | 10.47 | 6159 | 1.991e-25 | 0.1281 | 0.222 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005302 | 0.0005976 | -8.872 | 6164 | 9.248e-19 | -0.006979 | -0.003624 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005219 | 0.000006779 | 7.698 | 6169 | 1.596e-14 | 0.00003316 | 0.00007122 |
fixed | NA | male | 0.5873 | 0.008562 | 68.59 | 6082 | 0 | 0.5633 | 0.6114 |
fixed | NA | sibling_count3 | 0.007791 | 0.01368 | 0.5697 | 4532 | 0.5689 | -0.0306 | 0.04618 |
fixed | NA | sibling_count4 | 0.005488 | 0.01504 | 0.365 | 4024 | 0.7152 | -0.03672 | 0.0477 |
fixed | NA | sibling_count5 | 0.03474 | 0.01772 | 1.96 | 3697 | 0.05003 | -0.015 | 0.08448 |
fixed | NA | sibling_count>5 | 0.04478 | 0.01832 | 2.445 | 3922 | 0.01454 | -0.006637 | 0.09619 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.135 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3135 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.823 | 0.1476 | -12.35 | 6162 | 1.218e-34 | -2.238 | -1.409 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1759 | 0.01674 | 10.5 | 6162 | 1.354e-25 | 0.1289 | 0.2229 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005327 | 0.0005982 | -8.905 | 6165 | 6.916e-19 | -0.007006 | -0.003648 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005238 | 0.000006787 | 7.718 | 6169 | 1.369e-14 | 0.00003333 | 0.00007143 |
fixed | NA | male | 0.5875 | 0.008564 | 68.6 | 6077 | 0 | 0.5634 | 0.6115 |
fixed | NA | sibling_count3 | 0.006373 | 0.01395 | 0.4567 | 4729 | 0.6479 | -0.0328 | 0.04554 |
fixed | NA | sibling_count4 | 0.005122 | 0.01561 | 0.3282 | 4367 | 0.7428 | -0.03869 | 0.04893 |
fixed | NA | sibling_count5 | 0.03905 | 0.01858 | 2.102 | 4148 | 0.03561 | -0.0131 | 0.09119 |
fixed | NA | sibling_count>5 | 0.05275 | 0.01885 | 2.798 | 4185 | 0.005173 | -0.0001796 | 0.1057 |
fixed | NA | birth_order_nonlinear2 | 0.01327 | 0.01101 | 1.205 | 5114 | 0.2282 | -0.01764 | 0.04419 |
fixed | NA | birth_order_nonlinear3 | 0.005947 | 0.01359 | 0.4377 | 5359 | 0.6616 | -0.0322 | 0.04409 |
fixed | NA | birth_order_nonlinear4 | -0.002039 | 0.01687 | -0.1209 | 5538 | 0.9038 | -0.04939 | 0.04532 |
fixed | NA | birth_order_nonlinear5 | -0.0184 | 0.02114 | -0.8704 | 5387 | 0.3841 | -0.07773 | 0.04094 |
fixed | NA | birth_order_nonlinear>5 | -0.01167 | 0.02127 | -0.5488 | 6193 | 0.5832 | -0.07137 | 0.04802 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1349 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3136 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.824 | 0.1479 | -12.33 | 6156 | 1.65e-34 | -2.239 | -1.408 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.175 | 0.01678 | 10.43 | 6154 | 2.86e-25 | 0.1279 | 0.2221 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005298 | 0.0005996 | -8.836 | 6158 | 1.271e-18 | -0.006981 | -0.003615 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005206 | 0.000006804 | 7.651 | 6162 | 2.293e-14 | 0.00003296 | 0.00007116 |
fixed | NA | male | 0.5874 | 0.008572 | 68.52 | 6067 | 0 | 0.5633 | 0.6114 |
fixed | NA | count_birth_order2/2 | 0.03734 | 0.01984 | 1.882 | 5368 | 0.05993 | -0.01836 | 0.09304 |
fixed | NA | count_birth_order1/3 | 0.02279 | 0.01783 | 1.278 | 6153 | 0.2012 | -0.02725 | 0.07282 |
fixed | NA | count_birth_order2/3 | 0.01879 | 0.01937 | 0.9702 | 6189 | 0.332 | -0.03558 | 0.07317 |
fixed | NA | count_birth_order3/3 | 0.01655 | 0.02162 | 0.7655 | 6202 | 0.444 | -0.04413 | 0.07723 |
fixed | NA | count_birth_order1/4 | 0.006185 | 0.0217 | 0.285 | 6184 | 0.7756 | -0.05472 | 0.06709 |
fixed | NA | count_birth_order2/4 | 0.0236 | 0.02242 | 1.053 | 6201 | 0.2924 | -0.03932 | 0.08653 |
fixed | NA | count_birth_order3/4 | 0.03506 | 0.02373 | 1.477 | 6197 | 0.1397 | -0.03157 | 0.1017 |
fixed | NA | count_birth_order4/4 | 0.007861 | 0.02467 | 0.3187 | 6194 | 0.75 | -0.06138 | 0.0771 |
fixed | NA | count_birth_order1/5 | 0.03545 | 0.0295 | 1.202 | 6202 | 0.2295 | -0.04735 | 0.1182 |
fixed | NA | count_birth_order2/5 | 0.06082 | 0.0317 | 1.918 | 6173 | 0.05511 | -0.02817 | 0.1498 |
fixed | NA | count_birth_order3/5 | 0.05973 | 0.02949 | 2.026 | 6181 | 0.04284 | -0.02304 | 0.1425 |
fixed | NA | count_birth_order4/5 | 0.04242 | 0.02892 | 1.467 | 6188 | 0.1424 | -0.03875 | 0.1236 |
fixed | NA | count_birth_order5/5 | 0.03742 | 0.02999 | 1.248 | 6173 | 0.2122 | -0.04677 | 0.1216 |
fixed | NA | count_birth_order1/>5 | 0.09227 | 0.0293 | 3.149 | 6190 | 0.001644 | 0.01003 | 0.1745 |
fixed | NA | count_birth_order2/>5 | 0.06653 | 0.02937 | 2.265 | 6172 | 0.02353 | -0.01591 | 0.149 |
fixed | NA | count_birth_order3/>5 | 0.04338 | 0.02873 | 1.51 | 6153 | 0.1311 | -0.03726 | 0.124 |
fixed | NA | count_birth_order4/>5 | 0.06546 | 0.02705 | 2.42 | 6153 | 0.01554 | -0.01046 | 0.1414 |
fixed | NA | count_birth_order5/>5 | 0.03659 | 0.02583 | 1.417 | 6155 | 0.1566 | -0.0359 | 0.1091 |
fixed | NA | count_birth_order>5/>5 | 0.04926 | 0.01961 | 2.512 | 5699 | 0.01203 | -0.005782 | 0.1043 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1344 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3139 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4222 | 4296 | -2100 | 4200 | NA | NA | NA |
12 | 4224 | 4304 | -2100 | 4200 | 0.05593 | 1 | 0.813 |
16 | 4228 | 4336 | -2098 | 4196 | 3.26 | 4 | 0.5153 |
26 | 4242 | 4417 | -2095 | 4190 | 6.288 | 10 | 0.7905 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.794 | 0.1469 | -12.21 | 6212 | 6.652e-34 | -2.206 | -1.381 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1732 | 0.01669 | 10.38 | 6215 | 5.046e-25 | 0.1263 | 0.22 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005237 | 0.0005964 | -8.78 | 6221 | 2.085e-18 | -0.006911 | -0.003563 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005152 | 0.000006767 | 7.614 | 6228 | 3.051e-14 | 0.00003253 | 0.00007052 |
fixed | NA | male | 0.5869 | 0.008534 | 68.77 | 6136 | 0 | 0.5629 | 0.6108 |
fixed | NA | sibling_count3 | 0.008936 | 0.01474 | 0.6065 | 4703 | 0.5442 | -0.03243 | 0.0503 |
fixed | NA | sibling_count4 | -0.001759 | 0.01552 | -0.1134 | 4287 | 0.9098 | -0.04533 | 0.04181 |
fixed | NA | sibling_count5 | 0.02235 | 0.0167 | 1.338 | 3903 | 0.1809 | -0.02453 | 0.06922 |
fixed | NA | sibling_count>5 | 0.0372 | 0.01461 | 2.547 | 3995 | 0.01091 | -0.003803 | 0.07821 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1351 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3138 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.794 | 0.1469 | -12.21 | 6211 | 6.894e-34 | -2.206 | -1.381 |
fixed | NA | birth_order | 0.00006028 | 0.002496 | 0.02415 | 6060 | 0.9807 | -0.006947 | 0.007068 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1732 | 0.01669 | 10.38 | 6214 | 5.09e-25 | 0.1263 | 0.22 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005237 | 0.0005965 | -8.779 | 6219 | 2.097e-18 | -0.006911 | -0.003562 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005153 | 0.000006769 | 7.612 | 6226 | 3.089e-14 | 0.00003253 | 0.00007053 |
fixed | NA | male | 0.5869 | 0.008535 | 68.77 | 6136 | 0 | 0.5629 | 0.6108 |
fixed | NA | sibling_count3 | 0.008906 | 0.01479 | 0.6023 | 4702 | 0.547 | -0.03261 | 0.05042 |
fixed | NA | sibling_count4 | -0.001826 | 0.01577 | -0.1158 | 4276 | 0.9078 | -0.04608 | 0.04243 |
fixed | NA | sibling_count5 | 0.02224 | 0.01726 | 1.289 | 3920 | 0.1975 | -0.0262 | 0.07068 |
fixed | NA | sibling_count>5 | 0.03698 | 0.01725 | 2.144 | 4304 | 0.03212 | -0.01144 | 0.0854 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1351 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3138 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.805 | 0.1472 | -12.26 | 6217 | 3.554e-34 | -2.218 | -1.392 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1739 | 0.0167 | 10.41 | 6216 | 3.463e-25 | 0.1271 | 0.2208 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005261 | 0.000597 | -8.812 | 6219 | 1.579e-18 | -0.006937 | -0.003585 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005171 | 0.000006775 | 7.631 | 6224 | 2.67e-14 | 0.00003269 | 0.00007073 |
fixed | NA | male | 0.5871 | 0.008536 | 68.78 | 6129 | 0 | 0.5631 | 0.611 |
fixed | NA | sibling_count3 | 0.009283 | 0.01506 | 0.6165 | 4865 | 0.5376 | -0.03298 | 0.05155 |
fixed | NA | sibling_count4 | -0.001904 | 0.01631 | -0.1168 | 4570 | 0.907 | -0.04767 | 0.04387 |
fixed | NA | sibling_count5 | 0.02286 | 0.01805 | 1.267 | 4314 | 0.2053 | -0.02779 | 0.07352 |
fixed | NA | sibling_count>5 | 0.04524 | 0.01778 | 2.545 | 4581 | 0.01097 | -0.004664 | 0.09514 |
fixed | NA | birth_order_nonlinear2 | 0.01394 | 0.01123 | 1.241 | 5253 | 0.2145 | -0.01758 | 0.04546 |
fixed | NA | birth_order_nonlinear3 | -0.0001939 | 0.01354 | -0.01432 | 5491 | 0.9886 | -0.03821 | 0.03782 |
fixed | NA | birth_order_nonlinear4 | 0.006623 | 0.01636 | 0.4047 | 5679 | 0.6857 | -0.03931 | 0.05256 |
fixed | NA | birth_order_nonlinear5 | 0.004426 | 0.02007 | 0.2205 | 5610 | 0.8255 | -0.05192 | 0.06077 |
fixed | NA | birth_order_nonlinear>5 | -0.01611 | 0.01903 | -0.8463 | 6268 | 0.3974 | -0.06954 | 0.03732 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1356 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3136 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.817 | 0.1475 | -12.31 | 6212 | 1.901e-34 | -2.231 | -1.403 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1742 | 0.01673 | 10.41 | 6208 | 3.549e-25 | 0.1272 | 0.2212 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005268 | 0.0005982 | -8.807 | 6212 | 1.644e-18 | -0.006947 | -0.003589 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005175 | 0.000006789 | 7.623 | 6218 | 2.855e-14 | 0.0000327 | 0.00007081 |
fixed | NA | male | 0.5867 | 0.008543 | 68.68 | 6120 | 0 | 0.5627 | 0.6107 |
fixed | NA | count_birth_order2/2 | 0.04181 | 0.0218 | 1.918 | 5523 | 0.05513 | -0.01937 | 0.103 |
fixed | NA | count_birth_order1/3 | 0.0185 | 0.01933 | 0.9574 | 6209 | 0.3384 | -0.03574 | 0.07275 |
fixed | NA | count_birth_order2/3 | 0.0225 | 0.02097 | 1.073 | 6244 | 0.2832 | -0.03636 | 0.08137 |
fixed | NA | count_birth_order3/3 | 0.03344 | 0.02342 | 1.428 | 6258 | 0.1534 | -0.0323 | 0.09919 |
fixed | NA | count_birth_order1/4 | 0.0112 | 0.0227 | 0.4936 | 6239 | 0.6216 | -0.05251 | 0.07491 |
fixed | NA | count_birth_order2/4 | 0.03426 | 0.02315 | 1.48 | 6254 | 0.1389 | -0.03071 | 0.09923 |
fixed | NA | count_birth_order3/4 | -0.0004727 | 0.02537 | -0.01863 | 6253 | 0.9851 | -0.07168 | 0.07074 |
fixed | NA | count_birth_order4/4 | -0.00158 | 0.02624 | -0.06022 | 6252 | 0.952 | -0.07523 | 0.07207 |
fixed | NA | count_birth_order1/5 | 0.05073 | 0.02702 | 1.877 | 6256 | 0.06051 | -0.02512 | 0.1266 |
fixed | NA | count_birth_order2/5 | 0.03313 | 0.02898 | 1.143 | 6247 | 0.2531 | -0.04823 | 0.1145 |
fixed | NA | count_birth_order3/5 | 0.0241 | 0.02834 | 0.8502 | 6246 | 0.3952 | -0.05546 | 0.1036 |
fixed | NA | count_birth_order4/5 | 0.03857 | 0.02958 | 1.304 | 6231 | 0.1924 | -0.04447 | 0.1216 |
fixed | NA | count_birth_order5/5 | 0.03566 | 0.02946 | 1.211 | 6233 | 0.2261 | -0.04702 | 0.1183 |
fixed | NA | count_birth_order1/>5 | 0.06043 | 0.02573 | 2.348 | 6258 | 0.01889 | -0.0118 | 0.1327 |
fixed | NA | count_birth_order2/>5 | 0.05178 | 0.02694 | 1.922 | 6241 | 0.05471 | -0.02386 | 0.1274 |
fixed | NA | count_birth_order3/>5 | 0.04945 | 0.02611 | 1.894 | 6231 | 0.05832 | -0.02385 | 0.1227 |
fixed | NA | count_birth_order4/>5 | 0.07459 | 0.02516 | 2.965 | 6231 | 0.003038 | 0.003974 | 0.1452 |
fixed | NA | count_birth_order5/>5 | 0.05976 | 0.02593 | 2.305 | 6198 | 0.02122 | -0.01303 | 0.1326 |
fixed | NA | count_birth_order>5/>5 | 0.03856 | 0.01928 | 2.001 | 5828 | 0.04548 | -0.01554 | 0.09267 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1352 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3139 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4271 | 4345 | -2124 | 4249 | NA | NA | NA |
12 | 4273 | 4354 | -2124 | 4249 | 0.0006262 | 1 | 0.98 |
16 | 4277 | 4385 | -2123 | 4245 | 3.427 | 4 | 0.489 |
26 | 4291 | 4467 | -2120 | 4239 | 6.031 | 10 | 0.8126 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.855 | 0.1489 | -12.46 | 6036 | 3.362e-35 | -2.273 | -1.437 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1807 | 0.01692 | 10.68 | 6040 | 2.16e-26 | 0.1332 | 0.2282 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005507 | 0.0006047 | -9.107 | 6044 | 1.135e-19 | -0.007204 | -0.003809 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000546 | 0.000006863 | 7.955 | 6051 | 2.117e-15 | 0.00003533 | 0.00007386 |
fixed | NA | male | 0.5873 | 0.008645 | 67.94 | 5964 | 0 | 0.563 | 0.6116 |
fixed | NA | sibling_count3 | 0.002991 | 0.01342 | 0.2229 | 4438 | 0.8236 | -0.03468 | 0.04066 |
fixed | NA | sibling_count4 | -0.001225 | 0.01458 | -0.08399 | 3942 | 0.9331 | -0.04216 | 0.03971 |
fixed | NA | sibling_count5 | 0.01576 | 0.01729 | 0.9113 | 3439 | 0.3622 | -0.03278 | 0.06429 |
fixed | NA | sibling_count>5 | 0.03472 | 0.01492 | 2.327 | 3242 | 0.02001 | -0.007156 | 0.07659 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1349 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3134 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.855 | 0.1489 | -12.46 | 6035 | 3.47e-35 | -2.274 | -1.437 |
fixed | NA | birth_order | -0.000005794 | 0.002939 | -0.001972 | 6064 | 0.9984 | -0.008255 | 0.008243 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1807 | 0.01692 | 10.68 | 6039 | 2.189e-26 | 0.1332 | 0.2282 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005507 | 0.0006048 | -9.106 | 6043 | 1.143e-19 | -0.007205 | -0.003809 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.0000546 | 0.000006865 | 7.954 | 6049 | 2.146e-15 | 0.00003533 | 0.00007387 |
fixed | NA | male | 0.5873 | 0.008646 | 67.93 | 5963 | 0 | 0.563 | 0.6116 |
fixed | NA | sibling_count3 | 0.002994 | 0.0135 | 0.2218 | 4441 | 0.8245 | -0.0349 | 0.04089 |
fixed | NA | sibling_count4 | -0.001218 | 0.01496 | -0.08141 | 3964 | 0.9351 | -0.04321 | 0.04078 |
fixed | NA | sibling_count5 | 0.01577 | 0.01809 | 0.8717 | 3528 | 0.3834 | -0.03501 | 0.06654 |
fixed | NA | sibling_count>5 | 0.03474 | 0.01857 | 1.871 | 3867 | 0.06141 | -0.01738 | 0.08686 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1349 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3134 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.869 | 0.1492 | -12.53 | 6042 | 1.497e-35 | -2.288 | -1.45 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1817 | 0.01694 | 10.73 | 6042 | 1.312e-26 | 0.1341 | 0.2292 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005537 | 0.0006053 | -9.147 | 6044 | 7.824e-20 | -0.007236 | -0.003838 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005483 | 0.000006871 | 7.979 | 6048 | 1.751e-15 | 0.00003554 | 0.00007411 |
fixed | NA | male | 0.5875 | 0.008647 | 67.94 | 5958 | 0 | 0.5632 | 0.6118 |
fixed | NA | sibling_count3 | 0.001975 | 0.01379 | 0.1433 | 4637 | 0.8861 | -0.03672 | 0.04067 |
fixed | NA | sibling_count4 | -0.0008761 | 0.01555 | -0.05635 | 4304 | 0.9551 | -0.04452 | 0.04277 |
fixed | NA | sibling_count5 | 0.02003 | 0.01889 | 1.06 | 3933 | 0.2891 | -0.033 | 0.07306 |
fixed | NA | sibling_count>5 | 0.04395 | 0.01914 | 2.296 | 4145 | 0.0217 | -0.009772 | 0.09767 |
fixed | NA | birth_order_nonlinear2 | 0.01494 | 0.01099 | 1.36 | 5001 | 0.1739 | -0.0159 | 0.04577 |
fixed | NA | birth_order_nonlinear3 | 0.006761 | 0.01359 | 0.4976 | 5226 | 0.6188 | -0.03138 | 0.0449 |
fixed | NA | birth_order_nonlinear4 | -0.002179 | 0.01735 | -0.1256 | 5394 | 0.9001 | -0.05089 | 0.04653 |
fixed | NA | birth_order_nonlinear5 | -0.01151 | 0.022 | -0.5233 | 5266 | 0.6008 | -0.07326 | 0.05023 |
fixed | NA | birth_order_nonlinear>5 | -0.01037 | 0.02192 | -0.4732 | 6052 | 0.6361 | -0.07189 | 0.05115 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.135 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3134 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -1.866 | 0.1496 | -12.47 | 6037 | 2.893e-35 | -2.286 | -1.446 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.1803 | 0.01697 | 10.62 | 6035 | 4.043e-26 | 0.1326 | 0.2279 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.005484 | 0.0006068 | -9.037 | 6038 | 2.137e-19 | -0.007187 | -0.00378 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00005418 | 0.00000689 | 7.864 | 6043 | 4.359e-15 | 0.00003484 | 0.00007352 |
fixed | NA | male | 0.5871 | 0.008655 | 67.84 | 5947 | 0 | 0.5629 | 0.6114 |
fixed | NA | count_birth_order2/2 | 0.03855 | 0.01928 | 2 | 5203 | 0.04559 | -0.01556 | 0.09267 |
fixed | NA | count_birth_order1/3 | 0.01712 | 0.0176 | 0.973 | 6032 | 0.3306 | -0.03228 | 0.06653 |
fixed | NA | count_birth_order2/3 | 0.01647 | 0.01936 | 0.8508 | 6073 | 0.3949 | -0.03787 | 0.07082 |
fixed | NA | count_birth_order3/3 | 0.01444 | 0.02124 | 0.6799 | 6080 | 0.4966 | -0.04519 | 0.07407 |
fixed | NA | count_birth_order1/4 | -0.006943 | 0.02179 | -0.3187 | 6068 | 0.75 | -0.06809 | 0.05421 |
fixed | NA | count_birth_order2/4 | 0.02816 | 0.02244 | 1.255 | 6080 | 0.2096 | -0.03484 | 0.09116 |
fixed | NA | count_birth_order3/4 | 0.02373 | 0.02352 | 1.009 | 6073 | 0.3129 | -0.04228 | 0.08974 |
fixed | NA | count_birth_order4/4 | 0.006673 | 0.02483 | 0.2687 | 6066 | 0.7882 | -0.06303 | 0.07638 |
fixed | NA | count_birth_order1/5 | 0.03185 | 0.0295 | 1.08 | 6080 | 0.2803 | -0.05095 | 0.1147 |
fixed | NA | count_birth_order2/5 | 0.02865 | 0.03271 | 0.876 | 6046 | 0.381 | -0.06316 | 0.1205 |
fixed | NA | count_birth_order3/5 | 0.03949 | 0.03081 | 1.282 | 6053 | 0.2 | -0.04699 | 0.126 |
fixed | NA | count_birth_order4/5 | 0.01282 | 0.03022 | 0.4241 | 6061 | 0.6715 | -0.072 | 0.09763 |
fixed | NA | count_birth_order5/5 | 0.03525 | 0.03195 | 1.103 | 6043 | 0.2699 | -0.05443 | 0.1249 |
fixed | NA | count_birth_order1/>5 | 0.09172 | 0.03002 | 3.055 | 6063 | 0.002259 | 0.007451 | 0.176 |
fixed | NA | count_birth_order2/>5 | 0.04846 | 0.0301 | 1.61 | 6045 | 0.1075 | -0.03603 | 0.133 |
fixed | NA | count_birth_order3/>5 | 0.04365 | 0.02902 | 1.504 | 6030 | 0.1326 | -0.03782 | 0.1251 |
fixed | NA | count_birth_order4/>5 | 0.05895 | 0.02846 | 2.071 | 6003 | 0.03836 | -0.02094 | 0.1388 |
fixed | NA | count_birth_order5/>5 | 0.02874 | 0.0264 | 1.089 | 6027 | 0.2763 | -0.04536 | 0.1029 |
fixed | NA | count_birth_order>5/>5 | 0.04156 | 0.01996 | 2.082 | 5549 | 0.03742 | -0.01448 | 0.0976 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.1344 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.3137 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 4133 | 4207 | -2056 | 4111 | NA | NA | NA |
12 | 4135 | 4216 | -2056 | 4111 | 0.0000002846 | 1 | 0.9996 |
16 | 4140 | 4248 | -2054 | 4108 | 3.094 | 4 | 0.5423 |
26 | 4153 | 4327 | -2050 | 4101 | 7.745 | 10 | 0.6537 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)
birthorder <- birthorder %>% mutate(outcome = still_smoking)
model = lmer(outcome ~ birth_order + poly(age, 3, raw = TRUE) + male + sibling_count + (1 | mother_pidlink),
data = birthorder)
compare_birthorder_specs(model)
outcome_naive_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_naive_factor,
birth_order_nonlinear = birthorder_naive_factor,
birth_order = birthorder_naive,
count_birth_order = count_birthorder_naive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_naive_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4994 | 0.07927 | 6.299 | 4830 | 0.0000000003255 | 0.2768 | 0.7219 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02068 | 0.006708 | 3.082 | 4717 | 0.002065 | 0.001848 | 0.03951 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005941 | 0.0001832 | -3.243 | 4556 | 0.00119 | -0.001108 | -0.00007992 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004817 | 0.000001566 | 3.076 | 4346 | 0.00211 | 0.0000004213 | 0.000009212 |
fixed | NA | male | 0.2089 | 0.02436 | 8.575 | 4962 | 1.302e-17 | 0.1405 | 0.2773 |
fixed | NA | sibling_count3 | 0.01578 | 0.01612 | 0.9789 | 4335 | 0.3277 | -0.02947 | 0.06103 |
fixed | NA | sibling_count4 | 0.003225 | 0.01616 | 0.1996 | 4098 | 0.8418 | -0.04213 | 0.04858 |
fixed | NA | sibling_count5 | 0.009782 | 0.01671 | 0.5853 | 3843 | 0.5583 | -0.03713 | 0.05669 |
fixed | NA | sibling_count>5 | 0.0114 | 0.01314 | 0.8676 | 4225 | 0.3857 | -0.02548 | 0.04827 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03882 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2719 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4993 | 0.07928 | 6.297 | 4830 | 0.0000000003298 | 0.2767 | 0.7218 |
fixed | NA | birth_order | -0.0001987 | 0.001539 | -0.1291 | 4029 | 0.8973 | -0.004519 | 0.004121 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02074 | 0.006724 | 3.084 | 4708 | 0.002055 | 0.001861 | 0.03961 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.000596 | 0.0001838 | -3.243 | 4529 | 0.001192 | -0.001112 | -0.00008008 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004833 | 0.000001571 | 3.076 | 4310 | 0.00211 | 0.0000004227 | 0.000009243 |
fixed | NA | male | 0.2089 | 0.02436 | 8.575 | 4961 | 1.306e-17 | 0.1405 | 0.2773 |
fixed | NA | sibling_count3 | 0.01584 | 0.01613 | 0.9821 | 4338 | 0.3261 | -0.02943 | 0.06111 |
fixed | NA | sibling_count4 | 0.003347 | 0.01619 | 0.2068 | 4110 | 0.8362 | -0.04209 | 0.04878 |
fixed | NA | sibling_count5 | 0.009997 | 0.0168 | 0.5952 | 3868 | 0.5517 | -0.03715 | 0.05714 |
fixed | NA | sibling_count>5 | 0.01211 | 0.01424 | 0.85 | 4440 | 0.3954 | -0.02787 | 0.05209 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03895 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2719 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.4961 | 0.07939 | 6.249 | 4829 | 0.0000000004489 | 0.2732 | 0.7189 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02088 | 0.006727 | 3.104 | 4712 | 0.00192 | 0.001998 | 0.03976 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005984 | 0.0001838 | -3.256 | 4539 | 0.001138 | -0.001114 | -0.00008251 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004839 | 0.000001571 | 3.081 | 4320 | 0.002075 | 0.0000004305 | 0.000009248 |
fixed | NA | male | 0.2098 | 0.02437 | 8.608 | 4956 | 9.817e-18 | 0.1414 | 0.2782 |
fixed | NA | sibling_count3 | 0.02091 | 0.01643 | 1.272 | 4435 | 0.2033 | -0.02522 | 0.06703 |
fixed | NA | sibling_count4 | 0.005396 | 0.01667 | 0.3237 | 4263 | 0.7462 | -0.0414 | 0.05219 |
fixed | NA | sibling_count5 | 0.01371 | 0.01745 | 0.7858 | 4106 | 0.4321 | -0.03527 | 0.0627 |
fixed | NA | sibling_count>5 | 0.01531 | 0.01499 | 1.021 | 4640 | 0.3071 | -0.02677 | 0.0574 |
fixed | NA | birth_order_nonlinear2 | 0.00008096 | 0.01166 | 0.006942 | 4775 | 0.9945 | -0.03266 | 0.03282 |
fixed | NA | birth_order_nonlinear3 | -0.01968 | 0.01347 | -1.462 | 4766 | 0.1439 | -0.05749 | 0.01812 |
fixed | NA | birth_order_nonlinear4 | 0.009552 | 0.01505 | 0.6349 | 4843 | 0.5255 | -0.03268 | 0.05178 |
fixed | NA | birth_order_nonlinear5 | -0.01544 | 0.01716 | -0.8998 | 4879 | 0.3683 | -0.06361 | 0.03273 |
fixed | NA | birth_order_nonlinear>5 | -0.002691 | 0.01378 | -0.1952 | 4922 | 0.8452 | -0.04138 | 0.036 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03821 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.272 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | 0.493 | 0.07968 | 6.187 | 4830 | 0.0000000006637 | 0.2693 | 0.7166 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.02063 | 0.006731 | 3.065 | 4707 | 0.002188 | 0.001737 | 0.03952 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.0005914 | 0.0001838 | -3.217 | 4534 | 0.001303 | -0.001107 | -0.00007543 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000004788 | 0.00000157 | 3.049 | 4316 | 0.002313 | 0.0000003795 | 0.000009196 |
fixed | NA | male | 0.2092 | 0.02437 | 8.584 | 4946 | 1.209e-17 | 0.1408 | 0.2776 |
fixed | NA | count_birth_order2/2 | 0.01447 | 0.02335 | 0.6196 | 4660 | 0.5356 | -0.05109 | 0.08003 |
fixed | NA | count_birth_order1/3 | 0.02399 | 0.02313 | 1.037 | 4966 | 0.2998 | -0.04095 | 0.08892 |
fixed | NA | count_birth_order2/3 | 0.03065 | 0.0246 | 1.246 | 4967 | 0.2128 | -0.03839 | 0.09969 |
fixed | NA | count_birth_order3/3 | 0.007198 | 0.02658 | 0.2708 | 4966 | 0.7865 | -0.06741 | 0.0818 |
fixed | NA | count_birth_order1/4 | 0.0006132 | 0.0246 | 0.02493 | 4967 | 0.9801 | -0.06843 | 0.06966 |
fixed | NA | count_birth_order2/4 | 0.008111 | 0.02642 | 0.307 | 4967 | 0.7589 | -0.06606 | 0.08228 |
fixed | NA | count_birth_order3/4 | -0.001621 | 0.02848 | -0.05692 | 4967 | 0.9546 | -0.08157 | 0.07833 |
fixed | NA | count_birth_order4/4 | 0.03651 | 0.02921 | 1.25 | 4965 | 0.2114 | -0.04548 | 0.1185 |
fixed | NA | count_birth_order1/5 | 0.04653 | 0.0274 | 1.698 | 4967 | 0.08951 | -0.03038 | 0.1234 |
fixed | NA | count_birth_order2/5 | -0.02254 | 0.03016 | -0.7475 | 4967 | 0.4548 | -0.1072 | 0.06211 |
fixed | NA | count_birth_order3/5 | -0.04164 | 0.03144 | -1.324 | 4967 | 0.1854 | -0.1299 | 0.04662 |
fixed | NA | count_birth_order4/5 | 0.02983 | 0.03076 | 0.9699 | 4967 | 0.3321 | -0.05651 | 0.1162 |
fixed | NA | count_birth_order5/5 | 0.06484 | 0.03397 | 1.908 | 4967 | 0.05639 | -0.03053 | 0.1602 |
fixed | NA | count_birth_order1/>5 | 0.02421 | 0.02135 | 1.134 | 4967 | 0.2568 | -0.03571 | 0.08414 |
fixed | NA | count_birth_order2/>5 | 0.03074 | 0.02247 | 1.368 | 4967 | 0.1713 | -0.03233 | 0.09381 |
fixed | NA | count_birth_order3/>5 | 0.01257 | 0.02201 | 0.5714 | 4967 | 0.5678 | -0.0492 | 0.07434 |
fixed | NA | count_birth_order4/>5 | 0.02479 | 0.02202 | 1.126 | 4967 | 0.2603 | -0.03702 | 0.0866 |
fixed | NA | count_birth_order5/>5 | -0.01014 | 0.02209 | -0.4591 | 4967 | 0.6462 | -0.07216 | 0.05187 |
fixed | NA | count_birth_order>5/>5 | 0.01887 | 0.01779 | 1.06 | 4766 | 0.289 | -0.03108 | 0.06881 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.03823 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2719 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 1276 | 1348 | -627.1 | 1254 | NA | NA | NA |
12 | 1278 | 1356 | -627.1 | 1254 | 0.01671 | 1 | 0.8972 |
16 | 1282 | 1386 | -624.8 | 1250 | 4.631 | 4 | 0.3273 |
26 | 1288 | 1457 | -617.9 | 1236 | 13.77 | 10 | 0.1836 |
outcome_uterus_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_alive_factor,
birth_order_nonlinear = birthorder_uterus_alive_factor,
birth_order = birthorder_uterus_alive,
count_birth_order = count_birthorder_uterus_alive) %>%
filter(sibling_count != "1"))
compare_models_markdown(outcome_uterus_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.08365 | 0.2385 | -0.3507 | 1859 | 0.7258 | -0.7532 | 0.5859 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08334 | 0.02526 | 3.299 | 1859 | 0.0009875 | 0.01243 | 0.1542 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002847 | 0.0008678 | -3.281 | 1859 | 0.001055 | -0.005283 | -0.000411 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003 | 0.000009506 | 3.156 | 1859 | 0.001628 | 0.000003313 | 0.00005668 |
fixed | NA | male | 0.2353 | 0.04151 | 5.669 | 1859 | 0.00000001665 | 0.1188 | 0.3519 |
fixed | NA | sibling_count3 | 0.008865 | 0.02092 | 0.4238 | 1859 | 0.6717 | -0.04985 | 0.06758 |
fixed | NA | sibling_count4 | 0.03489 | 0.02196 | 1.589 | 1859 | 0.1123 | -0.02676 | 0.09653 |
fixed | NA | sibling_count5 | 0.02659 | 0.02399 | 1.108 | 1859 | 0.2679 | -0.04075 | 0.09392 |
fixed | NA | sibling_count>5 | 0.03027 | 0.02075 | 1.459 | 1859 | 0.1449 | -0.02799 | 0.08852 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2791 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.08354 | 0.2386 | -0.3502 | 1856 | 0.7262 | -0.7532 | 0.5861 |
fixed | NA | birth_order | -0.001376 | 0.003918 | -0.3513 | 1710 | 0.7254 | -0.01237 | 0.009622 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08351 | 0.02527 | 3.305 | 1850 | 0.0009685 | 0.01258 | 0.1544 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.00285 | 0.0008681 | -3.283 | 1845 | 0.001046 | -0.005287 | -0.0004133 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002997 | 0.000009508 | 3.152 | 1840 | 0.001648 | 0.00000328 | 0.00005666 |
fixed | NA | male | 0.2352 | 0.04153 | 5.664 | 1826 | 0.0000000171 | 0.1187 | 0.3518 |
fixed | NA | sibling_count3 | 0.009502 | 0.021 | 0.4525 | 1653 | 0.651 | -0.04944 | 0.06845 |
fixed | NA | sibling_count4 | 0.03644 | 0.0224 | 1.626 | 1575 | 0.1041 | -0.02645 | 0.09932 |
fixed | NA | sibling_count5 | 0.02904 | 0.02499 | 1.162 | 1462 | 0.2454 | -0.0411 | 0.09918 |
fixed | NA | sibling_count>5 | 0.03525 | 0.02514 | 1.402 | 1446 | 0.161 | -0.03531 | 0.1058 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.003056 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2792 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.08294 | 0.2389 | -0.3471 | 1854 | 0.7285 | -0.7537 | 0.5878 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08364 | 0.02531 | 3.305 | 1854 | 0.0009681 | 0.0126 | 0.1547 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002862 | 0.0008694 | -3.292 | 1854 | 0.001013 | -0.005303 | -0.0004218 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003026 | 0.000009525 | 3.177 | 1854 | 0.001513 | 0.000003522 | 0.00005699 |
fixed | NA | male | 0.2362 | 0.04156 | 5.683 | 1854 | 0.00000001533 | 0.1195 | 0.3528 |
fixed | NA | sibling_count3 | 0.01247 | 0.02145 | 0.5814 | 1854 | 0.561 | -0.04775 | 0.07269 |
fixed | NA | sibling_count4 | 0.04025 | 0.02337 | 1.722 | 1854 | 0.08522 | -0.02536 | 0.1059 |
fixed | NA | sibling_count5 | 0.0282 | 0.02649 | 1.064 | 1854 | 0.2872 | -0.04616 | 0.1026 |
fixed | NA | sibling_count>5 | 0.02489 | 0.02601 | 0.9569 | 1854 | 0.3387 | -0.04812 | 0.0979 |
fixed | NA | birth_order_nonlinear2 | -0.009683 | 0.01749 | -0.5536 | 1854 | 0.5799 | -0.05877 | 0.03941 |
fixed | NA | birth_order_nonlinear3 | -0.01878 | 0.02057 | -0.9128 | 1854 | 0.3615 | -0.07652 | 0.03897 |
fixed | NA | birth_order_nonlinear4 | -0.01068 | 0.02504 | -0.4265 | 1854 | 0.6698 | -0.08097 | 0.05961 |
fixed | NA | birth_order_nonlinear5 | 0.01235 | 0.03151 | 0.3919 | 1854 | 0.6951 | -0.07609 | 0.1008 |
fixed | NA | birth_order_nonlinear>5 | 0.01187 | 0.02963 | 0.4004 | 1854 | 0.6889 | -0.07132 | 0.09505 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2793 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.098 | 0.2399 | -0.4085 | 1844 | 0.683 | -0.7714 | 0.5754 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08341 | 0.02541 | 3.282 | 1844 | 0.00105 | 0.01207 | 0.1547 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002855 | 0.0008731 | -3.27 | 1844 | 0.001097 | -0.005306 | -0.0004039 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003018 | 0.000009567 | 3.155 | 1844 | 0.001632 | 0.000003328 | 0.00005704 |
fixed | NA | male | 0.2385 | 0.04161 | 5.731 | 1844 | 0.00000001166 | 0.1217 | 0.3553 |
fixed | NA | count_birth_order2/2 | 0.02927 | 0.03273 | 0.8945 | 1844 | 0.3712 | -0.06259 | 0.1211 |
fixed | NA | count_birth_order1/3 | 0.01775 | 0.02863 | 0.6201 | 1844 | 0.5353 | -0.06261 | 0.09812 |
fixed | NA | count_birth_order2/3 | 0.0114 | 0.03194 | 0.3568 | 1844 | 0.7213 | -0.07827 | 0.1011 |
fixed | NA | count_birth_order3/3 | 0.03532 | 0.03424 | 1.031 | 1844 | 0.3025 | -0.06081 | 0.1314 |
fixed | NA | count_birth_order1/4 | 0.09363 | 0.03488 | 2.684 | 1844 | 0.007332 | -0.004279 | 0.1915 |
fixed | NA | count_birth_order2/4 | 0.0124 | 0.03513 | 0.3529 | 1844 | 0.7242 | -0.08622 | 0.111 |
fixed | NA | count_birth_order3/4 | 0.029 | 0.03633 | 0.7981 | 1844 | 0.4249 | -0.07299 | 0.131 |
fixed | NA | count_birth_order4/4 | 0.04567 | 0.03891 | 1.174 | 1844 | 0.2407 | -0.06356 | 0.1549 |
fixed | NA | count_birth_order1/5 | 0.06573 | 0.04413 | 1.49 | 1844 | 0.1365 | -0.05813 | 0.1896 |
fixed | NA | count_birth_order2/5 | 0.0229 | 0.04788 | 0.4783 | 1844 | 0.6325 | -0.1115 | 0.1573 |
fixed | NA | count_birth_order3/5 | 0.005765 | 0.04394 | 0.1312 | 1844 | 0.8956 | -0.1176 | 0.1291 |
fixed | NA | count_birth_order4/5 | 0.06116 | 0.04205 | 1.454 | 1844 | 0.146 | -0.05689 | 0.1792 |
fixed | NA | count_birth_order5/5 | 0.02552 | 0.04559 | 0.5598 | 1844 | 0.5757 | -0.1025 | 0.1535 |
fixed | NA | count_birth_order1/>5 | 0.03691 | 0.03967 | 0.9304 | 1844 | 0.3523 | -0.07445 | 0.1483 |
fixed | NA | count_birth_order2/>5 | 0.05884 | 0.04275 | 1.376 | 1844 | 0.1688 | -0.06115 | 0.1788 |
fixed | NA | count_birth_order3/>5 | 0.004336 | 0.0406 | 0.1068 | 1844 | 0.915 | -0.1096 | 0.1183 |
fixed | NA | count_birth_order4/>5 | 0.005484 | 0.03915 | 0.1401 | 1844 | 0.8886 | -0.1044 | 0.1154 |
fixed | NA | count_birth_order5/>5 | 0.07248 | 0.03947 | 1.836 | 1844 | 0.06648 | -0.03832 | 0.1833 |
fixed | NA | count_birth_order>5/>5 | 0.05185 | 0.02905 | 1.785 | 1844 | 0.07444 | -0.02969 | 0.1334 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2794 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 546.4 | 607.3 | -262.2 | 524.4 | NA | NA | NA |
12 | 548.3 | 614.7 | -262.2 | 524.3 | 0.124 | 1 | 0.7248 |
16 | 554.5 | 643.1 | -261.3 | 522.5 | 1.784 | 4 | 0.7754 |
26 | 564.9 | 708.8 | -256.5 | 512.9 | 9.584 | 10 | 0.4777 |
outcome_preg_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_uterus_preg_factor,
birth_order_nonlinear = birthorder_uterus_preg_factor,
birth_order = birthorder_uterus_preg,
count_birth_order = count_birthorder_uterus_preg
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_preg_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.06947 | 0.2387 | -0.291 | 1876 | 0.7711 | -0.7396 | 0.6007 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08058 | 0.02532 | 3.182 | 1876 | 0.001487 | 0.009492 | 0.1517 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002747 | 0.0008703 | -3.156 | 1876 | 0.001624 | -0.00519 | -0.0003039 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002892 | 0.000009536 | 3.032 | 1876 | 0.002461 | 0.000002148 | 0.00005569 |
fixed | NA | male | 0.2456 | 0.04089 | 6.007 | 1876 | 0.000000002266 | 0.1308 | 0.3604 |
fixed | NA | sibling_count3 | 0.02061 | 0.02307 | 0.8931 | 1876 | 0.3719 | -0.04416 | 0.08537 |
fixed | NA | sibling_count4 | 0.01468 | 0.02371 | 0.619 | 1876 | 0.536 | -0.05187 | 0.08123 |
fixed | NA | sibling_count5 | 0.001525 | 0.02502 | 0.06093 | 1876 | 0.9514 | -0.06871 | 0.07176 |
fixed | NA | sibling_count>5 | 0.03133 | 0.02169 | 1.444 | 1876 | 0.1489 | -0.02957 | 0.09222 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2809 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.06945 | 0.2388 | -0.2908 | 1875 | 0.7712 | -0.7398 | 0.6009 |
fixed | NA | birth_order | 0.0005249 | 0.003441 | 0.1525 | 1875 | 0.8788 | -0.009134 | 0.01018 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0805 | 0.02533 | 3.177 | 1875 | 0.00151 | 0.009385 | 0.1516 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002745 | 0.0008706 | -3.153 | 1875 | 0.001639 | -0.005189 | -0.0003016 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002892 | 0.000009539 | 3.032 | 1875 | 0.002463 | 0.000002145 | 0.0000557 |
fixed | NA | male | 0.2457 | 0.0409 | 6.006 | 1875 | 0.000000002277 | 0.1309 | 0.3605 |
fixed | NA | sibling_count3 | 0.02035 | 0.02314 | 0.8797 | 1875 | 0.3791 | -0.04459 | 0.0853 |
fixed | NA | sibling_count4 | 0.01415 | 0.02397 | 0.5904 | 1875 | 0.555 | -0.05312 | 0.08142 |
fixed | NA | sibling_count5 | 0.0006978 | 0.02561 | 0.02725 | 1875 | 0.9783 | -0.07118 | 0.07258 |
fixed | NA | sibling_count>5 | 0.02945 | 0.02495 | 1.18 | 1875 | 0.2381 | -0.04059 | 0.09949 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000004243 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.281 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.06587 | 0.2393 | -0.2753 | 1871 | 0.7831 | -0.7376 | 0.6058 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08039 | 0.02539 | 3.166 | 1871 | 0.001568 | 0.009125 | 0.1516 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002747 | 0.0008723 | -3.149 | 1871 | 0.001666 | -0.005196 | -0.0002981 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002904 | 0.000009559 | 3.038 | 1871 | 0.002412 | 0.000002211 | 0.00005587 |
fixed | NA | male | 0.2466 | 0.04095 | 6.022 | 1871 | 0.000000002072 | 0.1317 | 0.3616 |
fixed | NA | sibling_count3 | 0.02183 | 0.02363 | 0.9241 | 1871 | 0.3555 | -0.04449 | 0.08815 |
fixed | NA | sibling_count4 | 0.01509 | 0.02475 | 0.6096 | 1871 | 0.5422 | -0.05438 | 0.08455 |
fixed | NA | sibling_count5 | 0.000362 | 0.02684 | 0.01349 | 1871 | 0.9892 | -0.07498 | 0.07571 |
fixed | NA | sibling_count>5 | 0.0223 | 0.02591 | 0.8605 | 1871 | 0.3896 | -0.05043 | 0.09502 |
fixed | NA | birth_order_nonlinear2 | -0.005389 | 0.01784 | -0.3021 | 1871 | 0.7626 | -0.05546 | 0.04468 |
fixed | NA | birth_order_nonlinear3 | -0.007488 | 0.0207 | -0.3618 | 1871 | 0.7175 | -0.06558 | 0.05061 |
fixed | NA | birth_order_nonlinear4 | 0.001033 | 0.02432 | 0.04248 | 1871 | 0.9661 | -0.06723 | 0.0693 |
fixed | NA | birth_order_nonlinear5 | 0.00444 | 0.03014 | 0.1473 | 1871 | 0.8829 | -0.08016 | 0.08904 |
fixed | NA | birth_order_nonlinear>5 | 0.0206 | 0.02719 | 0.7578 | 1871 | 0.4487 | -0.05572 | 0.09693 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.00000008561 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2812 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0715 | 0.2401 | -0.2978 | 1861 | 0.7659 | -0.7455 | 0.6025 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08093 | 0.02546 | 3.179 | 1861 | 0.001502 | 0.009471 | 0.1524 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002754 | 0.0008747 | -3.148 | 1861 | 0.00167 | -0.005209 | -0.0002983 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.000029 | 0.000009585 | 3.026 | 1861 | 0.002514 | 0.000002097 | 0.00005591 |
fixed | NA | male | 0.2473 | 0.04103 | 6.026 | 1861 | 0.000000002019 | 0.1321 | 0.3625 |
fixed | NA | count_birth_order2/2 | -0.01316 | 0.03653 | -0.3603 | 1861 | 0.7187 | -0.1157 | 0.08937 |
fixed | NA | count_birth_order1/3 | 0.00648 | 0.03199 | 0.2026 | 1861 | 0.8395 | -0.08332 | 0.09628 |
fixed | NA | count_birth_order2/3 | 0.02276 | 0.03503 | 0.6497 | 1861 | 0.516 | -0.07558 | 0.1211 |
fixed | NA | count_birth_order3/3 | 0.02057 | 0.03696 | 0.5564 | 1861 | 0.578 | -0.08318 | 0.1243 |
fixed | NA | count_birth_order1/4 | 0.004074 | 0.03622 | 0.1125 | 1861 | 0.9105 | -0.0976 | 0.1057 |
fixed | NA | count_birth_order2/4 | -0.0125 | 0.0367 | -0.3405 | 1861 | 0.7335 | -0.1155 | 0.09052 |
fixed | NA | count_birth_order3/4 | 0.01958 | 0.0411 | 0.4763 | 1861 | 0.6339 | -0.09579 | 0.1349 |
fixed | NA | count_birth_order4/4 | 0.03758 | 0.04186 | 0.8979 | 1861 | 0.3694 | -0.07992 | 0.1551 |
fixed | NA | count_birth_order1/5 | 0.03448 | 0.0407 | 0.8472 | 1861 | 0.397 | -0.07977 | 0.1487 |
fixed | NA | count_birth_order2/5 | -0.06708 | 0.04668 | -1.437 | 1861 | 0.1509 | -0.1981 | 0.06395 |
fixed | NA | count_birth_order3/5 | -0.01311 | 0.0456 | -0.2876 | 1861 | 0.7737 | -0.1411 | 0.1149 |
fixed | NA | count_birth_order4/5 | 0.01589 | 0.04613 | 0.3446 | 1861 | 0.7305 | -0.1136 | 0.1454 |
fixed | NA | count_birth_order5/5 | -0.01125 | 0.04681 | -0.2404 | 1861 | 0.8101 | -0.1426 | 0.1201 |
fixed | NA | count_birth_order1/>5 | 0.01485 | 0.03818 | 0.3891 | 1861 | 0.6973 | -0.09232 | 0.122 |
fixed | NA | count_birth_order2/>5 | 0.0675 | 0.04056 | 1.664 | 1861 | 0.09626 | -0.04636 | 0.1814 |
fixed | NA | count_birth_order3/>5 | -0.009537 | 0.03866 | -0.2467 | 1861 | 0.8052 | -0.1181 | 0.099 |
fixed | NA | count_birth_order4/>5 | -0.005476 | 0.03705 | -0.1478 | 1861 | 0.8825 | -0.1095 | 0.09852 |
fixed | NA | count_birth_order5/>5 | 0.03103 | 0.03971 | 0.7813 | 1861 | 0.4347 | -0.08044 | 0.1425 |
fixed | NA | count_birth_order>5/>5 | 0.03933 | 0.03021 | 1.302 | 1861 | 0.1931 | -0.04546 | 0.1241 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2812 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 575.8 | 636.8 | -276.9 | 553.8 | NA | NA | NA |
12 | 577.8 | 644.3 | -276.9 | 553.8 | 0.02339 | 1 | 0.8784 |
16 | 584.7 | 673.3 | -276.3 | 552.7 | 1.123 | 4 | 0.8905 |
26 | 594.9 | 739 | -271.4 | 542.9 | 9.793 | 10 | 0.4588 |
outcome_parental_m1 <- update(m2_birthorder_linear, data = birthorder %>%
mutate(sibling_count = sibling_count_genes_factor,
birth_order_nonlinear = birthorder_genes_factor,
birth_order = birthorder_genes,
count_birth_order = count_birthorder_genes
) %>%
filter(sibling_count != "1"))
## boundary (singular) fit: see ?isSingular
compare_models_markdown(outcome_parental_m1)
m1_covariates_only <- update(m2_birthorder_linear, formula = . ~ . - birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m1_covariates_only, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.04607 | 0.2413 | -0.1909 | 1820 | 0.8486 | -0.7234 | 0.6312 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.0834 | 0.02552 | 3.267 | 1820 | 0.001105 | 0.01175 | 0.155 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002838 | 0.0008763 | -3.239 | 1820 | 0.001221 | -0.005298 | -0.0003785 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002979 | 0.00000959 | 3.107 | 1820 | 0.001922 | 0.000002873 | 0.00005671 |
fixed | NA | male | 0.2043 | 0.04246 | 4.81 | 1820 | 0.00000163 | 0.08506 | 0.3234 |
fixed | NA | sibling_count3 | 0.002244 | 0.02053 | 0.1094 | 1820 | 0.9129 | -0.05537 | 0.05986 |
fixed | NA | sibling_count4 | 0.01715 | 0.02185 | 0.7848 | 1820 | 0.4327 | -0.04418 | 0.07848 |
fixed | NA | sibling_count5 | 0.01547 | 0.02478 | 0.6244 | 1820 | 0.5325 | -0.05409 | 0.08504 |
fixed | NA | sibling_count>5 | 0.01676 | 0.02088 | 0.8027 | 1820 | 0.4223 | -0.04185 | 0.07538 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000003371 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2794 | NA | NA | NA | NA | NA | NA |
plot(allEffects(m1_covariates_only, confidence.level = 0.995))
tidy(m2_birthorder_linear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.04579 | 0.2414 | -0.1897 | 1819 | 0.8495 | -0.7233 | 0.6317 |
fixed | NA | birth_order | -0.001402 | 0.004028 | -0.3481 | 1819 | 0.7278 | -0.01271 | 0.009905 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08359 | 0.02554 | 3.273 | 1819 | 0.001083 | 0.01191 | 0.1553 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002842 | 0.0008765 | -3.242 | 1819 | 0.001209 | -0.005302 | -0.0003811 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00002977 | 0.000009593 | 3.103 | 1819 | 0.001942 | 0.000002843 | 0.0000567 |
fixed | NA | male | 0.2039 | 0.04248 | 4.799 | 1819 | 0.000001729 | 0.08461 | 0.3231 |
fixed | NA | sibling_count3 | 0.002897 | 0.02062 | 0.1405 | 1819 | 0.8882 | -0.05497 | 0.06077 |
fixed | NA | sibling_count4 | 0.01871 | 0.02231 | 0.8385 | 1819 | 0.4018 | -0.04392 | 0.08133 |
fixed | NA | sibling_count5 | 0.01788 | 0.02573 | 0.6947 | 1819 | 0.4873 | -0.05435 | 0.09011 |
fixed | NA | sibling_count>5 | 0.0218 | 0.02541 | 0.8578 | 1819 | 0.3911 | -0.04954 | 0.09314 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2795 | NA | NA | NA | NA | NA | NA |
plot_birthorder2(m2_birthorder_linear, separate = FALSE)
m3_birthorder_nonlinear = update(m1_covariates_only, formula = . ~ . + birth_order_nonlinear)
## boundary (singular) fit: see ?isSingular
tidy(m3_birthorder_nonlinear, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.04889 | 0.2419 | -0.2021 | 1815 | 0.8398 | -0.7279 | 0.6301 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08412 | 0.0256 | 3.286 | 1815 | 0.001035 | 0.01227 | 0.156 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002866 | 0.0008787 | -3.262 | 1815 | 0.001129 | -0.005332 | -0.0003994 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003016 | 0.000009617 | 3.136 | 1815 | 0.00174 | 0.000003163 | 0.00005715 |
fixed | NA | male | 0.2047 | 0.04253 | 4.812 | 1815 | 0.000001614 | 0.08528 | 0.324 |
fixed | NA | sibling_count3 | 0.004311 | 0.0211 | 0.2044 | 1815 | 0.8381 | -0.0549 | 0.06353 |
fixed | NA | sibling_count4 | 0.01953 | 0.02331 | 0.8379 | 1815 | 0.4022 | -0.0459 | 0.08496 |
fixed | NA | sibling_count5 | 0.01357 | 0.02714 | 0.5 | 1815 | 0.6172 | -0.06261 | 0.08975 |
fixed | NA | sibling_count>5 | 0.01085 | 0.02636 | 0.4114 | 1815 | 0.6808 | -0.06316 | 0.08485 |
fixed | NA | birth_order_nonlinear2 | -0.01028 | 0.01744 | -0.5894 | 1815 | 0.5557 | -0.05923 | 0.03867 |
fixed | NA | birth_order_nonlinear3 | -0.01277 | 0.02068 | -0.6177 | 1815 | 0.5369 | -0.07082 | 0.04527 |
fixed | NA | birth_order_nonlinear4 | -0.003305 | 0.02593 | -0.1275 | 1815 | 0.8986 | -0.07608 | 0.06947 |
fixed | NA | birth_order_nonlinear5 | 0.01257 | 0.03247 | 0.3873 | 1815 | 0.6986 | -0.07856 | 0.1037 |
fixed | NA | birth_order_nonlinear>5 | 0.008002 | 0.03061 | 0.2614 | 1815 | 0.7938 | -0.07793 | 0.09394 |
ran_pars | mother_pidlink | sd__(Intercept) | 0 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2797 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m3_birthorder_nonlinear, separate = FALSE)
m4_interaction = update(m3_birthorder_nonlinear, formula = . ~ . - birth_order_nonlinear - sibling_count + count_birth_order)
## boundary (singular) fit: see ?isSingular
tidy(m4_interaction, conf.int = T, conf.level = 0.995)
effect | group | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|---|---|---|
fixed | NA | (Intercept) | -0.0656 | 0.2431 | -0.2698 | 1805 | 0.7873 | -0.7481 | 0.6169 |
fixed | NA | poly(age, 3, raw = TRUE)1 | 0.08471 | 0.02575 | 3.29 | 1805 | 0.001021 | 0.01244 | 0.157 |
fixed | NA | poly(age, 3, raw = TRUE)2 | -0.002891 | 0.000884 | -3.27 | 1805 | 0.001096 | -0.005372 | -0.0004092 |
fixed | NA | poly(age, 3, raw = TRUE)3 | 0.00003046 | 0.000009677 | 3.148 | 1805 | 0.00167 | 0.0000033 | 0.00005763 |
fixed | NA | male | 0.2065 | 0.04261 | 4.845 | 1805 | 0.000001375 | 0.08684 | 0.3261 |
fixed | NA | count_birth_order2/2 | 0.01718 | 0.03204 | 0.5362 | 1805 | 0.5919 | -0.07276 | 0.1071 |
fixed | NA | count_birth_order1/3 | 0.005085 | 0.02819 | 0.1804 | 1805 | 0.8569 | -0.07404 | 0.08421 |
fixed | NA | count_birth_order2/3 | 0.0003569 | 0.03145 | 0.01135 | 1805 | 0.9909 | -0.08793 | 0.08865 |
fixed | NA | count_birth_order3/3 | 0.02669 | 0.03354 | 0.7957 | 1805 | 0.4263 | -0.06746 | 0.1208 |
fixed | NA | count_birth_order1/4 | 0.06555 | 0.0353 | 1.857 | 1805 | 0.06346 | -0.03353 | 0.1646 |
fixed | NA | count_birth_order2/4 | -0.01125 | 0.03483 | -0.323 | 1805 | 0.7467 | -0.109 | 0.08653 |
fixed | NA | count_birth_order3/4 | 0.01287 | 0.03668 | 0.3507 | 1805 | 0.7259 | -0.09011 | 0.1158 |
fixed | NA | count_birth_order4/4 | 0.02968 | 0.03883 | 0.7645 | 1805 | 0.4447 | -0.0793 | 0.1387 |
fixed | NA | count_birth_order1/5 | 0.04971 | 0.0441 | 1.127 | 1805 | 0.2598 | -0.07408 | 0.1735 |
fixed | NA | count_birth_order2/5 | 0.02667 | 0.04994 | 0.534 | 1805 | 0.5934 | -0.1135 | 0.1669 |
fixed | NA | count_birth_order3/5 | -0.01025 | 0.04789 | -0.2141 | 1805 | 0.8305 | -0.1447 | 0.1242 |
fixed | NA | count_birth_order4/5 | 0.0333 | 0.04609 | 0.7225 | 1805 | 0.4701 | -0.09607 | 0.1627 |
fixed | NA | count_birth_order5/5 | 0.004253 | 0.04725 | 0.09001 | 1805 | 0.9283 | -0.1284 | 0.1369 |
fixed | NA | count_birth_order1/>5 | 0.01471 | 0.04019 | 0.3659 | 1805 | 0.7145 | -0.09812 | 0.1275 |
fixed | NA | count_birth_order2/>5 | 0.03404 | 0.04497 | 0.757 | 1805 | 0.4491 | -0.09219 | 0.1603 |
fixed | NA | count_birth_order3/>5 | -0.01059 | 0.0404 | -0.262 | 1805 | 0.7933 | -0.124 | 0.1028 |
fixed | NA | count_birth_order4/>5 | 0.007186 | 0.04081 | 0.1761 | 1805 | 0.8603 | -0.1074 | 0.1217 |
fixed | NA | count_birth_order5/>5 | 0.05585 | 0.04037 | 1.384 | 1805 | 0.1666 | -0.05745 | 0.1692 |
fixed | NA | count_birth_order>5/>5 | 0.0298 | 0.02955 | 1.009 | 1805 | 0.3133 | -0.05314 | 0.1127 |
ran_pars | mother_pidlink | sd__(Intercept) | 0.000000002737 | NA | NA | NA | NA | NA | NA |
ran_pars | Residual | sd__Observation | 0.2799 | NA | NA | NA | NA | NA | NA |
plot_birthorder(m4_interaction)
###### Model 1 - Model 2
anova(m1_covariates_only, m2_birthorder_linear, m3_birthorder_nonlinear, m4_interaction)
## refitting model(s) with ML (instead of REML)
Df | AIC | BIC | logLik | deviance | Chisq | Chi Df | Pr(>Chisq) |
---|---|---|---|---|---|---|---|
11 | 539.4 | 600.1 | -258.7 | 517.4 | NA | NA | NA |
12 | 541.3 | 607.5 | -258.7 | 517.3 | 0.1219 | 1 | 0.727 |
16 | 548.3 | 636.5 | -258.2 | 516.3 | 0.9801 | 4 | 0.9128 |
26 | 561 | 704.3 | -254.5 | 509 | 7.335 | 10 | 0.6935 |
library(coefplot)
multiplot(outcome_naive_m1, outcome_preg_m1, outcome_uterus_m1, outcome_parental_m1, dodgeHeight = 0.6,
intercept = FALSE)