-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPD_parity_and_onset_age.Rmd
1127 lines (954 loc) · 64 KB
/
PD_parity_and_onset_age.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Childbirth and delayed Parkinson’s onset: a reproducible non-biological artefact of societal change."
shorttitle: "Parkinson's and childbirth"
author:
- name : "Michael R. MacAskill, PhD"
affiliation : "1,2"
corresponding : yes # Define only one corresponding author
address : "66 Stewart St, Christchurch 8011, New Zealand"
email : "[email protected]"
- name : "Daniel J. Myall, PhD"
affiliation : "1"
- name : "Reza Shoorangiz, PhD"
affiliation : "1,3"
- name : "Tim J. Anderson, MD, FRACP"
affiliation : "1,2,4,5"
- name : "Toni L. Pitcher, PhD"
affiliation : "1,2,4"
affiliation:
- id : "1"
institution : "New Zealand Brain Research Institute, 66 Stewart St, Christchurch, New Zealand"
- id : "2"
institution : "Department of Medicine, University of Otago, Christchurch; Christchurch, New Zealand"
- id : "3"
institution : "Department of Electrical and Computer Engineering, University of Canterbury, Christchurch, New Zealand"
- id : "4"
institution : "Brain Research New Zealand, Rangahau Roro Aotearoa"
- id : "5"
institution : "Department of Neurology, Christchurch Hospital, Christchurch, New Zealand"
csl: format/sage-vancouver.csl
bibliography: format/selected_refs.bib
abstract: |
**Background:** Uncontrolled studies have reported associations between later Parkinson's onset in women and a history of giving birth, with age of onset delayed by nearly three years per child.
**Objectives:** We tested this association in two independent datasets but, as a control to test for non-biological explanations, also included men with Parkinson's.
**Methods:** We analysed valid cases from the Parkinson's Progressive Markers Initiative incident sample (PPMI: 145 women, 276 men) and a prevalent sample surveyed by the New Zealand Brain Research Institute (NZBRI: 210 women, 394 men).
**Results:** The association was present in both women and men in the PPMI study, and absent in both in the NZBRI study. This is consistent with generational differences, common to men and women, which confound with age of onset in incident-dominant samples.
**Conclusion:** Despite being replicable in certain circumstances, associations between childbirth and later Parkinson's onset are an artefact of generational cohort differences.
keywords : "Parkinson disease, sex differences, pregnancy, epidemiology, cohort effects, sex hormones"
wordcount : "Abstract: 150, main body: 1835"
floatsintext : no
figurelist : no
tablelist : no
footnotelist : no
linenumbers : yes
mask : no
draft : no
documentclass : "apa6"
classoption : "man"
output : papaja::apa6_word
---
```{r setup, include=FALSE}
###########################################################################
# The papaja package is used to format the resulting manuscript.
# It is not currently available on CRAN, so install from GitHub using devtools:
#
# install.packages('devtools')
# devtools::install_github('crsh/papaja')
###########################################################################
library(papaja)
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
warning = FALSE,
dpi = 600 # for reasonable dpi in Word document bitmap figures
)
# allow complex kableExtra features to render in Word:
options(kableExtra.auto_format = FALSE)
```
```{r control}
rstan::rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
###########################################################################
# fitting the models takes time. The model objects are therefore cached to
# disk for subsequent re-use, to save time when re-running the script.
# So once this script has been run once, set this flag to FALSE. The
# previously-fit models will then be read from disk, rather than be re-
# calculated afresh. THESE MODELS ARE NOT NECESSARILY PLATFORM-AGNOSTIC,
# SO THEY MAY NEED TO BE RECALCULATED THE FIRST TIME THIS SCRIPT IS RUN ON
# A NEW COMPUTER:
RECALCULATE_MODELS = TRUE
###########################################################################
###########################################################################
# The Canterbury data requires matching survey responses to NZBRI-held info
# on diagnosis age. This will eventually break, as it relies on old
# internal processes to access data. So after the data sources were matched,
# we saved them to a cached .csv file on disk and use that thereafter.
# This setting should be TRUE for people using the publicly-available
# distribution, as only this tidied and anonymised data is included:
USE_CACHED_CANTERBURY_DATA = TRUE
###########################################################################
###########################################################################
# The NZ national data required a lot of tidying. For convenience, one can
# instead import the processed file. So after the data sources were matched,
# we saved them to a cached .csv file on disk and use that thereafter.
# This setting should be TRUE for people using the publicly-available
# distribution, as only the tidied and anonymised data is included:
USE_CACHED_NATIONAL_DATA = TRUE
###########################################################################
###########################################################################
# We can't distribute the full PMMI datasets. If you wish to work with
# those, you should obtain permission to access them from the PPMI site
# directly. The following PPMI files are required if you want to follow
# along with how we processed and joined them:
#
# Patient_Status.csv
# Screening___Demographics.csv
# PD_Features.csv
# Family_History__PD_.csv
#
# Otherwise, we include here only a file with the minimal extracted and
# anonymised variables resulting from joining the datsets above, removing any
# unused variables and records. This allows you to run this analysis without
# access to the full PPMI tables:
USE_CACHED_PPMI_DATA = TRUE
###########################################################################
```
```{r import-packages, message=FALSE}
# currently need to suppress messages in this block as the tidyverse import
# produces tick marks that throw off the latex rendering:
suppressMessages(library(tidyverse))
library(magrittr) # for %<>%
library(knitr) # for kable() function to format tables
library(kableExtra) # additional table formatting options
library(lubridate) # manipulate dates
library(glue) # construct formatted strings (neater than paste)
library(janitor) # clean column names
library(brms) # bayesian modelling
library(ggeffects) # for visualising model predictions
library(cowplot) # construct multi-panel figures
library(lme4) # required by get_brms_formula
if (!USE_CACHED_CANTERBURY_DATA) {
# in-house-only NZBRI package required to access our study data:
library(chchpd)
chchpd::google_authenticate()
}
```
```{r define-variables}
# how many iterations to use in the model fitting.
# For Bayes factors require 10 × usual amount, compared to parameter estimation:
N_ITERATIONS = 20000
# specify manual colour scheme (colour blindness-safe orange and blue):
two_colours = c('#D55E00', '#0072B2')
ndigits <- function(number, digits = 1){
return(format(round(number, digits = digits), nsmall = digits))
}
```
```{r import-nz-canterbury-data}
if (USE_CACHED_CANTERBURY_DATA) {
# read from the previously merged and processed data set:
dat_canty = read_csv('data/anonymised/nz_canterbury_data.csv')
} else # see what was required to merge & clean the various data sources:
{
# data collected by Toni Pitcher via an online survey of NZBRI participants
# in 2014-15 and with new cases from 2018 appended:
exposure_file = 'data/source/NZBRI/Environmental Exposures Relevant to PD_FINAL.csv'
exposures = read_csv(exposure_file) %>%
janitor::clean_names() %>%
rename(survey_id = id_number_supplied_by_the_nzbri) %>%
# extract the date to be able to work out age at time of survey:
mutate(survey_date = ymd(str_sub(timestamp, start = 1, end = 10))) %>%
# remove test ID values, which were non-numeric:
mutate(survey_id = as.integer(survey_id)) %>%
filter(!is.na(survey_id)) %>%
# repair some erroneously-entered survey ids:
mutate(survey_id =
case_when(survey_id == 2577 ~ 25577L,
survey_id == 3478 ~ 34827L,
survey_id == 8029 ~ 18029L,
survey_id == 23761 ~ 23764L,
survey_id == 30863 ~ 30683L,
survey_id == 7293 ~ 72937L,
TRUE ~ survey_id)) %>%
rename(how_many = how_many_children_do_you_have) %>%
mutate(how_many = str_to_lower(how_many)) %>%
mutate(n_children =
case_when(do_you_have_any_children == 'No' ~ 0,
how_many == '??' ~ NA_real_,
how_many %in% c('2 adopted', '2 boys who are adopted') ~ 0,
how_many %in% c('one', 'one {blood}') ~ 1,
how_many %in% c('2!', 'two', '2 children') ~ 2,
how_many == 'three' ~ 3,
how_many %in% c('four', '4 children', '4sons') ~ 4,
how_many == 'nine' ~ 9,
TRUE ~ as.numeric(how_many))) %>%
filter(!is.na(n_children)) %>%
# restrict to relevant variables:
select(survey_id, survey_date, n_children)
participants = chchpd::import_participants(identifiers = TRUE) %>% # as need DOB
mutate(birth_year = year(birth_date)) %>%
select(subject_id, survey_id, participant_group, symptom_onset_age,
diagnosis_age, birth_year, birth_date, sex)
# join the exposure data to the participant data:
dat_canty = exposures %>%
left_join(participants, by = 'survey_id') %>%
mutate(age = round(interval(birth_date, survey_date) / years(1), digits = 1),
duration_dx = round(age - diagnosis_age, digits = 1),
duration_sx = round(age - symptom_onset_age, digits = 1))
# identify those that didn't match (likely due to subject making
# a manual data entry error of their subject id:)
unmatched_survey = dat_canty %>%
filter(is.na(subject_id)) %>%
select(survey_id) %>%
rename(unmatched_survey_id = survey_id)
kable(unmatched_survey)
# drop controls and one PSP case:
dat_canty %<>%
filter(participant_group == 'PD') %>%
mutate(sex = factor(sex, levels = c('Female', 'Male'),
labels = c('Women', 'Men')))
# identify those that don't have a diagnosis age recorded in Alice:
missing_diagnosis_age = dat_canty %>%
filter(is.na(diagnosis_age)) %>%
select(subject_id) %>%
rename(missing_diagnosis_age = subject_id)
kable(missing_diagnosis_age)
# tidy up for mating to PPMI data:
dat_canty %<>%
filter(!is.na(diagnosis_age)) %>%
mutate(study = 'NZBRI',
substudy = 'Canterbury') %>%
select(study, substudy, sex, n_children, symptom_onset_age,
diagnosis_age, birth_year, age, duration_dx, duration_sx) %>%
arrange(study, sex, n_children, diagnosis_age)
# save merged data to a cached file:
dat_canty %>% write_csv('data/anonymised/nz_canterbury_data.csv')
}
```
```{r import-nz-national-data}
if (USE_CACHED_NATIONAL_DATA) {
# read from the previously merged and processed data set:
dat_national = read_csv('data/anonymised/nz_national_data.csv')
} else # this was done to tidy and process the raw survey responses:
{
# data collected by Toni Pitcher via a national online survey of Parkinson's
# NZ members, excluding people in Canterbury:
national_file = 'data/source/NZBRI/Diagnosis, treatment and risk factors associated with Parkinson’s and related disorders in New Zealand..csv'
# this dataset doesn't need to be joined to anything else, as it contains info
# on both number of children as well as age of onset.
dat_national = read_csv(national_file) %>%
janitor::clean_names() %>%
# filter out people who didn't consent:
filter(i_understand_that_completing_this_survey_is_voluntary_and_my_ongoing_clinical_care_will_not_be_influenced_by_my_decision_about_this_survey == "Yes, I'm happy to complete the survey") %>%
# include only IPD:
filter(what_disorder_have_you_been_diagnosed_with %in% c("Parkinson's disease", "Parkinson’s disease with dementia")) %>%
# extract the date to be able to work out age at time of survey:
mutate(survey_date = ymd(str_sub(timestamp, start = 1, end = 10)),
survey_year = year(survey_date)) %>%
rename(diagnosis_age = how_old_were_you_when_you_received_your_neurological_diagnosis,
pre_diagnosis_years = how_long_were_you_aware_of_symptoms_of_your_neurological_condition_before_you_sought_a_medical_opinion,
sex = what_sex_are_you,
age = what_is_your_current_age,
have_children = do_you_have_any_offspring_children,
how_many = how_many_children_do_you_have,
have_adopted = are_any_of_these_children_adopted_or_fostered_i_e_not_your_biological_child,
how_many_adopted = how_many_of_your_children_are_not_your_biological_child) %>%
select(survey_date,
survey_year,
diagnosis_age,
pre_diagnosis_years,
sex,
age,
have_children,
how_many,
have_adopted,
how_many_adopted)
# clean up the national data:
dat_national %<>%
filter(!is.na(sex),
sex != 'MTF') %>%
mutate(sex = factor(sex, levels = c('Female', 'Male'),
labels = c('Women', 'Men'))) %>%
mutate_at(c('diagnosis_age', 'age', 'how_many'), str_to_lower) %>%
mutate_at(c('diagnosis_age', 'age', 'how_many'), str_remove_all, ' ') %>%
mutate(diagnosis_age =
str_remove(diagnosis_age,
regex(str_c(c('yearsold', 'yrsold', '\\.5yearsold', '\\.5years',
'years5months', 'yearsithink', 'yrslthink',
'years', 'yrs', 'yr',
'about', '\\?', 'approx'), collapse = '|')))) %>%
mutate(diagnosis_age = case_when(diagnosis_age == 'sixty' ~ '60',
diagnosis_age == '61andsxmonths' ~ '61',
diagnosis_age == 'sixtyfive' ~ '65',
diagnosis_age == 'age69.' ~ '69',
diagnosis_age == 'seventy' ~ '70',
diagnosis_age == 'seventyone' ~ '71',
diagnosis_age == 'seventytwo' ~ '72',
diagnosis_age == 'seventyfive' ~ '75',
diagnosis_age == '8o' ~ '80',
diagnosis_age == '5ago' ~ '-5',
diagnosis_age == '2004' ~ '-15',
diagnosis_age == '2006' ~ '-13',
diagnosis_age == '2008' ~ '-11',
diagnosis_age == '2016' ~ '-3',
diagnosis_age == '7' ~ NA_character_,
diagnosis_age == '11' ~ NA_character_,
diagnosis_age == '77or78' ~ NA_character_,
diagnosis_age == 'early40s' ~ NA_character_,
diagnosis_age == 'didnothaveneurologicaldiagnosis' ~ NA_character_,
diagnosis_age == 'alotdisapointed' ~ NA_character_,
str_detect(diagnosis_age, 'dadwasalreadyaware') ~ NA_character_,
TRUE ~ diagnosis_age)) %>%
filter(!is.na(diagnosis_age)) %>%
mutate(age =
str_remove(age,
regex(str_c(c('yearsand11months', 'years6months', 'yrs6mths', 'yrs9mths', 'yearsold',
'years', 'yrs', 'yr', 'y8m',
'\\.6years','\\.5', 'tezs'),
collapse = '|')))) %>%
mutate(age = case_when(age == 'sixtyseventenmonths' ~ '67',
age == 'seventy-one' ~ '71',
age == 'eighty' ~ '80',
age == '668' ~ NA_character_,
age == '791' ~ NA_character_,
TRUE ~ age)) %>%
filter(!is.na(age))
dat_national %<>%
# careful, this will wipe out any remaining that can't be parsed into numeric form:
mutate_at(c('diagnosis_age', 'age'), as.numeric) %>%
filter(!is.na(diagnosis_age), !is.na(age)) %>%
# turn relative diagnosis years into absolute ages:
mutate(diagnosis_age = case_when(diagnosis_age < 0 ~ diagnosis_age + age,
TRUE ~ diagnosis_age))
dat_national %<>%
mutate(how_many = case_when(how_many == 'one' ~ '1',
how_many == 'one.' ~ '1',
how_many == '1adoptedson' ~ '1',
how_many == '1alive,1deceased' ~ '2',
how_many == 'two' ~ '2',
how_many == 'twp' ~ '2',
how_many == 'two-twins' ~ '2',
how_many == '2adultdaughters' ~ '2',
how_many == 'yesido.sonanddaugther' ~ '2',
how_many == 'three' ~ '3',
how_many == '3adults' ~ '3',
how_many == '3birthsbut2livingsons' ~ '3',
how_many == '3theyareadultsnow' ~ '3',
how_many == 'four' ~ '4',
how_many == '4sons' ~ '4',
how_many == '4butonly2stillliving' ~ '4',
how_many == 'five' ~ '5',
# obfuscate some identifying values by not
# stating entire search term:
str_detect(how_many, 'twonow,daughterpassedaway') ~ '3',
str_detect(how_many, '3onlytwolivingeldestdied') ~ '3',
TRUE ~ how_many)) %>%
# now wipe out any remaining that can't be parsed into numeric form:
mutate(how_many = as.numeric(how_many)) %>%
# some stated they had children yet had NA for the number:
filter(!(is.na(how_many) & have_children == 'Yes')) %>%
mutate(how_many = replace_na(how_many, 0),
how_many_adopted = replace_na(how_many_adopted, 0)) %>%
mutate(n_children = how_many - how_many_adopted) %>%
# calculate various temporal variables:
mutate(birth_year = survey_year - age,
duration_dx = age - diagnosis_age) %>%
filter(duration_dx >= 0) %>% # one case was diagnosed at 83 but is age 68?
# tidy up for mating to PPMI data:
mutate(study = 'NZBRI',
substudy = 'National') %>%
select(study, substudy, sex, n_children, diagnosis_age, birth_year, age,
duration_dx) %>%
arrange(study, sex, n_children, diagnosis_age)
# save processed data to a cached file:
dat_national %>% write_csv('data/anonymised/nz_national_data.csv')
}
```
```{r import-ppmi-data}
# PPMI dates are often anonymised to be strings of the form 'MM/YYYY'. To do
# calculations on these values requires that they become real date objects. We
# coerce the values as.character in case they have been imported as a factor,
# and set an arbitrary day of 15.
MMYYYYtoDate <- function(MMYYYY){
return(
dmy(paste('15/', as.character(MMYYYY),
sep=''))
)
}
# Similarly, DOBs are given as bare years, so we convert to a full year date
# as at June 30:
YYYYtoDate <- function(YYYY){
return(
dmy(paste('30/6/', as.character(YYYY),
sep=''))
)
}
if (USE_CACHED_PPMI_DATA) {
# read from the previously merged and minimised data set:
dat_ppmi = read_csv('data/anonymised/ppmi_data.csv')
} else # if there is access to the full PPMI tables, merge them:
{
# READ IN THE PARTICIPANT GROUP ASSIGNMENT:
groups = read.csv('data/source/PPMI/Patient_Status.csv',
stringsAsFactors = FALSE) %>%
select(PATNO, ENROLL_CAT, ENROLL_STATUS, ENROLL_DATE) %>%
filter(ENROLL_STATUS=='Enrolled' | ENROLL_STATUS=='Withdrew') %>%
filter(ENROLL_CAT != '') %>%
mutate(ENROLL_DATE = MMYYYYtoDate(ENROLL_DATE)) %>%
# exclude control, SWEDD, prodromal, genetics etc groups:
filter(ENROLL_CAT == 'PD')
# READ IN THE YEAR OF BIRTH:
YOBs = read.csv('data/source/PPMI/Screening___Demographics.csv',
stringsAsFactors = FALSE) %>%
select(PATNO, BIRTHDT, GENDER) %>% # TODO some YOBs are missing NA
# convert from bare years to a full date format:
rename(birth_year = BIRTHDT) %>%
mutate(BIRTHDT = YYYYtoDate(birth_year))
# get the date of PD diagnosis:
# There is some double counting has been resolved:
PD_dx_date = read.csv('data/source/PPMI/PD_Features.csv',
stringsAsFactors = FALSE) %>%
select(PATNO, PDDXDT, SXMO, SXYEAR) %>%
# construct a date for the symptom onset:
unite(col = SXDT, SXMO, SXYEAR, sep = '/') %>%
# convert partial dates to true date format, adding a dummy day value:
mutate(PDDXDT = MMYYYYtoDate(PDDXDT),
SXDT = MMYYYYtoDate(SXDT)) %>%
# sort out duplicates:
group_by(PATNO) %>%
summarise(PDDXDT = first(PDDXDT),
SXDT = first(SXDT))
FHx = read.csv('data/source/PPMI/Family_History__PD_.csv',
stringsAsFactors = FALSE)
dat_ppmi = left_join(groups, YOBs, by = 'PATNO') %>%
left_join(FHx %>% select(-EVENT_ID), by = 'PATNO') %>%
left_join(PD_dx_date, by = 'PATNO')
dat_ppmi %<>% mutate(
age = round(interval(BIRTHDT, ENROLL_DATE)/years(1), digits = 1),
diagnosis_age = round(interval(BIRTHDT, PDDXDT)/years(1), digits = 1),
symptom_onset_age = round(interval(BIRTHDT, SXDT)/years(1), digits = 1),
duration_dx = round(age - diagnosis_age, digits = 1),
duration_sx = round(age - symptom_onset_age, digits = 1),
sex = case_when(GENDER == 0 ~ 0,
GENDER == 1 ~ 0,
GENDER == 2 ~ 1), # recode all women to female, regardless of child-bearing potential
sex = factor(sex, labels = c('Women', 'Men'))) %>%
filter(!is.na(KIDSNUM)) # two people have missing KIDSNUM values
dat_ppmi %<>%
mutate(study = 'PPMI',
substudy = 'PPMI') %>%
rename(n_children = KIDSNUM) %>%
select(study, substudy, sex, n_children, symptom_onset_age, diagnosis_age,
birth_year, age, duration_dx, duration_sx) %>%
arrange(study, sex, n_children, diagnosis_age)
# save merged data to a cached file:
dat_ppmi %>% write_csv('data/anonymised/ppmi_data.csv')
########
# NB there are minor issues with -ve lags between SX and DX ages for
# 3 subjects.
########
}
```
```{r combine-data}
# combine data:
dat = bind_rows(dat_canty, dat_national, dat_ppmi) %>%
arrange(study, sex, n_children, diagnosis_age) %>%
mutate(study = factor(study, levels = c('PPMI', 'NZBRI'))) %>%
mutate(substudy = factor(substudy,
levels = c('PPMI', 'Canterbury', 'National'))) %>%
group_by(study) %>%
mutate(birth_year_std = birth_year - min(birth_year, na.rm = TRUE)) %>%
ungroup()
```
```{r fit-or-load-models, echo=FALSE, message=FALSE, warning=FALSE}
# decide whether to fit models from scratch, or save execution time by reloading
# models saved to disk previously:
if (RECALCULATE_MODELS) {
########
# Define priors
# See https://github.com/stan-dev/stan/wiki/Prior-Choice-Recommendations
#
# Use weakly-informative priors for intercept and standard deviation of
# residuals.
# For intercept: Student-t distribution, df = 3, mean = 0, scale = 10
# For standard deviation of residuals: Student-t distribution, df = 3,
# mean = 0, scale = 10 with rejection sampling on the prior to ensure greater
# or equal to 0.
# Matches the defaults for brms.
#
# Probability density function definition for the Student-t distribution:
# https://mc-stan.org/docs/2_22/functions-reference/student-t-distribution.html
#
# To transform scale of Student-t to standard deviation:
# https://jrnold.github.io/bugs-examples-in-stan/resistant.html
# \sigma^{*} &\sim \mathsf{HalfCauchy}{(0, 5)} \\
# \sigma &= \sigma^{*} \sqrt{\frac{\nu - 2}{\nu}} \\
#
# For Bayes Factors need proper priors on non-common parameter between model.
# By default brms has improper priors on regression coefficients.
#
# We use informative priors for the effect of number of children, based upon
# three previous studies cited in the paper: Haaxma et al. (2007), Yadav et
# al. (2012), and Frentzel et al. (2017).
#
# Older age == earlier birth year, thus reversal of sign for effect:
#
# For age: Normal distribution with mean = 2.5, sd = 2
# For year: Normal distribution with mean = -2.5, sd = 2
########
nchildren_onset_age_effect_prior_mean = 2.5
nchildren_birth_year_effect_prior_mean = -2.5
intercept_only_prior <- function(int_centre){
df = 3
int_scale = 10
var_scale = 10
return(c(prior_string(glue('student_t({df}, {int_centre}, {int_scale})'),
class = 'Intercept'),
prior_string(glue('student_t({df}, 0, {var_scale})'),
class = 'sigma')))
}
nchildren_effect_prior <- function(int_centre,b_centre){
df = 3
int_scale = 10
var_scale = 10
b_scale = 2
return(c(prior_string(glue('student_t({df}, {int_centre}, {int_scale})'),
class = 'Intercept'),
prior_string(glue('student_t({df}, 0, {var_scale})'),
class = 'sigma'),
prior_string(glue('normal({b_centre}, {b_scale})'),
class = 'b')))
}
# fit the models from scratch and save them to disk:
for (study_name in c('PPMI', 'NZBRI')) {
med_diagnosis_age = dat %>% # needed for setting the prior
filter(study == study_name) %>%
summarise(diagnosis_age = median(diagnosis_age)) %>%
pull() # extract as a scalar value
# model for assessing sex group differences in mean onset age:
model = brm(data = dat %>% filter(study == study_name),
diagnosis_age ~ sex, save_all_pars = TRUE,
iter = N_ITERATIONS, sample_prior = TRUE,
prior = nchildren_effect_prior(round(med_diagnosis_age),
nchildren_onset_age_effect_prior_mean))
saveRDS(model, glue('models/brm_{study_name}_dxage_sex.rds'))
# models for looking at relationship with n_children within each sex:
for (sex_level in c('Men', 'Women')) {
med_diagnosis_age = dat %>% # needed for setting the prior
filter(study == study_name, sex == sex_level) %>%
summarise(diagnosis_age = median(diagnosis_age)) %>%
pull() # extract as a scalar value
#### The diagnosis-age associations ###
# first need an intercept-only model for each sex:
model = brm(data = dat %>% filter(study == study_name,
sex == sex_level),
diagnosis_age ~ 1, save_all_pars = TRUE,
iter = N_ITERATIONS, sample_prior = TRUE,
prior = intercept_only_prior(round(med_diagnosis_age)))
saveRDS(model, glue('models/brm_{study_name}_dxage_{sex_level}_int.rds'))
# then compare that to a model as a function of n_children:
model = brm(data = dat %>% filter(study == study_name,
sex == sex_level),
diagnosis_age ~ n_children, save_all_pars = TRUE,
iter = N_ITERATIONS, sample_prior = TRUE,
prior = nchildren_effect_prior(round(med_diagnosis_age),
nchildren_onset_age_effect_prior_mean))
saveRDS(model, glue('models/brm_{study_name}_dxage_{sex_level}_n.rds'))
med_birth_year = dat %>% # needed for setting the prior
filter(study == study_name, sex == sex_level) %>%
summarise(birth_year = median(birth_year)) %>%
pull() # extract as a scalar value
#### The birth-year cohort effects ###
# first need an intercept-only model for each sex:
model = brm(data = dat %>% filter(study == study_name,
sex == sex_level),
birth_year ~ 1, save_all_pars = TRUE,
iter = N_ITERATIONS, sample_prior = TRUE,
prior = intercept_only_prior(round(med_birth_year)))
saveRDS(model,
glue('models/brm_{study_name}_birthyear_{sex_level}_int.rds'))
# then compare that to a model as a function of n_children:
model = brm(data = dat %>% filter(study == study_name,
sex == sex_level),
birth_year ~ n_children, save_all_pars = TRUE,
iter = N_ITERATIONS, sample_prior = TRUE,
prior = nchildren_effect_prior(round(med_birth_year),
nchildren_birth_year_effect_prior_mean))
saveRDS(model,
glue('models/brm_{study_name}_birthyear_{sex_level}_n.rds'))
}
}
}
# regardless, now read in the previously-fitted models from disk.
# construct the name of the model (e.g. 'brm_PPMI_dxage_int'):
for (study_name in c('PPMI', 'NZBRI')) {
# first the dxage models:
for (model_vars in c('sex', 'Men_int', 'Women_int', 'Men_n', 'Women_n')) {
model_name = glue('brm_{study_name}_dxage_{model_vars}')
# read its saved representation from disk:
model = readRDS(glue('models/{model_name}.rds'))
# assign to a variable with the associated name:
assign(model_name, model)
# for Women_n and Men_n models, predict values to get lines and intervals
# for depicting the models graphically, supplementing the raw data:
if (str_ends(model_name, '_n')) {
sex = str_sub(model_vars, start = 1, end = -3)
prediction_name = glue('ggpredict_{study_name}_dxage_{model_vars}')
prediction = ggpredict(model, terms = ~ n_children) %>%
rename(n_children = x, diagnosis_age = predicted) %>%
mutate(sex = sex, study = study_name)
assign(prediction_name, prediction)
}
}
# then the birthyear ones
for (model_vars in c('Men_int', 'Women_int', 'Men_n', 'Women_n')) {
model_name = glue('brm_{study_name}_birthyear_{model_vars}')
# read its saved representation from disk:
model = readRDS(glue('models/{model_name}.rds'))
# assign to a variable with the associated name:
assign(model_name, model)
# predict to get confidence intervals for graphing the fixed effects:
if (str_ends(model_name, '_n')) {
sex = str_sub(model_vars, start = 1, end = -3)
prediction_name = glue('ggpredict_{study_name}_birthyear_{model_vars}')
prediction = ggpredict(model, terms = ~ n_children) %>%
rename(n_children = x, birth_year = predicted) %>%
mutate(sex = sex, study = study_name)
assign(prediction_name, prediction)
}
}
}
# make dataframes that can be used for plotting the predicted values:
dxage_predictions = bind_rows(ggpredict_NZBRI_dxage_Men_n,
ggpredict_NZBRI_dxage_Women_n,
ggpredict_PPMI_dxage_Men_n,
ggpredict_PPMI_dxage_Women_n) %>%
mutate(study = factor(study, levels = c('PPMI', 'NZBRI')))
birthyear_predictions = bind_rows(ggpredict_NZBRI_birthyear_Men_n,
ggpredict_NZBRI_birthyear_Women_n,
ggpredict_PPMI_birthyear_Men_n,
ggpredict_PPMI_birthyear_Women_n) %>%
mutate(study = factor(study, levels = c('PPMI', 'NZBRI')))
# tidy up orphaned references:
remove(model)
remove(prediction)
remove(list = ls(pattern = 'ggpredict_'))
```
```{r extract-coefficients}
# the diagnosis age model coefficients:
PPMI_sex_coefs = fixef(brm_PPMI_dxage_sex)
PPMI_Men_n_coefs = fixef(brm_PPMI_dxage_Men_n)
PPMI_Women_n_coefs = fixef(brm_PPMI_dxage_Women_n)
NZBRI_sex_coefs = fixef(brm_NZBRI_dxage_sex)
NZBRI_Men_n_coefs = fixef(brm_NZBRI_dxage_Men_n)
NZBRI_Women_n_coefs = fixef(brm_NZBRI_dxage_Women_n)
# the relevant birth year effect model coefficients:
PPMI_Men_n_coefs_birth = fixef(brm_PPMI_birthyear_Men_n)
PPMI_Women_n_coefs_birth = fixef(brm_PPMI_birthyear_Women_n)
NZBRI_Men_n_coefs_birth = fixef(brm_NZBRI_birthyear_Men_n)
NZBRI_Women_n_coefs_birth = fixef(brm_NZBRI_birthyear_Women_n)
```
```{r show_priors_example, eval=FALSE, include=FALSE}
# To get the prior distributions. The default is a weakly informative prior,
# i.e., a Student's t with 3 degrees of freedom, scale of 10, and mean of
# variable mean.
prior_summary(brm_PPMI_birthyear_Men_n)
# If the sample_prior is set to TRUE at the time of model fitting, we can gather
# prior samples and visualise the prior distributions by:
bayesplot::mcmc_dens(prior_samples(brm_PPMI_birthyear_Men_n))
# To get full details of the model code and how priors are implemented:
stancode(brm_PPMI_birthyear_Men_n)
```
```{r p-women-later-onset}
# what is the probability that women actually have a later age of onset than men?
# can answer this by testing the specific hypothesis that their onset age difference is actually
# greater than zero:
p_ppmi_women_later_onset =
brms::hypothesis(brm_PPMI_dxage_sex, 'sexWomen > 0')$hypothesis$Post.Prob
p_nzbri_women_later_onset =
brms::hypothesis(brm_NZBRI_dxage_sex, 'sexWomen > 0')$hypothesis$Post.Prob
# a more verbose way of saying the same thing:
#p_ppmi_women_later_onset = brms::hypothesis(brm_PPMI_sex, "Intercept + sexWomen > Intercept")$hypothesis$Post.Prob
# we could also do this manually, by looking at the proportion of posterior samples where the coefficient
# was > 0:
# p_ppmi_women_later_onset = posterior_samples(brm_PPMI_sex) %>%
# mutate(above = b_sexWomen > 0) %>%
# summarise(prop = sum(above)/n())
```
```{r bayes-factors, include=FALSE}
# compare the diagnosis age slopes to the null model of no association:
BF_PPMI_Men = bayes_factor(brm_PPMI_dxage_Men_n, brm_PPMI_dxage_Men_int)
BF_PPMI_Women = bayes_factor(brm_PPMI_dxage_Women_n, brm_PPMI_dxage_Women_int)
BF_NZBRI_Men = bayes_factor(brm_NZBRI_dxage_Men_n, brm_NZBRI_dxage_Men_int)
BF_NZBRI_Women = bayes_factor(brm_NZBRI_dxage_Women_n, brm_NZBRI_dxage_Women_int)
# do the same for the cohort birth year effects:
BF_PPMI_Men_birth = bayes_factor(brm_PPMI_birthyear_Men_n, brm_PPMI_birthyear_Men_int)
BF_PPMI_Women_birth = bayes_factor(brm_PPMI_birthyear_Women_n, brm_PPMI_birthyear_Women_int)
BF_NZBRI_Men_birth = bayes_factor(brm_NZBRI_birthyear_Men_n, brm_NZBRI_birthyear_Men_int)
BF_NZBRI_Women_birth = bayes_factor(brm_NZBRI_birthyear_Women_n, brm_NZBRI_birthyear_Women_int)
# construct dataframes that can be used to overlay these BF values upon facets
# of their respective graphs:
BFs_dxage = tibble(study = rep(c('PPMI', 'NZBRI'), each = 2),
sex = rep(c('Men', 'Women'), times = 2),
BF = c(BF_PPMI_Men$bf, BF_PPMI_Women$bf,
BF_NZBRI_Men$bf, BF_NZBRI_Women$bf),
x = 7, y = 35) %>%
mutate(study = factor(study, levels = c('PPMI', 'NZBRI')))
BFs_birthyear = tibble(study = rep(c('PPMI', 'NZBRI'), each = 2),
sex = rep(c('Men', 'Women'), times = 2),
BF = c(BF_PPMI_Men_birth$bf, BF_PPMI_Women_birth$bf,
BF_NZBRI_Men_birth$bf, BF_NZBRI_Women_birth$bf),
x = 7, y = 1977) %>%
mutate(study = factor(study, levels = c('PPMI', 'NZBRI')))
```
# Introduction
The incidence of Parkinson’s is substantially lower in women [@taylor2007_HeterogeneityMaleFemale; @myall2017_ParkinsonOldestOld] (at least outside of China and Japan). [@taylor2007_HeterogeneityMaleFemale; @morozova2008_VariationsGenderRatios] The reason is unknown but could include greater male exposure to risk factors (e.g. head injury or occupational use of toxins), [@savica2013_RiskFactorsParkinson] or protective factors applying differentially to women (e.g. greater exposure to hormones like œstrogens and progestogens).
Plausible mechanisms have been proposed for how female sex hormones could play a neuroprotective role in neurodegenerative conditions[@roof2000_GenderDifferencesAcute] and hence observational studies have tested associations between increased hormone exposure and protection against Parkinson's. Lifetime hormonal exposure has been operationalised using endogenous measures such as fertile life span (the duration between age at menarche and at menopause), or exogenous exposure through oral contraceptives or hormone replacement therapy. Despite some positive findings, [@villa2016_EstrogensNeuroinflammationNeurodegeneration] most reviews [@ascherio2016_EpidemiologyParkinsonDisease], large prospective [@simon2009_ReproductiveFactorsExogenous] or case-control [@popat2005_EffectReproductiveFactors] studies, and meta-analyses [@lv2017_ReproductiveFactorsRisk;@du2014_HormoneReplacementTherapy] have shown little support for relationships between any such measures and a lowered risk of Parkinson’s.
Eight studies have examined the effect of parity (number of childbirths) upon the risk of women subsequently developing Parkinson’s. [@lv2017_ReproductiveFactorsRisk] Meta-analysis showed no effect, with the relative risk of Parkinson's between the highest and lowest number of births being 0.99 (95% CI: 0.79–1.25).[@lv2017_ReproductiveFactorsRisk] Three studies have, however, independently reported another childbirth-related association not specifically addressed in that meta-analysis: among women diagnosed with Parkinson’s, they found that a history of childbirth was associated with later age of onset. [@haaxma2007_GenderDifferencesParkinson; @yadav2012_CaseControlStudy; @frentzel2017_IncreaseReproductiveLife] That is, although having children might not reduce the risk of Parkinson’s _per se,_ it might still slow the pathological process. The associations were surprisingly large and consistent, with symptom onset reported as being later by 2.7 years (95% CI: 0.8 – 4.6, Netherlands, n = 97)[@haaxma2007_GenderDifferencesParkinson] or 2.6 years per childbirth (95% CI: 0.05 – 5.1, Germany, n = 79)[@frentzel2017_IncreaseReproductiveLife], or to have a correlation coefficient of 0.35 between parity and onset age (India, n = 81, p = 0.001).[@yadav2012_CaseControlStudy]
A challenge in such observational studies is applying valid control comparisons. Women without Parkinson's lack the disease outcome measures (such as age of onset), while men with Parkinson's lack the predictor hormonal measures. For this specific association, however, defining the predictor as "number of biological children" rather than "number of childbirths" allows men with Parkinson’s to be a suitable control for non-biological explanations. We propose that if the relationship between number of children and onset age is absent in men, it would strengthen claims for a protective female sex hormone effect. Conversely, if that relationship _does_ hold for men, it would strongly support the cause being non-biological.
\newpage
# Methods
## Data sets
*PPMI:* The openly-available Parkinson’s Progressive Marker Initiative [@marek2018_ParkinsonProgressionMarkersa] is a dataset of incident cases, with a mean 7 months between diagnosis and recruitment (see Table \@ref(tab:demog-table) and Acknowledgments). Valid data on number of children was available from 421 of PPMI's 423 idiopathic Parkinson's cases.
*NZBRI:* At the New Zealand Brain Research Institute, we combined two previously-conducted risk-factor surveys, in which 604 people with idiopathic Parkinson's provided valid responses on age at diagnosis and number of biological children (Table \@ref(tab:demog-table)). Cases ranged from recently-diagnosed to those with long-standing disease. Responses were mostly collected online, with some submitting via paper or telephone. Respondents with dementia had assistance to complete the questions. One survey (`r nrow(dat_canty)` valid cases) recruited from our ongoing longitudinal study of a convenience sample of prevalent cases in the local Canterbury region. The other (`r nrow(dat_national)` valid cases) was nation-wide, recruiting from the membership (excluding Canterbury) of the Parkinson's New Zealand charitable trust. Age at diagnosis was self-reported in the national survey and confirmed from clinical records in the Canterbury survey. Canterbury respondents had diagnosis confirmed by a neurologist. The remainder required a diagnosis in order to receive care from Parkinson's New Zealand, which might have been made by a neurologist, other specialist, or general practitioner.
## Analyses
Onset age was defined as when Parkinson's was diagnosed, because symptom onset age was not collected in the NZBRI nation-wide survey. Data were fit with simple Bayesian linear models, using the R[@rdevelopmentcoreteam2019_LanguageEnvironmentStatistical] package _brms_. [@burkner2017_BrmsPackageBayesian] Weakly-informative Student _t_ priors were used for the intercept (df = 3, mean = data mean, scale = 10) and standard deviation of the residuals (df = 3, mean = 0, scale = 10) with rejection sampling used to ensure the standard deviation was non-negative. The scale values were chosen so the prior distributions had moderate probability mass fully covering the range of plausible parameter values. Based upon the three previous studies, [@frentzel2017_IncreaseReproductiveLife; @haaxma2007_GenderDifferencesParkinson; @yadav2012_CaseControlStudy] we used a proper informative normal prior (mean = ±2.5, SD = 2) for the effect of the number of children (being positive for the dependent variable of age, and negative for year of birth). We ran four chains of 20 000 iterations each.
When testing hypotheses of associations between the number of children and age of onset (or year of birth), in each case we compared a model containing the number of children as a predictor to an intercept-only model (i.e. a model of no association). Bayes factors give the ratio of the likelihood of the data given a model including the number of children, to the likelihood of the data given an intercept-only ("flat-line") model.
## Reproducibility
The code and the anonymised dataset extracts used to conduct the analyses and generate this manuscript are available at https://github.com/nzbri/pd-parity.
```{r demog-table}
table_1 = dat %>%
group_by(study, sex) %>%
summarise(n = n(),
age =
paste0(round(mean(age, na.rm = TRUE), digits = 1), ' (',
round(sd(age, na.rm = TRUE), digits = 1), ')'),
diagnosis_age =
paste0(round(mean(diagnosis_age, na.rm = TRUE), digits = 1), ' (',
round(sd(diagnosis_age, na.rm = TRUE), digits = 1), ')'),
duration =
paste0(round(mean(duration_dx, na.rm = TRUE), digits = 1), ' (',
round(sd(duration_dx, na.rm = TRUE), digits = 1), ')'))
table_1 %>%
kable(col.names = c('Study', 'Sex', 'n', 'Mean age',
'Mean age at diagnosis',
'Mean years disease duration'),
caption = 'Demographic characteristics of the PPMI and NZBRI samples.',
booktabs = TRUE) %>% # remove vertical gridlines
column_spec(5:6, width = '2.5cm') %>% # wrap long column headers
row_spec(0, bold = TRUE) %>% # bold header titles
kable_styling(full_width = FALSE, position = 'center') %>%
collapse_rows(columns = 1, valign = 'middle') # PPMI and NZBRI labels span 2 rows
# extract some values for using in the text:
PPMI_mean_women_sx_duration = dat %>%
filter(study == 'PPMI', sex == 'Women') %>%
summarise(sx = mean(duration_sx, na.rm = TRUE)) %>%
pull() # make a single value
NZBRI_mean_women_dx_duration = dat %>%
filter(study == 'NZBRI', sex == 'Women') %>%
summarise(sx = mean(duration_dx, na.rm = TRUE)) %>%
pull()
```
```{r histograms, eval=FALSE, include=FALSE}
dat %>%
ggplot(aes(x = diagnosis_age, fill = sex)) +
facet_grid(sex ~ study) +
geom_histogram(binwidth = 2) +
scale_fill_manual(values = two_colours) +
guides(fill = FALSE) +
ylab('Frequency\n') +
xlab('\nAge at diagnosis') +
theme(axis.ticks = element_line(colour = 'lightgrey'),
panel.grid.minor.x = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank())
```
\newpage
# Results
## PPMI sample
We first attempted to replicate the association between number of children and later disease onset in the PPMI women. The linearly-modelled delay in diagnosis was `r ndigits(PPMI_Women_n_coefs['n_children','Estimate'])` years per child (credible interval [`r ndigits(PPMI_Women_n_coefs['n_children','Q2.5'], 2)`, `r ndigits(PPMI_Women_n_coefs['n_children','Q97.5'])`]), being the slope of the line in the upper-right panel of Figure \@ref(fig:main-figure)B. However, a Bayes factor (BF) of `r ndigits(BF_PPMI_Women$bf)` indicated very weak evidence for an association compared to the intercept-only model. Stronger results were found for the PPMI men, with a slope of `r ndigits(PPMI_Men_n_coefs['n_children','Estimate'])` years per child [`r ndigits(PPMI_Men_n_coefs['n_children','Q2.5'])`, `r ndigits(PPMI_Men_n_coefs['n_children','Q97.5'])`], BF = `r ndigits(BF_PPMI_Men$bf)`. That the relationship occurred in men argues against the underlying cause being pregnancy- or birth-related.
For completeness, we also examined whether women did actually have a later age of disease onset. As indicated in Table \@ref(tab:demog-table), the mean age at diagnosis was similar between the sexes, occurring earlier for women by just `r ndigits(PPMI_sex_coefs['sexWomen','Estimate'])` [`r ndigits(PPMI_sex_coefs['sexWomen','Q2.5'])`, `r ndigits(PPMI_sex_coefs['sexWomen','Q97.5'])`] years.
## NZBRI sample
In the NZBRI sample, the slope for women was only `r ndigits(NZBRI_Women_n_coefs['n_children','Estimate'])` years per child [`r ndigits(NZBRI_Women_n_coefs['n_children','Q2.5'])`, `r ndigits(NZBRI_Women_n_coefs['n_children','Q97.5'])`], with a Bayes factor of `r ndigits(BF_NZBRI_Women$bf)` indicating strong evidence against an association. The results were similar for men, with a slope of `r ndigits(NZBRI_Men_n_coefs['n_children','Estimate'])` years per child [`r ndigits(NZBRI_Men_n_coefs['n_children','Q2.5'])`, `r ndigits(NZBRI_Men_n_coefs['n_children','Q97.5'])`], BF = `r ndigits(BF_NZBRI_Men$bf)`.
The NZBRI mean age at diagnosis was again similar between the sexes, occurring earlier for women by just `r ndigits(NZBRI_sex_coefs['sexWomen','Estimate'])` years [`r ndigits(NZBRI_sex_coefs['sexWomen','Q2.5'])`, `r ndigits(NZBRI_sex_coefs['sexWomen','Q97.5'])`].
## Testing a non-biological alternative explanation
In many countries, due to late twentieth-century societal changes, older people on average had larger families than people born more recently. Figure \@ref(fig:main-figure)A shows such effects for the men and women in both studies. We then modelled how many years earlier we would expect a patient to have been born, given how many children they had. The coefficients are negative, as, for consistency across studies with recruitment at different times, we modeled year of birth rather than age. _PPMI study._ Women: `r ndigits(PPMI_Women_n_coefs_birth['n_children','Estimate'])` years per child, credible interval [`r ndigits(PPMI_Women_n_coefs_birth['n_children','Q2.5'], 2)`, `r ndigits(PPMI_Women_n_coefs_birth['n_children','Q97.5'])`], BF = `r ndigits(BF_PPMI_Women_birth$bf)`. Men: `r ndigits(PPMI_Men_n_coefs_birth['n_children','Estimate'])` years per child [`r ndigits(PPMI_Men_n_coefs_birth['n_children','Q2.5'], 2)`, `r ndigits(PPMI_Men_n_coefs_birth['n_children','Q97.5'])`], BF = `r ndigits(BF_PPMI_Men_birth$bf)`. _NZBRI study._ Women: `r ndigits(NZBRI_Women_n_coefs_birth['n_children','Estimate'])` years per child, [`r ndigits(NZBRI_Women_n_coefs_birth['n_children','Q2.5'], 2)`, `r ndigits(NZBRI_Women_n_coefs_birth['n_children','Q97.5'])`], BF = `r ndigits(BF_NZBRI_Women_birth$bf)` (although the association was not present in this sample, we know that the population fertility for New Zealand women did indeed decline markedly in the late twentieth century.[@pool2011_FamiliesHistoryColonial]) Men: `r ndigits(NZBRI_Men_n_coefs_birth['n_children','Estimate'])` years per child [`r ndigits(NZBRI_Men_n_coefs_birth['n_children','Q2.5'], 2)`, `r ndigits(NZBRI_Men_n_coefs_birth['n_children','Q97.5'])`], BF = `r ndigits(BF_NZBRI_Men_birth$bf)`.
```{r diagnosis-age-graph, fig.height=4, fig.width=4, message=FALSE, warning=FALSE}
# main result: age at diagnosis as a function of number of
# children, in each sex and for both sites:
diagnosis_panel = dat %>%
ggplot() +
facet_grid(study ~ sex) +
geom_ribbon(data = dxage_predictions,
aes(x = n_children,
ymin = conf.low, ymax = conf.high, fill = study),
colour = NA, alpha = 0.35) +
geom_line(data = dxage_predictions,
aes(x = n_children,
y = diagnosis_age),
size = 0.25, linetype = 'solid') + # actual model fit
geom_point(aes(x = n_children,
y = round(diagnosis_age, digits = 0), colour = study),
alpha = I(0.65), size = 0.6,
position = position_jitter(width = 0.1, seed = 90210),
shape = 16) +
geom_text(data = BFs_dxage, aes(x = x, y = y,
label = paste('BF[10] ==', round(BF, digits = 1))),
family = 'Gill Sans', size = 7 * (5/14),
parse = TRUE) + # parse the subscript notation
scale_x_continuous(breaks = seq(from = 0, to = 9, by = 1)) +
scale_y_continuous(breaks = seq(from = 30, to = 80, by = 10),
expand = c(0, 0), limits = c(30, 90)) +
scale_fill_manual(values = two_colours) +
scale_colour_manual(values = two_colours) +
guides(colour = FALSE, fill = FALSE) +
xlab('Number of children') +
ylab('Age at diagnosis') +
theme_bw(base_family = 'Gill Sans') +
theme(aspect.ratio = 1.25,
axis.text = element_text(size = 7, colour = 'black'),
axis.title = element_text(size = 10),
axis.title.x = element_text(margin = margin(t = 10, r = 0, b = 0, l = 0)),
axis.title.y = element_text(margin = margin(t = 0, r = 0, b = 0, l = 0)),
axis.ticks = element_line(colour = '#9A1D2B', size = 0.25),
panel.border = element_rect(colour = '#9A1D2B', size = 0.5),
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
strip.background = element_rect(colour = '#9A1D2B', fill = '#9A1D2B'),
strip.text = element_text(colour = 'white', size = 10),
plot.margin = unit(c(0.1, 0.1, 0.1, 0.25), 'cm'))
ggsave(plot = diagnosis_panel, 'figures/Age at diagnosis by n children.pdf',
device = cairo_pdf, width = 4, height = 4)
```
```{r birth-year-graph, fig.height=4, fig.width=4}
# plot the generational effect: number of children as a function
# of patient year of birth:
birthyear_panel = dat %>%
ggplot() +
facet_grid(study ~ sex) +
geom_ribbon(data = birthyear_predictions,
aes(x = n_children,
ymin = conf.low, ymax = conf.high, fill = study),
colour = NA, alpha = 0.35) +
geom_line(data = birthyear_predictions,
aes(x = n_children,
y = birth_year),
size = 0.25, linetype = 'solid') + # actual model fit
geom_point(aes(x = n_children,
y = birth_year, colour = study), alpha = I(0.65), size = 0.6,
position = position_jitter(width = 0.1, seed = 90210),
shape = 16) +
geom_text(data = BFs_birthyear, aes(x = x, y = y,
label = paste('BF[10] ==', round(BF, digits = 1))),
family = 'Gill Sans', size = 7 * (5/14),
parse = TRUE) + # parse the subscript notation
coord_cartesian(clip = 'off') +
scale_x_continuous(breaks = seq(from = 0, to = 9, by = 1)) +
scale_y_reverse(breaks = c(1930, 1940, 1950, 1960, 1970, 1980),
labels = c('1930', '', '1950', '', '1970', '')) +
scale_fill_manual(values = two_colours) +