-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3_fertility_robustness_correction.html
9876 lines (9411 loc) · 510 KB
/
3_fertility_robustness_correction.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<title>Robustness checks</title>
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<script src="library/auto_tab_first_section.js"></script>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
pre:not([class]) {
background-color: white;
}
</style>
<script type="text/javascript">
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() { hljs.initHighlighting(); }, 0);
}
}
</script>
<style type="text/css">
h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}
</style>
</head>
<body>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
height: auto;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
</style>
<style type="text/css">
/* padding for bootstrap navbar */
body {
padding-top: 51px;
padding-bottom: 40px;
}
/* offset scroll position for anchor links (for fixed navbar) */
.section h1 {
padding-top: 56px;
margin-top: -56px;
}
.section h2 {
padding-top: 56px;
margin-top: -56px;
}
.section h3 {
padding-top: 56px;
margin-top: -56px;
}
.section h4 {
padding-top: 56px;
margin-top: -56px;
}
.section h5 {
padding-top: 56px;
margin-top: -56px;
}
.section h6 {
padding-top: 56px;
margin-top: -56px;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #cccccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #ffffff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
border-radius: 6px 0 6px 6px;
}
</style>
<script>
// manage active state of menu based on current page
$(document).ready(function () {
// active menu anchor
href = window.location.pathname
href = href.substr(href.lastIndexOf('/') + 1)
if (href === "")
href = "index.html";
var menuAnchor = $('a[href="' + href + '"]');
// mark it active
menuAnchor.parent().addClass('active');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
});
</script>
<div class="container-fluid main-container">
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
background: white;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open')
});
});
</script>
<!-- code folding -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Fertility diary</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="1_power_analysis.html">Power analysis</a>
</li>
<li>
<a href="1_researcher_df_analysis.html">Researcher degree of freedom simulation</a>
</li>
<li>
<a href="1_wrangle_data.html">Data wrangling</a>
</li>
<li>
<a href="2_descriptives.html">Descriptives</a>
</li>
<li>
<a href="3_fertility_as_prereg.html">Preregistered analyses</a>
</li>
<li>
<a href="3_fertility_robustness.html">Robustness tests</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div class="fluid-row" id="header">
</div>
<div id="robustness-checks-of-ovulatory-changes" class="section level1 tab-content">
<h1>Robustness checks <small>of ovulatory changes</small></h1>
<p><span style="background:red;width:20px;height:20px;display:inline-block;"></span> Cycling women (not on hormonal birth control)</p>
<p><span style="background:black;width:20px;height:20px;display:inline-block;"></span> Women on hormonal birth control</p>
<div id="load-data" class="section level2">
<h2>Load data</h2>
<pre class="r"><code># cd /usr/users/rarslan/relationship_dynamics/ && bsub -q mpi -W 48:00 -n 20 -R span[hosts=1] R -e "filebase = '3_fertility_robustness'; x = rmarkdown::render(paste0('3_fertility_robustness','.Rmd'), run_pandoc = FALSE, clean = FALSE); save(x, file = 'rob.rda'); cat(readLines(paste0(filebase,'.utf8.md')), sep = '\n')"
library(knitr)
opts_chunk$set(fig.width = 8, fig.height = 8, cache = T, warning = T, message = F, cache = F)</code></pre>
<pre class="r"><code>source("0_helpers.R")
load("full_data.rdata")
diary = diary %>%
mutate(
included = included_all,
fertile = if_else(is.na(prc_stirn_b_squished), prc_stirn_b_backward_inferred, prc_stirn_b_squished),
contraceptive_methods = factor(contraceptive_method, levels =
c("barrier_or_abstinence", "fertility_awareness", "none", "hormonal")),
relationship_status_clean = factor(relationship_status_clean),
cohabitation = factor(cohabitation),
certainty_menstruation = as.numeric(as.character(certainty_menstruation)),
partner_st_vs_lt = partner_attractiveness_shortterm - partner_attractiveness_longterm
) %>% group_by(person) %>%
mutate(
fertile_mean = mean(fertile, na.rm = T)
)
opts_chunk$set(warning = F)
library(Cairo)
opts_chunk$set(dev = "CairoPNG")
diary$age_group = cut(diary$age,c(18,20,25,30,35,70), include.lowest = T)</code></pre>
<pre class="r"><code>models = list()
do_model = function(model, diary) {
outcome = names(model@frame)[1]
outcome_label = recode(str_replace_all(str_replace_all(str_replace_all(outcome, "_", " "), " pair", "-pair"), " 1", ""),
"desirability" = "self-perceived desirability",
"NARQ admiration" = "narcissistic admiration",
"NARQ rivalry" = "narcissistic rivalry",
"extra-pair" = "extra-pair desire & behaviour",
"had sexual intercourse" = "sexual intercourse")
model = calculate_effects(model)
options = list(fig.path = paste0(knitr::opts_chunk$get("fig.path"), outcome, "-"),
cache.path = paste0(knitr::opts_chunk$get("cache.path"), outcome, "-"))
asis_knit_child("_robustness_model.Rmd", options = options)
}
do_moderators = function(model, diary) {
asis_knit_child("_moderators.Rmd")
}</code></pre>
<pre class="r"><code>models$extra_pair = lmer(extra_pair ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$desirability_1 = lmer(desirability_1 ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$extra_pair_intimacy = glmer(extra_pair_intimacy ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$extra_pair_sex = glmer(extra_pair_sex ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$in_pair_desire = lmer(in_pair_desire ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$had_petting = glmer(had_petting ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$had_sexual_intercourse = glmer(had_sexual_intercourse ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$partner_initiated_sexual_intercourse = glmer(partner_initiated_sexual_intercourse ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$sexual_intercourse_satisfaction = lmer(sexual_intercourse_satisfaction ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$spent_night_with_partner = glmer(spent_night_with_partner ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$partner_mate_retention = lmer(partner_mate_retention ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$female_mate_retention = lmer(female_mate_retention ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$sexy_clothes = lmer(sexy_clothes ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$showy_clothes = lmer(showy_clothes ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$male_attention_1 = lmer(male_attention_1 ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$in_pair_public_intimacy = glmer(in_pair_public_intimacy ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary, family = binomial(link = "probit"))
models$NARQ_admiration = lmer(NARQ_admiration ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$NARQ_rivalry = lmer(NARQ_rivalry ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$self_esteem_1 = lmer(self_esteem_1 ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$female_jealousy = lmer(female_jealousy ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$relationship_satisfaction_1 = lmer(relationship_satisfaction_1 ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)
models$communication_partner_1 = lmer(communication_partner_1 ~ included * (menstruation + fertile) + fertile_mean + ( 1 | person), data = diary)</code></pre>
<pre class="r"><code># model_summaries = parallel::mclapply(models, FUN = do_model, diary = diary, mc.cores = 20)</code></pre>
</div>
<div id="outcomes" class="section level2 tab-content">
<h2>Outcomes</h2>
<div id="moderators" class="section level3 tab-content">
<h3>Extra-pair Moderators</h3>
<pre class="r"><code>do_moderators(models$extra_pair, diary)</code></pre>
<div id="partners-physical-attractiveness" class="section level4">
<h4>Partner’s physical attractiveness</h4>
<p>Predicted fertile phase effect sizes (in red): biggest (EP desire, partner mate retention)/smallest (IP desire) when partner’s physical attractiveness is low.</p>
<pre class="r"><code>model %>%
test_moderator_correction("partner_attractiveness_physical", diary)</code></pre>
<table>
<caption>Data: diary</caption>
<colgroup>
<col width="22%" />
<col width="5%" />
<col width="8%" />
<col width="8%" />
<col width="9%" />
<col width="11%" />
<col width="8%" />
<col width="9%" />
<col width="14%" />
</colgroup>
<thead>
<tr class="header">
<th align="center"> </th>
<th align="center">Df</th>
<th align="center">AIC</th>
<th align="center">BIC</th>
<th align="center">logLik</th>
<th align="center">deviance</th>
<th align="center">Chisq</th>
<th align="center">Chi Df</th>
<th align="center">Pr(>Chisq)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center"><strong>with_main</strong></td>
<td align="center">13</td>
<td align="center">48494</td>
<td align="center">48601</td>
<td align="center">-24234</td>
<td align="center">48468</td>
<td align="center">NA</td>
<td align="center">NA</td>
<td align="center">NA</td>
</tr>
<tr class="even">
<td align="center"><strong>with_mod</strong></td>
<td align="center">15</td>
<td align="center">48494</td>
<td align="center">48617</td>
<td align="center">-24232</td>
<td align="center">48464</td>
<td align="center">4.093</td>
<td align="center">2</td>
<td align="center">0.1292</td>
</tr>
<tr class="odd">
<td align="center"><strong>with_mod_ranef</strong></td>
<td align="center">24</td>
<td align="center">48175</td>
<td align="center">48372</td>
<td align="center">-24063</td>
<td align="center">48127</td>
<td align="center">337.3</td>
<td align="center">9</td>
<td align="center">3.196e-67</td>
</tr>
</tbody>
</table>
<p><img src="3_fertility_robustness_correction_files/figure-html/phys_attr-1.png" width="768" /></p>
<pre><code>Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: extra_pair ~ menstruation + fertile_mean + (1 | person) + partner_attractiveness_physical +
included + fertile + menstruation:included + partner_attractiveness_physical:included +
partner_attractiveness_physical:fertile + included:fertile +
partner_attractiveness_physical:included:fertile
Data: diary
REML criterion at convergence: 48539
Scaled residuals:
Min 1Q Median 3Q Max
-4.283 -0.556 -0.148 0.406 8.003
Random effects:
Groups Name Variance Std.Dev.
person (Intercept) 0.303 0.550
Residual 0.320 0.566
Number of obs: 26680, groups: person, 1054
Fixed effects:
Estimate Std. Error df t value
(Intercept) 2.4697 0.1448 1147.8935 17.06
menstruationpre -0.0903 0.0173 25904.1276 -5.22
menstruationyes -0.0714 0.0163 25998.3334 -4.38
fertile_mean -0.0379 0.2117 1429.5329 -0.18
partner_attractiveness_physical -0.0807 0.0174 1127.8651 -4.65
includedhorm_contra -0.4750 0.1897 1118.1561 -2.50
fertile 0.4299 0.1524 26033.6683 2.82
menstruationpre:includedhorm_contra 0.0691 0.0222 25900.7970 3.11
menstruationyes:includedhorm_contra 0.0861 0.0214 25979.3941 4.03
partner_attractiveness_physical:includedhorm_contra 0.0462 0.0231 1109.2598 2.00
partner_attractiveness_physical:fertile -0.0323 0.0187 26042.9684 -1.73
includedhorm_contra:fertile -0.2947 0.2016 25994.1459 -1.46
partner_attractiveness_physical:includedhorm_contra:fertile 0.0158 0.0244 25992.9511 0.65
Pr(>|t|)
(Intercept) < 2e-16 ***
menstruationpre 0.00000018 ***
menstruationyes 0.00001208 ***
fertile_mean 0.8578
partner_attractiveness_physical 0.00000378 ***
includedhorm_contra 0.0124 *
fertile 0.0048 **
menstruationpre:includedhorm_contra 0.0019 **
menstruationyes:includedhorm_contra 0.00005663 ***
partner_attractiveness_physical:includedhorm_contra 0.0460 *
partner_attractiveness_physical:fertile 0.0842 .
includedhorm_contra:fertile 0.1438
partner_attractiveness_physical:includedhorm_contra:fertile 0.5182
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
</code></pre>
<pre><code>Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: extra_pair ~ menstruation + fertile_mean + partner_attractiveness_physical +
included + fertile + (1 + menstruation + fertile | person) +
menstruation:included + partner_attractiveness_physical:included +
partner_attractiveness_physical:fertile + included:fertile +
partner_attractiveness_physical:included:fertile
Data: diary
REML criterion at convergence: 48198
Scaled residuals:
Min 1Q Median 3Q Max
-4.745 -0.550 -0.138 0.391 7.911
Random effects:
Groups Name Variance Std.Dev. Corr
person (Intercept) 0.3241 0.569
menstruationpre 0.0441 0.210 -0.28
menstruationyes 0.0671 0.259 -0.26 0.77
fertile 0.2899 0.538 -0.19 0.43 0.57
Residual 0.3028 0.550
Number of obs: 26680, groups: person, 1054
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.4874 0.1449 1095.8371 17.17 < 2e-16
menstruationpre -0.0985 0.0208 763.9108 -4.74 0.0000025
menstruationyes -0.0764 0.0216 756.4077 -3.53 0.00044
fertile_mean -0.0792 0.2151 1451.8157 -0.37 0.71281
partner_attractiveness_physical -0.0815 0.0174 1057.3351 -4.69 0.0000030
includedhorm_contra -0.4837 0.1897 1054.8461 -2.55 0.01090
fertile 0.3594 0.2002 865.0281 1.79 0.07307
menstruationpre:includedhorm_contra 0.0782 0.0267 760.5212 2.93 0.00347
menstruationyes:includedhorm_contra 0.0935 0.0281 780.6452 3.33 0.00093
partner_attractiveness_physical:includedhorm_contra 0.0466 0.0231 1041.5511 2.02 0.04381
partner_attractiveness_physical:fertile -0.0248 0.0245 843.9283 -1.01 0.31270
includedhorm_contra:fertile -0.2627 0.2652 842.0180 -0.99 0.32233
partner_attractiveness_physical:includedhorm_contra:fertile 0.0130 0.0321 820.2066 0.41 0.68509
(Intercept) ***
menstruationpre ***
menstruationyes ***
fertile_mean
partner_attractiveness_physical ***
includedhorm_contra *
fertile .
menstruationpre:includedhorm_contra **
menstruationyes:includedhorm_contra ***
partner_attractiveness_physical:includedhorm_contra *
partner_attractiveness_physical:fertile
includedhorm_contra:fertile
partner_attractiveness_physical:includedhorm_contra:fertile
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
convergence code: 0
Model failed to converge with max|grad| = 0.0145062 (tol = 0.002, component 1)
</code></pre>
</div>
<div id="partners-short-term-attractiveness" class="section level4">
<h4>Partner’s short-term attractiveness</h4>
<p>Predicted fertile phase effect sizes (in red): biggest (EP desire, partner mate retention)/smallest (IP desire) when partner’s short-term attractiveness is low.</p>
<pre class="r"><code>model %>%
test_moderator_correction("partner_attractiveness_shortterm", diary)</code></pre>
<table>
<caption>Data: diary</caption>
<colgroup>
<col width="22%" />
<col width="5%" />
<col width="8%" />
<col width="8%" />
<col width="9%" />
<col width="11%" />
<col width="8%" />
<col width="9%" />
<col width="14%" />
</colgroup>
<thead>
<tr class="header">
<th align="center"> </th>
<th align="center">Df</th>
<th align="center">AIC</th>
<th align="center">BIC</th>
<th align="center">logLik</th>
<th align="center">deviance</th>
<th align="center">Chisq</th>
<th align="center">Chi Df</th>
<th align="center">Pr(>Chisq)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center"><strong>with_main</strong></td>
<td align="center">13</td>
<td align="center">48499</td>
<td align="center">48606</td>
<td align="center">-24237</td>
<td align="center">48473</td>
<td align="center">NA</td>
<td align="center">NA</td>
<td align="center">NA</td>
</tr>
<tr class="even">
<td align="center"><strong>with_mod</strong></td>
<td align="center">15</td>
<td align="center">48499</td>
<td align="center">48622</td>
<td align="center">-24235</td>
<td align="center">48469</td>
<td align="center">4.184</td>
<td align="center">2</td>
<td align="center">0.1234</td>
</tr>
<tr class="odd">
<td align="center"><strong>with_mod_ranef</strong></td>
<td align="center">24</td>
<td align="center">48180</td>
<td align="center">48376</td>
<td align="center">-24066</td>
<td align="center">48132</td>
<td align="center">337.4</td>
<td align="center">9</td>
<td align="center">2.95e-67</td>
</tr>
</tbody>
</table>
<p><img src="3_fertility_robustness_correction_files/figure-html/st_attrx-1.png" width="768" /></p>
<pre><code>Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: extra_pair ~ menstruation + fertile_mean + (1 | person) + partner_attractiveness_shortterm +
included + fertile + menstruation:included + partner_attractiveness_shortterm:included +
partner_attractiveness_shortterm:fertile + included:fertile +
partner_attractiveness_shortterm:included:fertile
Data: diary
REML criterion at convergence: 48540
Scaled residuals:
Min 1Q Median 3Q Max
-4.286 -0.556 -0.148 0.404 8.006
Random effects:
Groups Name Variance Std.Dev.
person (Intercept) 0.305 0.552
Residual 0.320 0.566
Number of obs: 26680, groups: person, 1054
Fixed effects:
Estimate Std. Error df t value
(Intercept) 1.8176 0.0467 1317.6822 38.92
menstruationpre -0.0905 0.0173 25905.1898 -5.23
menstruationyes -0.0715 0.0163 25999.5938 -4.38
fertile_mean -0.0393 0.2123 1430.6296 -0.19
partner_attractiveness_shortterm -0.1135 0.0274 1118.6613 -4.15
includedhorm_contra -0.0987 0.0384 1266.0228 -2.57
fertile 0.1676 0.0350 25902.1041 4.78
menstruationpre:includedhorm_contra 0.0692 0.0222 25901.4245 3.12
menstruationyes:includedhorm_contra 0.0862 0.0214 25979.9698 4.03
partner_attractiveness_shortterm:includedhorm_contra 0.0578 0.0369 1099.6873 1.57
partner_attractiveness_shortterm:fertile -0.0567 0.0293 26041.5138 -1.93
includedhorm_contra:fertile -0.1662 0.0445 26007.2502 -3.74
partner_attractiveness_shortterm:includedhorm_contra:fertile 0.0402 0.0384 25978.3292 1.05
Pr(>|t|)
(Intercept) < 2e-16 ***
menstruationpre 0.00000017 ***
menstruationyes 0.00001169 ***
fertile_mean 0.85307
partner_attractiveness_shortterm 0.00003638 ***
includedhorm_contra 0.01036 *
fertile 0.00000173 ***
menstruationpre:includedhorm_contra 0.00182 **
menstruationyes:includedhorm_contra 0.00005526 ***
partner_attractiveness_shortterm:includedhorm_contra 0.11779
partner_attractiveness_shortterm:fertile 0.05312 .
includedhorm_contra:fertile 0.00019 ***
partner_attractiveness_shortterm:includedhorm_contra:fertile 0.29562
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
</code></pre>
<pre><code>Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: extra_pair ~ menstruation + fertile_mean + partner_attractiveness_shortterm +
included + fertile + (1 + menstruation + fertile | person) +
menstruation:included + partner_attractiveness_shortterm:included +
partner_attractiveness_shortterm:fertile + included:fertile +
partner_attractiveness_shortterm:included:fertile
Data: diary
REML criterion at convergence: 48199
Scaled residuals:
Min 1Q Median 3Q Max
-4.745 -0.550 -0.138 0.389 7.913
Random effects:
Groups Name Variance Std.Dev. Corr
person (Intercept) 0.3261 0.571
menstruationpre 0.0440 0.210 -0.28
menstruationyes 0.0671 0.259 -0.25 0.77
fertile 0.2891 0.538 -0.18 0.43 0.57
Residual 0.3028 0.550
Number of obs: 26680, groups: person, 1054
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 1.8296 0.0476 1329.4914 38.41 < 2e-16
menstruationpre -0.0988 0.0208 764.0150 -4.76 0.0000023
menstruationyes -0.0765 0.0216 756.0819 -3.54 0.00043
fertile_mean -0.0818 0.2157 1452.3891 -0.38 0.70462
partner_attractiveness_shortterm -0.1142 0.0273 1048.8625 -4.18 0.0000320
includedhorm_contra -0.1042 0.0398 1027.6986 -2.62 0.00889
fertile 0.1579 0.0460 829.3681 3.43 0.00062
menstruationpre:includedhorm_contra 0.0785 0.0267 760.6416 2.95 0.00333
menstruationyes:includedhorm_contra 0.0937 0.0281 780.3399 3.33 0.00090
partner_attractiveness_shortterm:includedhorm_contra 0.0594 0.0368 1031.6898 1.61 0.10708
partner_attractiveness_shortterm:fertile -0.0469 0.0387 822.0267 -1.21 0.22575
includedhorm_contra:fertile -0.1561 0.0586 810.4311 -2.66 0.00787
partner_attractiveness_shortterm:includedhorm_contra:fertile 0.0329 0.0507 802.3802 0.65 0.51755
(Intercept) ***
menstruationpre ***
menstruationyes ***
fertile_mean
partner_attractiveness_shortterm ***
includedhorm_contra **
fertile ***
menstruationpre:includedhorm_contra **
menstruationyes:includedhorm_contra ***
partner_attractiveness_shortterm:includedhorm_contra
partner_attractiveness_shortterm:fertile
includedhorm_contra:fertile **
partner_attractiveness_shortterm:includedhorm_contra:fertile
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
convergence code: 0
Model failed to converge with max|grad| = 0.00328371 (tol = 0.002, component 1)
</code></pre>
</div>
<div id="partners-short-term-vs-long-term-attractiveness" class="section level4">
<h4>Partner’s short-term vs long-term attractiveness</h4>
<p>Predicted fertile phase effect sizes (in red): biggest (EP desire, partner mate retention)/smallest (IP desire) top-right (high LT, low ST), then top-left (low LT, low ST), then bottom-left (low LT, high ST), then bottom-right (high LT/ST).</p>
<pre class="r"><code>add_main = update.formula(formula(model), new = as.formula(paste0(". ~ . + partner_attractiveness_longterm * included + partner_attractiveness_shortterm * included + partner_attractiveness_longterm * partner_attractiveness_shortterm"))) # reorder so that the triptych looks nice
add_mod_formula = update.formula(update.formula(formula(model), new = . ~ . - included * fertile), new = as.formula(paste0(". ~ . + partner_attractiveness_longterm * fertile * partner_attractiveness_shortterm * included"))) # reorder so that the triptych looks nice
add_mod_formula_ranef = update.formula(update.formula(formula(model), new = . ~ . - included * fertile - (1 | person)), new = as.formula(paste0(". ~ . + partner_attractiveness_longterm * fertile * partner_attractiveness_shortterm * included + (1 + menstruation + fertile | person)"))) # reorder so that the triptych looks nice
update(model, formula = add_main) -> with_main
update(model, formula = add_mod_formula) -> with_mod
update(model, formula = add_mod_formula_ranef) -> with_mod_ranef
cat(pander(anova(with_main, with_mod, with_mod_ranef)))</code></pre>
<table>
<caption>Data: diary</caption>
<colgroup>
<col width="22%" />
<col width="5%" />
<col width="8%" />
<col width="8%" />
<col width="9%" />
<col width="11%" />
<col width="8%" />
<col width="9%" />
<col width="14%" />
</colgroup>
<thead>
<tr class="header">
<th align="center"> </th>
<th align="center">Df</th>
<th align="center">AIC</th>
<th align="center">BIC</th>
<th align="center">logLik</th>
<th align="center">deviance</th>
<th align="center">Chisq</th>
<th align="center">Chi Df</th>
<th align="center">Pr(>Chisq)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="center"><strong>with_main</strong></td>
<td align="center">16</td>
<td align="center">48448</td>
<td align="center">48579</td>
<td align="center">-24208</td>
<td align="center">48416</td>
<td align="center">NA</td>
<td align="center">NA</td>
<td align="center">NA</td>
</tr>
<tr class="even">
<td align="center"><strong>with_mod</strong></td>
<td align="center">23</td>
<td align="center">48446</td>
<td align="center">48634</td>
<td align="center">-24200</td>
<td align="center">48400</td>
<td align="center">15.96</td>
<td align="center">7</td>
<td align="center">0.02553</td>
</tr>
<tr class="odd">
<td align="center"><strong>with_mod_ranef</strong></td>
<td align="center">32</td>
<td align="center">48124</td>
<td align="center">48386</td>
<td align="center">-24030</td>
<td align="center">48060</td>
<td align="center">339.3</td>
<td align="center">9</td>
<td align="center">1.148e-67</td>
</tr>
</tbody>
</table>
<pre class="r"><code>effs = allEffects(with_mod)
effs = data.frame(effs$`partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:included`) %>%
filter(partner_attractiveness_longterm %in% c(-3,-0.4, 0.8),partner_attractiveness_shortterm %in% c(-2,0.4, 2))
ggplot(effs, aes(fertile, fit, ymin = lower, ymax = upper, color = included)) +
facet_grid(partner_attractiveness_shortterm ~ partner_attractiveness_longterm) +
geom_smooth(stat='identity') +
scale_color_manual(values = c("cycling" = 'red', 'horm_contra' = 'black'), guide = F) +
scale_fill_manual(values = c("cycling" = 'red', 'horm_contra' = 'black'), guide = F) +
ggtitle("Moderation", "top-to-bottom: short-term,\nleft-to-right: long-term attractiveness of the partner")+
ylab(names(model@frame)[1])</code></pre>
<p><img src="3_fertility_robustness_correction_files/figure-html/st_vs_lt-1.png" width="768" /></p>
<pre class="r"><code>print_summary(with_mod)</code></pre>
<pre><code>Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: extra_pair ~ menstruation + fertile_mean + (1 | person) + partner_attractiveness_longterm +
fertile + partner_attractiveness_shortterm + included + menstruation:included +
partner_attractiveness_longterm:fertile + partner_attractiveness_longterm:partner_attractiveness_shortterm +
fertile:partner_attractiveness_shortterm + partner_attractiveness_longterm:included +
fertile:included + partner_attractiveness_shortterm:included +
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm +
partner_attractiveness_longterm:fertile:included + partner_attractiveness_longterm:partner_attractiveness_shortterm:included +
fertile:partner_attractiveness_shortterm:included + partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:included
Data: diary
REML criterion at convergence: 48514
Scaled residuals:
Min 1Q Median 3Q Max
-4.285 -0.557 -0.148 0.403 7.987
Random effects:
Groups Name Variance Std.Dev.
person (Intercept) 0.289 0.537
Residual 0.320 0.566
Number of obs: 26680, groups: person, 1054
Fixed effects:
Estimate
(Intercept) 1.81689
menstruationpre -0.08939
menstruationyes -0.06950
fertile_mean -0.08072
partner_attractiveness_longterm -0.13238
fertile 0.16947
partner_attractiveness_shortterm -0.04705
includedhorm_contra -0.09586
menstruationpre:includedhorm_contra 0.06851
menstruationyes:includedhorm_contra 0.08475
partner_attractiveness_longterm:fertile 0.06901
partner_attractiveness_longterm:partner_attractiveness_shortterm 0.03371
fertile:partner_attractiveness_shortterm -0.08784
partner_attractiveness_longterm:includedhorm_contra -0.02470
fertile:includedhorm_contra -0.17245
partner_attractiveness_shortterm:includedhorm_contra 0.02739
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm -0.01932
partner_attractiveness_longterm:fertile:includedhorm_contra -0.00301
partner_attractiveness_longterm:partner_attractiveness_shortterm:includedhorm_contra 0.00761
fertile:partner_attractiveness_shortterm:includedhorm_contra 0.05629
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:includedhorm_contra 0.02688
Std. Error
(Intercept) 0.04690
menstruationpre 0.01729
menstruationyes 0.01632
fertile_mean 0.20816
partner_attractiveness_longterm 0.03233
fertile 0.03654
partner_attractiveness_shortterm 0.02979
includedhorm_contra 0.03937
menstruationpre:includedhorm_contra 0.02220
menstruationyes:includedhorm_contra 0.02138
partner_attractiveness_longterm:fertile 0.03534
partner_attractiveness_longterm:partner_attractiveness_shortterm 0.02380
fertile:partner_attractiveness_shortterm 0.03203
partner_attractiveness_longterm:includedhorm_contra 0.04123
fertile:includedhorm_contra 0.04607
partner_attractiveness_shortterm:includedhorm_contra 0.03886
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm 0.02617
partner_attractiveness_longterm:fertile:includedhorm_contra 0.04481
partner_attractiveness_longterm:partner_attractiveness_shortterm:includedhorm_contra 0.03716
fertile:partner_attractiveness_shortterm:includedhorm_contra 0.04106
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:includedhorm_contra 0.04051
df
(Intercept) 1312.71825
menstruationpre 25913.25571
menstruationyes 26009.82279
fertile_mean 1438.55429
partner_attractiveness_longterm 1114.48364
fertile 25909.66548
partner_attractiveness_shortterm 1102.58664
includedhorm_contra 1253.39319
menstruationpre:includedhorm_contra 25909.80486
menstruationyes:includedhorm_contra 25989.74406
partner_attractiveness_longterm:fertile 26107.65078
partner_attractiveness_longterm:partner_attractiveness_shortterm 1111.71715
fertile:partner_attractiveness_shortterm 26012.67484
partner_attractiveness_longterm:includedhorm_contra 1110.42474
fertile:includedhorm_contra 26011.54191
partner_attractiveness_shortterm:includedhorm_contra 1091.40437
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm 26036.70548
partner_attractiveness_longterm:fertile:includedhorm_contra 26065.14021
partner_attractiveness_longterm:partner_attractiveness_shortterm:includedhorm_contra 1109.36338
fertile:partner_attractiveness_shortterm:includedhorm_contra 25972.25941
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:includedhorm_contra 25982.80298
t value
(Intercept) 38.74
menstruationpre -5.17
menstruationyes -4.26
fertile_mean -0.39
partner_attractiveness_longterm -4.09
fertile 4.64
partner_attractiveness_shortterm -1.58
includedhorm_contra -2.43
menstruationpre:includedhorm_contra 3.09
menstruationyes:includedhorm_contra 3.96
partner_attractiveness_longterm:fertile 1.95
partner_attractiveness_longterm:partner_attractiveness_shortterm 1.42
fertile:partner_attractiveness_shortterm -2.74
partner_attractiveness_longterm:includedhorm_contra -0.60
fertile:includedhorm_contra -3.74
partner_attractiveness_shortterm:includedhorm_contra 0.70
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm -0.74
partner_attractiveness_longterm:fertile:includedhorm_contra -0.07
partner_attractiveness_longterm:partner_attractiveness_shortterm:includedhorm_contra 0.20
fertile:partner_attractiveness_shortterm:includedhorm_contra 1.37
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:includedhorm_contra 0.66
Pr(>|t|)
(Intercept) < 2e-16 ***
menstruationpre 0.00000024 ***
menstruationyes 0.00002061 ***
fertile_mean 0.69822
partner_attractiveness_longterm 0.00004544 ***
fertile 0.00000353 ***
partner_attractiveness_shortterm 0.11456
includedhorm_contra 0.01503 *
menstruationpre:includedhorm_contra 0.00203 **
menstruationyes:includedhorm_contra 0.00007397 ***
partner_attractiveness_longterm:fertile 0.05085 .
partner_attractiveness_longterm:partner_attractiveness_shortterm 0.15695
fertile:partner_attractiveness_shortterm 0.00610 **
partner_attractiveness_longterm:includedhorm_contra 0.54926
fertile:includedhorm_contra 0.00018 ***
partner_attractiveness_shortterm:includedhorm_contra 0.48105
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm 0.46028
partner_attractiveness_longterm:fertile:includedhorm_contra 0.94638
partner_attractiveness_longterm:partner_attractiveness_shortterm:includedhorm_contra 0.83778
fertile:partner_attractiveness_shortterm:includedhorm_contra 0.17040
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:includedhorm_contra 0.50705
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
</code></pre>
<pre class="r"><code>print_summary(with_mod_ranef)</code></pre>
<pre><code>Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: extra_pair ~ menstruation + fertile_mean + partner_attractiveness_longterm +
fertile + partner_attractiveness_shortterm + included + (1 +
menstruation + fertile | person) + menstruation:included +
partner_attractiveness_longterm:fertile + partner_attractiveness_longterm:partner_attractiveness_shortterm +
fertile:partner_attractiveness_shortterm + partner_attractiveness_longterm:included +
fertile:included + partner_attractiveness_shortterm:included +
partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm +
partner_attractiveness_longterm:fertile:included + partner_attractiveness_longterm:partner_attractiveness_shortterm:included +
fertile:partner_attractiveness_shortterm:included + partner_attractiveness_longterm:fertile:partner_attractiveness_shortterm:included
Data: diary
REML criterion at convergence: 48169
Scaled residuals:
Min 1Q Median 3Q Max
-4.751 -0.550 -0.137 0.390 7.902
Random effects:
Groups Name Variance Std.Dev. Corr
person (Intercept) 0.3102 0.557
menstruationpre 0.0440 0.210 -0.33
menstruationyes 0.0673 0.259 -0.26 0.77
fertile 0.2907 0.539 -0.17 0.44 0.57
Residual 0.3028 0.550
Number of obs: 26680, groups: person, 1054
Fixed effects:
Estimate
(Intercept) 1.82835