-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDraft5_ConsolidatedCodeforPublishing_1021.m
2591 lines (2203 loc) · 143 KB
/
Draft5_ConsolidatedCodeforPublishing_1021.m
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
%% Complete Draft of Lab Conditions Puberty Code for Publishing
% Inefficient Viz Code by Azure Grant
%This script uses variables from pubertycohortnaf_allvariables_041421
%This generates all the figures in the publication
%"Adolescent Development of Biological Rhythms:
%Estradiol Dependence and Effects of Combined Contraceptives"
% By Azure D. Grant, Linda Wilbrecht, Lance J. Kriegsfeld.
%Frontiers in Physiology
%% Figure 1. Version of fecal estradiol values prepuberty, early, mid, and late/adult
%for defining these variables see script %"Updated_Estradiol_Values_12221_version_strictly_consecutive"
%prepuberty
figure;subplot(1,4,1);denominator=sqrt(length(Prepubertymraw(:,:)));SEMEstradiol=std(Prepubertymraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(Prepubertymraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.6 1],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(Prepubertymbcraw(:,:)));SEMEstradiol=std(Prepubertymbcraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(Prepubertymbcraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.3 0.5],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(Prepubertyoxshamraw(:,:)));SEMEstradiol=std(Prepubertyoxshamraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(Prepubertyoxshamraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.7 0.6 0.6],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(PrepubertyoxE2raw(:,:)));SEMEstradiol=std(PrepubertyoxE2raw(:,:),0,2)/denominator;
errorbar(xvalues,mean(PrepubertyoxE2raw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
set(gca,'fontsize',15,'box','on');xlim([2 5]); xticklabels({'1','2','3','4',});
%early
subplot(1,4,2); denominator=sqrt(length(firstcyclemraw(:,:)));SEMEstradiol=std(firstcyclemraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(firstcyclemraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.6 1],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(pfirstcyclembcraw(:,:)));SEMEstradiol=std(pfirstcyclembcraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pfirstcyclembcraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.3 0.5],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(firstcycleoxshamraw(:,:)));SEMEstradiol=std(firstcycleoxshamraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(firstcycleoxshamraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.7 0.6 0.6],'LineWidth',2); hold on; axis tight;ylim([ 0 3500]);
denominator=sqrt(length(pfirstcycleoxE2raw(:,:)));SEMEstradiol=std(pfirstcycleoxE2raw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pfirstcycleoxE2raw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;
axis tight;ylim([ 0 3500]);set(gca,'fontsize',15,'box','on');set(gca,'YTickLabel',{})
xlim([2 5]); xticklabels({'1','2','3','4',});
%mid
subplot(1,4,3);denominator=sqrt(length(pmidpubertycyclemraw(:,:)));SEMEstradiol=std(pmidpubertycyclemraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pmidpubertycyclemraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.6 1],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(pmidpubertycyclembcraw(:,:)));SEMEstradiol=std(pmidpubertycyclembcraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pmidpubertycyclembcraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.3 0.5],'LineWidth',2); hold on; axis tight;ylim([ 0 3500]);
denominator=sqrt(length(pmidpubertycycleoxshamraw(:,:)));SEMEstradiol=std(pmidpubertycycleoxshamraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pmidpubertycycleoxshamraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.7 0.6 0.6],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(pmidpubertycycleoxE2raw(:,:)));SEMEstradiol=std(pmidpubertycycleoxE2raw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pmidpubertycycleoxE2raw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);set(gca,'fontsize',15);set(gca,'YTickLabel',{});
xlim([2 5]); xticklabels({'1','2','3','4',});
%late
subplot(1,4,4);denominator=sqrt(length(p60cyclemraw(:,:)));SEMEstradiol=std(p60cyclemraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(p60cyclemraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.6 1],'LineWidth',2); hold on;
axis tight;ylim([ 0 3500]);
denominator=sqrt(length(p60cyclembcraw(:,:)));SEMEstradiol=std(p60cyclembcraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(p60cyclembcraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0 0.3 0.5],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(p60cycleoxshamraw(:,:)));SEMEstradiol=std(p60cycleoxshamraw(:,:),0,2)/denominator;
errorbar(xvalues,mean(p60cycleoxshamraw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.7 0.6 0.6],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);
denominator=sqrt(length(p60cycleoxE2raw(:,:)));SEMEstradiol=std(p60cycleoxE2raw(:,:),0,2)/denominator;
errorbar(xvalues,mean(pmidpubertycycleoxE2raw(:,:),2),nolowerbar,SEMEstradiol,'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;axis tight;ylim([ 0 3500]);set(gca,'fontsize',15);set(gca,'YTickLabel',{});
xlim([2 5]); xticklabels({'1','2','3','4',});
%% Estradiol by Cycle of Life Stats
%Pre-puberty Stats
AUCprepubertycyclemraw=trapz(Prepubertymraw);AUCprepubertycyclembcraw=trapz(Prepubertymbcraw);
AUCprepubertycycleoxshamraw=trapz(Prepubertyoxshamraw);AUCprepubertycycleoxE2raw=trapz(PrepubertyoxE2raw);
groupprepub(1:8)=1; groupprepub(9:16)=2; groupprepub(17:23)=3; groupprepub(24:30)=4;
[pprepubfE2,tblpprepubfE2,statspprepubfE2]=kruskalwallis([AUCprepubertycyclemraw ,AUCprepubertycyclembcraw,AUCprepubertycycleoxshamraw,AUCprepubertycycleoxE2raw],groupprepub)
multcompare(statspprepubfE2)
%Source SS df MS Chi-sq Prob>Chi-sq
%------------------------------------------------------
%%Groups 347.14 3 115.714 4.48 0.2141
%Error 1899.86 26 73.071
%Total 2247 29
%Dunn's Correction Multiple Comparisons No Diffs
% 1.0000 2.0000 -9.5569 1.7500 13.0569 0.9787
% 1.0000 3.0000 -4.0609 7.6429 19.3466 0.3355
% 1.0000 4.0000 -4.2037 7.5000 19.2037 0.3526
% 2.0000 3.0000 -5.8109 5.8929 17.5966 0.5670
% 2.0000 4.0000 -5.9537 5.7500 17.4537 0.5871
% 3.0000 4.0000 -12.2304 -0.1429 11.9447 1.0000
%First Cycle or Silastic Implant Stats
AUCpfirstcyclemraw=trapz(firstcyclemraw);size(AUCpfirstcyclemraw);AUCpfirstcyclembcraw=trapz(pfirstcyclembcraw);size(AUCpfirstcyclembcraw)
AUCpfirstcycleoxshamraw=trapz(firstcycleoxshamraw);size(AUCpfirstcycleoxshamraw);AUCpfirstcycleoxE2raw=trapz(pfirstcycleoxE2raw);size(AUCpfirstcycleoxE2raw)
groupfirst(1:7)=1; groupfirst(8:15)=2; groupfirst(16:22)=3; groupfirst(23:30)=4;
[pfirstfE2,tblpfirstfE2,statspfirstfE2]=kruskalwallis([AUCpfirstcyclemraw ,AUCpfirstcyclembcraw,AUCpfirstcycleoxshamraw,AUCpfirstcycleoxE2raw],groupfirst)
multcompare(statspfirstfE2)
%Source SS df MS Chi-sq Prob>Chi-sq
%------------------------------------------------------
%Groups 1230.01 3 410.004 15.87 0.0012
%Error 1016.99 26 39.115
%Total 2247 29
%Dunn's Correction Multiple Comparisons Results
% 1.0000 2.0000 -13.2305 -1.5268 10.1769 0.9870
% 1.0000 3.0000 2.1267 14.2143 26.3018 0.0134 %intact vs ox
% 1.0000 4.0000 -2.7930 8.9107 20.6144 0.2049
% 2.0000 3.0000 4.0374 15.7411 27.4448 0.0031 %mbc vs ox
% 2.0000 4.0000 -0.8694 10.4375 21.7444 0.0826
% 3.0000 4.0000 -17.0073 -5.3036 6.4001 0.6495
%Mid puberty cycle
AUCpmidpubertycyclemraw=trapz(pmidpubertycyclemraw);size(AUCpmidpubertycyclemraw)
AUCpmidpubertycyclembcraw=trapz(pmidpubertycyclembcraw);size(AUCpmidpubertycyclembcraw)
AUCpmidpubertycycleoxshamraw=trapz(pmidpubertycycleoxshamraw);size(AUCpmidpubertycycleoxshamraw)
AUCpmidpubertycycleoxE2raw=trapz(pmidpubertycycleoxE2raw);size(AUCpmidpubertycycleoxE2raw)
groupmidpuberty(1:7)=1; groupmidpuberty(8:12)=2; groupmidpuberty(13:19)=3; groupmidpuberty(20:26)=4;
[pmidpubertyfE2,tblpmidpubertyfE2,statspmidpubertyfE2]=kruskalwallis([AUCpmidpubertycyclemraw ,AUCpmidpubertycyclembcraw,AUCpmidpubertycycleoxshamraw,AUCpmidpubertycycleoxE2raw],groupmidpuberty)
multcompare(statspmidpubertyfE2)
%Source SS df MS Chi-sq Prob>Chi-sq
%------------------------------------------------------
%Groups 799.59 3 266.529 13.67 0.0034
%Error 662.91 22 30.132
%Total 1462.5 25
%Dunn's Correction Multiple Comparisons Results
% 1.0000 2.0000 -9.6197 1.8857 13.3912 0.9749
% 1.0000 3.0000 3.6399 14.1429 24.6459 0.0030 %intact v ox
% 1.0000 4.0000 -4.5030 6.0000 16.5030 0.4572
% 2.0000 3.0000 0.7517 12.2571 23.7626 0.0315 %mbc v ox
% 2.0000 4.0000 -7.3912 4.1143 15.6197 0.7949
% 3.0000 4.0000 -18.6459 -8.1429 2.3601 0.1910
%Early Adulthood Cycle
AUCp60cyclemraw=trapz(p60cyclemraw); size(AUCp60cyclemraw)
AUCp60cyclembcraw=trapz(p60cyclembcraw);size(AUCp60cyclembcraw)
AUCp60cycleoxshamraw=trapz(p60cycleoxshamraw);size(AUCp60cycleoxshamraw)
AUCp60cycleoxE2raw=trapz(p60cycleoxE2raw);size(AUCp60cycleoxE2raw)
groupearlyadult(1:7)=1; groupearlyadult(8:15)=2; groupearlyadult(16:22)=3; groupearlyadult(23:30)=4;
[p60fE2,tblp60fE2,statsp60fE2]=kruskalwallis([AUCp60cyclemraw,AUCp60cyclembcraw,AUCp60cycleoxshamraw,AUCp60cycleoxE2raw],groupearlyadult)
multcompare(statsp60fE2)
%Source SS df MS Chi-sq Prob>Chi-sq
%------------------------------------------------------
%Groups 1322.77 3 440.923 17.07 0.0007
%Error 924.73 26 35.567
%Total 2247.5 29 \
%Dunn's Correction Multiple Comparisons Results
% 1.0000 2.0000 -8.0443 3.6607 15.3657 0.8528
% 1.0000 3.0000 5.9111 18.0000 30.0889 0.0008 %intact v ox
% 1.0000 4.0000 -1.9193 9.7857 21.4907 0.1382
% 2.0000 3.0000 2.6343 14.3393 26.0443 0.0089 %mbc v ox
% 2.0000 4.0000 -5.1831 6.1250 17.4331 0.5046
% 3.0000 4.0000 -19.9193 -8.2143 3.4907 0.2719
%% Supplemental Figure 1: Post Contraceptive Comparison of Intact and Intact + C Animals
%AUC not diff but day 3 pattern is.
AUClastcyclemraw=trapz(plastcyclecyclemraw); size(AUClastcyclemraw)
AUClastcyclembcraw=trapz(plastcyclecyclembcraw);size(AUClastcyclembcraw)
grouplast(1:8)=1; grouplast(9:15)=2;
[plastfE2,tbllastfE2,statslastfE2]=kruskalwallis([AUClastcyclemraw,AUClastcyclembcraw],grouplast)
%Source SS df MS Chi-sq Prob>Chi-sq
%------------------------------------------------------
%Groups 32.411 1 32.4107 1.62 0.203
%Error 247.589 13 19.0453
%Total 280 14
%% Supplemental Figure 1: Grid of Estradiol Profiles by Cycle of Life by Group
figure;hold on; subplot(4,5,1);plot(mean(Prepubertymraw(:,:),2),'color',[0 0.6 1],'LineWidth',2); hold on;
x=1:length(mean(Prepubertymraw(:,:),2));a=fill([x fliplr(x)],[(std(Prepubertymraw(:,:),0,2)+mean(Prepubertymraw(:,:),2))' flipud(mean(Prepubertymraw(:,:),2)-std(Prepubertymraw(:,:),0,2))'],[0.0 0.6 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15);axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
%intact cycle 1
hold on; subplot(4,5,2);plot(mean(firstcyclemraw(:,:),2),'color',[0 0.6 1],'LineWidth',2); hold on;
x=1:length(mean(firstcyclemraw(:,:),2));a=fill([x fliplr(x)],[(std(firstcyclemraw(:,:),0,2)+mean(firstcyclemraw(:,:),2))' flipud(mean(firstcyclemraw(:,:),2)-std(firstcyclemraw(:,:),0,2))'],[0.0 0.6 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,3);plot(mean(pmidpubertycyclemraw(:,:),2),'color',[0 0.6 1],'LineWidth',2); hold on;
x=1:length(mean(pmidpubertycyclemraw(:,:),2));a=fill([x fliplr(x)],[(std(pmidpubertycyclemraw(:,:),0,2)+mean(pmidpubertycyclemraw(:,:),2))' flipud(mean(pmidpubertycyclemraw(:,:),2)-std(pmidpubertycyclemraw(:,:),0,2))'],[0.0 0.6 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,4);plot(mean(p60cyclemraw(:,:),2),'color',[0 0.6 1],'LineWidth',2); hold on;
x=1:length(mean(p60cyclemraw(:,:),2));a=fill([x fliplr(x)],[(std(p60cyclemraw(:,:),0,2)+mean(p60cyclemraw(:,:),2))' flipud(mean(p60cyclemraw(:,:),2)-std(p60cyclemraw(:,:),0,2))'],[0.0 0.6 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,5);plot(mean(plastcyclecyclemraw(:,:),2),'color',[0 0.6 1],'LineWidth',2); hold on;
x=1:length(mean(plastcyclecyclemraw(:,:),2));a=fill([x fliplr(x)],[(std(plastcyclecyclemraw(:,:),0,2)+mean(plastcyclecyclemraw(:,:),2))' flipud(mean(plastcyclecyclemraw(:,:),2)-std(plastcyclecyclemraw(:,:),0,2))'],[0.0 0.6 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
%mbc
subplot(4,5,6);plot(mean(Prepubertymbcraw(:,:),2),'color',[0 0.3 0.5],'LineWidth',2); hold on;
x=1:length(mean(Prepubertymbcraw(:,:),2));a=fill([x fliplr(x)],[(std(Prepubertymbcraw(:,:),0,2)+mean(Prepubertymbcraw(:,:),2))' flipud(mean(Prepubertymbcraw(:,:),2)-std(Prepubertymbcraw(:,:),0,2))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
%insert prepubertycycle for mbc, oxsham and oxe2..woops
subplot(4,5,7);plot(mean(pfirstcyclembcraw(:,:),2),'color',[0 0.3 0.5],'LineWidth',2); hold on;
x=1:length(mean(pfirstcyclembcraw(:,:),2));a=fill([x fliplr(x)],[(std(pfirstcyclembcraw(:,:),0,2)+mean(pfirstcyclembcraw(:,:),2))' flipud(mean(pfirstcyclembcraw(:,:),2)-std(pfirstcyclembcraw(:,:),0,2))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,8);plot(mean(pmidpubertycyclembcraw(:,:),2),'color',[0 0.3 0.5],'LineWidth',2); hold on;
x=1:length(mean(pmidpubertycyclembcraw(:,:),2));a=fill([x fliplr(x)],[(std(pmidpubertycyclembcraw(:,:),0,2)+mean(pmidpubertycyclembcraw(:,:),2))' flipud(mean(pmidpubertycyclembcraw(:,:),2)-std(pmidpubertycyclembcraw(:,:),0,2))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,9);plot(mean(p60cyclembcraw(:,:),2),'color',[0 0.3 0.5],'LineWidth',2); hold on;
x=1:length(mean(p60cyclembcraw(:,:),2));a=fill([x fliplr(x)],[(std(p60cyclembcraw(:,:),0,2)+mean(p60cyclembcraw(:,:),2))' flipud(mean(p60cyclembcraw(:,:),2)-std(p60cyclembcraw(:,:),0,2))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,10);plot(mean(plastcyclecyclembcraw(:,:),2),'color',[0 0.3 0.5],'LineWidth',2); hold on;
x=1:length(mean(plastcyclecyclembcraw(:,:),2));a=fill([x fliplr(x)],[(std(plastcyclecyclembcraw(:,:),0,2)+mean(plastcyclecyclembcraw(:,:),2))' flipud(mean(plastcyclecyclembcraw(:,:),2)-std(plastcyclecyclembcraw(:,:),0,2))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
%oxsham
%pick up here finishing copy paste
subplot(4,5,11);plot(mean(Prepubertyoxshamraw(:,:),2),'color',[0.7 0.6 0.6],'LineWidth',2); hold on;
x=1:length(mean(Prepubertyoxshamraw(:,:),2));a=fill([x fliplr(x)],[(std(Prepubertyoxshamraw(:,:),0,2)+mean(Prepubertyoxshamraw(:,:),2))' flipud(mean(Prepubertyoxshamraw(:,:),2)-std(Prepubertyoxshamraw(:,:),0,2))'],[0.7 0.6 0.6]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,12);plot(mean(firstcycleoxshamraw(:,:),2),'color',[0.7 0.6 0.6],'LineWidth',2); hold on;
x=1:length(mean(firstcycleoxshamraw(:,:),2));a=fill([x fliplr(x)],[(std(firstcycleoxshamraw(:,:),0,2)+mean(firstcycleoxshamraw(:,:),2))' flipud(mean(firstcycleoxshamraw(:,:),2)-std(firstcycleoxshamraw(:,:),0,2))'],[0.7 0.6 0.6]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,13);plot(mean(pmidpubertycycleoxshamraw(:,:),2),'color',[0.7 0.6 0.6],'LineWidth',2); hold on;
x=1:length(mean(pmidpubertycycleoxshamraw(:,:),2));a=fill([x fliplr(x)],[(std(pmidpubertycycleoxshamraw(:,:),0,2)+mean(pmidpubertycycleoxshamraw(:,:),2))' flipud(mean(pmidpubertycycleoxshamraw(:,:),2)-std(pmidpubertycycleoxshamraw(:,:),0,2))'],[0.7 0.6 0.6]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,14);
plot(mean(p60cycleoxshamraw(:,:),2),'color',[0.7 0.6 0.6],'LineWidth',2); hold on;
x=1:length(mean(p60cycleoxshamraw(:,:),2));a=fill([x fliplr(x)],[(std(p60cycleoxshamraw(:,:),0,2)+mean(p60cycleoxshamraw(:,:),2))' flipud(mean(p60cycleoxshamraw(:,:),2)-std(p60cycleoxshamraw(:,:),0,2))'],[0.7 0.6 0.6]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
%oxE2
subplot(4,5,16);plot(mean(PrepubertyoxE2raw(:,:),2),'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;
x=1:length(mean(PrepubertyoxE2raw(:,:),2));a=fill([x fliplr(x)],[(std(PrepubertyoxE2raw(:,:),0,2)+mean(PrepubertyoxE2raw(:,:),2))' flipud(mean(PrepubertyoxE2raw(:,:),2)-std(PrepubertyoxE2raw(:,:),0,2))'],[0.8100 0.3100 0.0700]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,17);plot(mean(pfirstcycleoxE2raw(:,:),2),'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;
x=1:length(mean(pfirstcycleoxE2raw(:,:),2));a=fill([x fliplr(x)],[(std(pfirstcycleoxE2raw(:,:),0,2)+mean(pfirstcycleoxE2raw(:,:),2))' flipud(mean(pfirstcycleoxE2raw(:,:),2)-std(pfirstcycleoxE2raw(:,:),0,2))'],[0.8100 0.3100 0.0700]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,18);plot(mean(pmidpubertycycleoxE2raw(:,:),2),'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;
x=1:length(mean(pmidpubertycycleoxE2raw(:,:),2));a=fill([x fliplr(x)],[(std(pmidpubertycycleoxE2raw(:,:),0,2)+mean(pmidpubertycycleoxE2raw(:,:),2))' flipud(mean(pmidpubertycycleoxE2raw(:,:),2)-std(pmidpubertycycleoxE2raw(:,:),0,2))'],[0.8100 0.3100 0.0700]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
subplot(4,5,19); plot(mean(pmidpubertycycleoxE2raw(:,:),2),'color',[0.8100 0.3100 0.0700],'LineWidth',2); hold on;
x=1:length(mean(pmidpubertycycleoxE2raw(:,:),2));a=fill([x fliplr(x)],[(std(pmidpubertycycleoxE2raw(:,:),0,2)+mean(pmidpubertycycleoxE2raw(:,:),2))' flipud(mean(pmidpubertycycleoxE2raw(:,:),2)-std(pmidpubertycycleoxE2raw(:,:),0,2))'],[0.8100 0.3100 0.0700]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
% Overlay of intact and intact+c
subplot(4,5,[15 20]); plot(mean(plastcyclecyclemraw(:,:),2),'color',[0 0.6 1],'LineWidth',2); hold on;
x=1:length(mean(plastcyclecyclemraw(:,:),2));a=fill([x fliplr(x)],[(std(plastcyclecyclemraw(:,:),0,2)+mean(plastcyclecyclemraw(:,:),2))' flipud(mean(plastcyclecyclemraw(:,:),2)-std(plastcyclecyclemraw(:,:),0,2))'],[0.0 0.6 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
plot(mean(plastcyclecyclembcraw(:,:),2),'color',[0 0.3 0.5],'LineWidth',2); hold on;
x=1:length(mean(plastcyclecyclembcraw(:,:),2));a=fill([x fliplr(x)],[(std(plastcyclecyclembcraw(:,:),0,2)+mean(plastcyclecyclembcraw(:,:),2))' flipud(mean(plastcyclecyclembcraw(:,:),2)-std(plastcyclecyclembcraw(:,:),0,2))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); set(gca,'FontSize',15); axis tight;ylim([ 0 3500]);xlim([2 5]); xticklabels({'1','2','3','4',});
%% Figure 2 Circadian and Ultradian Group Trends Over Life
%% Circadian Rhythms by Group Aligned to Day of Life (Run this and next sect. together for CR UR overlay figure).
figure;
subplot(2,2,1);
plot(mean(movmeanforCRtrend,2),'color',[0.0 0.6 1.0],'LineWidth',3);hold on;
x=1:length(mean(movmeanforCRtrend,2));a=fill([x fliplr(x)],[(mean(movmeanforCRtrend,2)+mean(std(movmeanforCRtrend,0,2),2)/sqrt(8))' flipud(mean(movmeanforCRtrend,2)-mean(std(movmeanforCRtrend,0,2),2)/sqrt(8))'],[0.0 0.3 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight; ylim([ 0.1 1.5]);
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);
subplot(2,2,2);
plot(mean(movmeanforCRtrendmbc,2),'color',[0.0 0.3 0.5],'LineWidth',3);hold on;
x=1:length(mean(movmeanforCRtrendmbc,2));a=fill([x fliplr(x)],[(mean(movmeanforCRtrendmbc,2)+mean(std(movmeanforCRtrendmbc,0,2),2)/sqrt(8))' flipud(mean(movmeanforCRtrendmbc,2)-mean(std(movmeanforCRtrendmbc,0,2),2)/sqrt(8))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
subplot(2,2,3)
plot(mean(movmeanforCRtrendoxsham,2),'color',[0.7 0.6 0.6],'LineWidth',3);hold on;
x=1:length(mean(movmeanforCRtrendoxsham,2));a=fill([x fliplr(x)],[(mean(movmeanforCRtrendoxsham,2)+mean(std(movmeanforCRtrendoxsham,0,2),2)/sqrt(8))' flipud(mean(movmeanforCRtrendoxsham,2)-mean(std(movmeanforCRtrendoxsham,0,2),2)/sqrt(8))'],[0.7 0.6 0.6]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
subplot(2,2,4);
plot(mean(movmeanforCRtrendoxE2,2),'color',[0.8100 0.3100 0.0700],'LineWidth',3);hold on;
x=1:length(mean(movmeanforCRtrendoxE2,2));a=fill([x fliplr(x)],[(mean(movmeanforCRtrendoxE2,2)+mean(std(movmeanforCRtrendoxE2,0,2),2)/sqrt(8))' flipud(mean(movmeanforCRtrendoxE2,2)-mean(std(movmeanforCRtrendoxE2,0,2),2)/sqrt(8))'],[0.8100 0.3100 0.0700]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
%% And Adding Ultradian Rhythms by Group Aligned to Day of LIfe (same script available in Ultradian Rhythm Development)
hold on;
subplot(2,2,1);
plot(mean(movmeanforURtrend,2),':','color',[0.0 0.6 1.0],'LineWidth',3);hold on;
x=1:length(mean(movmeanforURtrend,2));a=fill([x fliplr(x)],[(mean(movmeanforURtrend,2)+mean(std(movmeanforURtrend,0,2),2)/sqrt(8))' flipud(mean(movmeanforURtrend,2)-mean(std(movmeanforURtrend,0,2),2)/sqrt(8))'],[0.0 0.3 1.0]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
subplot(2,2,2); hold on;
plot(mean(movmeanforURtrendmbc,2),':','color',[0.0 0.3 0.5],'LineWidth',3);hold on;
x=1:length(mean(movmeanforURtrendmbc,2));a=fill([x fliplr(x)],[(mean(movmeanforURtrendmbc,2)+mean(std(movmeanforURtrendmbc,0,2),2)/sqrt(8))' flipud(mean(movmeanforURtrendmbc,2)-mean(std(movmeanforURtrendmbc,0,2),2)/sqrt(8))'],[0.0 0.3 0.5]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
subplot(2,2,3); hold on;
plot(mean(movmeanforURtrendoxsham,2),':','color',[0.7 0.6 0.6],'LineWidth',3);hold on;
x=1:length(mean(movmeanforURtrendoxsham,2));a=fill([x fliplr(x)],[(mean(movmeanforURtrendoxsham,2)+mean(std(movmeanforURtrendoxsham,0,2),2)/sqrt(8))' flipud(mean(movmeanforURtrendoxsham,2)-mean(std(movmeanforURtrendoxsham,0,2),2)/sqrt(8))'],[0.7 0.6 0.6]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
subplot(2,2,4); hold on;
plot(mean(movmeanforURtrendoxE2,2),':','color',[0.8100 0.3100 0.0700],'LineWidth',3);hold on;
x=1:length(mean(movmeanforURtrendoxE2,2));a=fill([x fliplr(x)],[(mean(movmeanforURtrendoxE2,2)+mean(std(movmeanforURtrendoxE2,0,2),2)/sqrt(8))' flipud(mean(movmeanforURtrendoxE2,2)-mean(std(movmeanforURtrendoxE2,0,2),2)/sqrt(8))'],[0.8100 0.3100 0.0700]);
alpha(0.2); set(a,'EdgeColor','none'); axis tight;
set(gca,'XTickLabel', [ 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*4 1440*8 1440*12 1440*16 1440*20 1440*24 1440*28 1440*32 1440*36 1440*40 1440*44 1440*48 1440*52 1440*56 1440*60 1440*64 1440*68 1440*72 1440*76 ],'fontsize',10);
set(gca,'FontSize',12);ylim([ 0.1 1.5]);
%% Statistics for Circadian Mann Kendall Trends and Individual Profiles
%% Intact Circadian Mann Kendall Trend and Individual Profiles
clear movmeanforCRtrend forcrMKtest
figure;
for i=1:8
subplot(2,4,i); hold on;
movmeanforCRtrend(:,i)=movmean(pubertycohortnaf{27,new5m(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(zscore(movmeanforCRtrend(:,i)),'color',[0.0 0.6 1.0]);
axis tight; ylim([-3 2]);
title(new5m(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forcrMKtest=movmean(pubertycohortnaf{27,new5m(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,mCRpearlytomid(i)]=Mann_Kendall(forcrMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,mCRpmidtolate(i)]=Mann_Kendall(forcrMKtest(1440*17:1440:1440*32),0.05); % mean of 0.1567
[H,mCRpearlyadult(i)]=Mann_Kendall(forcrMKtest(end-1440*15:1440:end),0.05);%mean of 0.1331
mCRearlytomid(:,i)=forcrMKtest(1:1440:1440*16);
mCRmidtolate(:,i)=forcrMKtest(1440*17:1440:1440*32);
mCRearlyadult(:,i)=forcrMKtest(end-1440*15:1440:end);
plot(zscore(forcrMKtest),'color',[0.0 0.6 1.0],'LineWidth',3);
end
mCRpearlytomid
mCRpmidtolate
mCRpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(mCRpearlytomid) %0.0016
disp('mean of p vals mid to late puberty man kendall')
mean(mCRpmidtolate) %0.3057
disp('mean of p vals early adult man kendall')
mean(mCRpearlyadult) %0.1666
%% Intact + Contraceptives Circadian Mann Kendall Trend and Individual Profiles
clear movmeanforCRtrendmbc forcrMKtest
figure;
for i=1:8
subplot(2,4,i); hold on;
movmeanforCRtrendmbc(:,i)=movmean(pubertycohortnaf{27,new5mbc(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(zscore(movmeanforCRtrendmbc(:,i)),'color',[ 0.0 0.3 0.5]);
axis tight; ylim([-3 2]); title(new5mbc(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forcrMKtest=movmean(pubertycohortnaf{27,new5mbc(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,mbcCRpearlytomid(i)]=Mann_Kendall(forcrMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,mbcCRpmidtolate(i)]=Mann_Kendall(forcrMKtest(1440*17:1440:1440*32),0.05); % mean of 0.1567
[H,mbcCRpearlyadult(i)]=Mann_Kendall(forcrMKtest(end-1440*15:1440:end),0.05);%mean of 0.1331
mbcCRearlytomid(:,i)=forcrMKtest(1:1440:1440*16);
mbcCRmidtolate(:,i)=forcrMKtest(1440*17:1440:1440*32);
mbcCRearlyadult(:,i)=forcrMKtest(end-1440*15:1440:end);
plot(zscore(forcrMKtest),'color',[ 0.0 0.3 0.5],'LineWidth',3);
end
mbcCRpearlytomid
mbcCRpmidtolate
mbcCRpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(mbcCRpearlytomid) %0.0073
disp('mean of p vals mid to late puberty man kendall')
mean(mbcCRpmidtolate) %0.1879
disp('mean of p vals early adult man kendall')
mean(mbcCRpearlyadult) %0.0791
%% OVX Circadian Mann Kendall Trend and Individual Profiles
clear movmeanforCRtrendoxsham forcrMKtest
figure;
for i=1:8
subplot(2,4,i); hold on;
movmeanforCRtrendoxsham(:,i)=movmean(pubertycohortnaf{27,oxsham(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(zscore(movmeanforCRtrendoxsham(:,i)),'color',[0.7 0.6 0.6]);
axis tight; ylim([-3 2]);
title(oxsham(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forcrMKtest=movmean(pubertycohortnaf{27,oxsham(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,oxshamCRpearlytomid(i)]=Mann_Kendall(forcrMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,oxshamCRpmidtolate(i)]=Mann_Kendall(forcrMKtest(1440*17:1440:1440*32),0.05); % mean of 0.1567
[H,oxshamCRpearlyadult(i)]=Mann_Kendall(forcrMKtest(end-1440*15:1440:end),0.05);%mean of 0.1331
oxshamCRearlytomid(:,i)=forcrMKtest(1:1440:1440*16);
oxshamCRmidtolate(:,i)=forcrMKtest(1440*17:1440:1440*32);
oxshamCRearlyadult(:,i)=forcrMKtest(end-1440*15:1440:end);
plot(zscore(forcrMKtest),'color',[0.7 0.6 0.6],'LineWidth',3);
end
oxshamCRpearlytomid
oxshamCRpmidtolate
oxshamCRpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(oxshamCRpearlytomid) %0.0286 - 0.0513
disp('mean of p vals mid to late puberty man kendall')
mean(oxshamCRpmidtolate) %0.3249
disp('mean of p vals early adult man kendall')
mean(oxshamCRpearlyadult) %0.0872
%% OX+E2 Circadian Mann Kendall Trend and Individual Profiles
clear movmeanforCRtrendoxE2 forcrMKtest
figure;
for i=1:8
subplot(2,4,i);
hold on;
movmeanforCRtrendoxE2(:,i)=movmean(pubertycohortnaf{27,oxE2(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(zscore(movmeanforCRtrendoxE2(:,i)),'color',[0.8100 0.3100 0.0700]);
axis tight; ylim([-3 2]); %ylim([-0.6 0.8]);
%ylim([-3 3]);
title(oxE2(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forcrMKtest=movmean(pubertycohortnaf{27,oxE2(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,oxE2CRpearlytomid(i)]=Mann_Kendall(forcrMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,oxE2CRpmidtolate(i)]=Mann_Kendall(forcrMKtest(1440*16:1440:1440*32),0.05); % mean of 0.1567
[H,oxE2CRpearlyadult(i)]=Mann_Kendall(forcrMKtest(end-1440*16:1440:end),0.05);%mean of 0.1331
oxE2CRearlytomid2(:,i)=forcrMKtest(1:1440:1440*16);
oxE2CRmidtolate(:,i)=forcrMKtest(1440*17:1440:1440*32);
oxE2CRearlyadult(:,i)=forcrMKtest(end-1440*15:1440:end);
plot(zscore(forcrMKtest),'color',[0.8100 0.3100 0.0700],'LineWidth',3);
end
oxE2CRpearlytomid
oxE2CRpmidtolate
oxE2CRpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(oxE2CRpearlytomid) % %now 0.0285 (ignore err: 0.0840 %0.04 if only to 14 days)
disp('mean of p vals mid to late puberty man kendall')
mean(oxE2CRpmidtolate) %0.3114
disp('mean of p vals early adult man kendall')
mean(oxE2CRpearlyadult) %0.0365
%% Statistics and Individual Profiles for Ultradian Rhythm Mann Kendall Trends: TLDR; nothing trends up or down significantly
%% Intact Ultradian Mann-Kendall Trend Over Time and Individual Profiles
clear movmeanforURtrend forURMKtest
figure;
for i=1:8
subplot(2,4,i);
hold on;
movmeanforURtrend(:,i)=movmean(pubertycohortnaf{26,new5m(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(movmeanforURtrend(:,i),'color',[0.0 0.6 1.0]);
axis tight; ylim([0 1.5]); title(new5m(i));
set(gca,'XTickLabel', [26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forURMKtest=movmean(pubertycohortnaf{26,new5m(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,mURpearlytomid(i)]=Mann_Kendall(forURMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,mURpmidtolate(i)]=Mann_Kendall(forURMKtest(1440*16:1440:1440*32),0.05); % mean of 0.1567
[H,mURpearlyadult(i)]=Mann_Kendall(forURMKtest(end-1440*16:1440:end),0.05);%mean of 0.1331
plot(forURMKtest,'color',[0.0 0.6 1.0],'LineWidth',3);
end
mURpearlytomid
mURpmidtolate
mURpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(mURpearlytomid) %0.2439
disp('mean of p vals mid to late puberty man kendall')
mean(mURpmidtolate) %0.2140
disp('mean of p vals early adult man kendall')
mean(mURpearlyadult) %0.3118
%% Intact + Contraceptives p50-p58 Ultradian Mann-Kendall Trend Over Time and Individual Profiles
clear movmeanforURtrendmbc forURMKtest
figure;
for i=1:8
subplot(2,4,i); hold on;
movmeanforURtrendmbc(:,i)=movmean(pubertycohortnaf{26,new5mbc(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(movmeanforURtrendmbc(:,i),'color',[ 0.0 0.3 0.5]);
axis tight; ylim([0 1.5]); title(new5mbc(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forURMKtest=movmean(pubertycohortnaf{26,new5mbc(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,mbcURpearlytomid(i)]=Mann_Kendall(forURMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,mbcURpmidtolate(i)]=Mann_Kendall(forURMKtest(1440*16:1440:1440*32),0.05); % mean of 0.1567
[H,mbcURpearlyadult(i)]=Mann_Kendall(forURMKtest(end-1440*16:1440:end),0.05);%mean of 0.1331
plot(forURMKtest,'color',[0.0 0.3 0.5],'LineWidth',3);
end
mbcURpearlytomid
mbcURpmidtolate
mbcURpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(mbcURpearlytomid) %0.2626
disp('mean of p vals mid to late puberty man kendall')
mean(mbcURpmidtolate) %0.3675
disp('mean of p vals early adult man kendall')
mean(mbcURpearlyadult) %0.1072
%% OVX Ultradian Mann-Kendall Trend Over Time and Individual Profiles
clear movmeanforURtrendoxsham forURMKtest
figure;
for i=1:8
subplot(2,4,i); hold on;
movmeanforURtrendoxsham(:,i)=movmean(pubertycohortnaf{26,oxsham(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(movmeanforURtrendoxsham(:,i),'color',[0.7 0.6 0.6]);
axis tight; ylim([0 1.5]); title(oxsham(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forURMKtest=movmean(pubertycohortnaf{26,oxsham(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,oxshamURpearlytomid(i)]=Mann_Kendall(forURMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,oxshamURpmidtolate(i)]=Mann_Kendall(forURMKtest(1440*16:1440:1440*32),0.05); % mean of 0.1567
[H,oxshamURpearlyadult(i)]=Mann_Kendall(forURMKtest(end-1440*16:1440:end),0.05);%mean of 0.1331
plot(forURMKtest,'color',[0.7 0.6 0.6],'LineWidth',3);
end
oxshamURpearlytomid
oxshamURpmidtolate
oxshamURpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(oxshamURpearlytomid) %0.1319
disp('mean of p vals mid to late puberty man kendall')
mean(oxshamURpmidtolate) %0.3175
disp('mean of p vals early adult man kendall')
mean(oxshamURpearlyadult) %0.1476
%% OX+E2 Ultradian Mann-Kendall Trend Over Time and Individual Profiles
clear movmeanforURtrendoxE2 forURMKtest
figure;
for i=1:8
subplot(2,4,i); hold on;
movmeanforURtrendoxE2(:,i)=movmean(pubertycohortnaf{26,oxE2(i)}(1440*8:80641),1440); %removing the 1440 moving mean to see how the overall is affected
plot(movmeanforURtrendoxE2(:,i),'color',[0.8100 0.3100 0.0700]);
axis tight; ylim([0 1.5]); title(oxE2(i));
set(gca,'XTickLabel', [ 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 ],'fontsize',10)
set(gca,'XTick', [ 1 1440*2 1440*4 1440*6 1440*8 1440*10 1440*12 1440*14 1440*16 1440*18 1440*20 1440*22 1440*24 1440*26 1440*28 1440*30 1440*32 1440*34 1440*36 1440*38 1440*40 1440*42 1440*44 1440*46 1440*48 1440*50 1440*52 1440*54 1440*56 1440*58 1440*60 1440*62 1440*64 1440*66 1440*68 1440*70 1440*72 ],'fontsize',10);
set(gca,'FontSize',6);
forURMKtest=movmean(pubertycohortnaf{26,oxE2(i)}(1440*8:80641),1440*4); %removed additional 4 day moving mean. I shouldn't layer them anyways
[H,oxE2URpearlytomid(i)]=Mann_Kendall(forURMKtest(1:1440:1440*16),0.05); %mean of 2.0177e-4
[H,oxE2URpmidtolate(i)]=Mann_Kendall(forURMKtest(1440*16:1440:1440*32),0.05); % mean of 0.1567
[H,oxE2URpearlyadult(i)]=Mann_Kendall(forURMKtest(end-1440*16:1440:end),0.05);%mean of 0.1331
plot(forURMKtest,'color',[0.8100 0.3100 0.0700],'LineWidth',3);
end
oxE2URpearlytomid
oxE2URpmidtolate
oxE2URpearlyadult
%note p vals the same with non-zscored data
disp('mean of p vals early to mid puberty man kendall')
mean(oxE2URpearlytomid) %0.1407
disp('mean of p vals mid to late puberty man kendall')
mean(oxE2URpmidtolate) %0.6147
disp('mean of p vals early adult man kendall')
mean(oxE2URpearlyadult) %0.2306
%% Estradiol Influences Speed of Early Life CR Power Rise - Should update this
%Days of life on which each individual in each group's CR Power had risen %by 2D's compared to its initial value
CRRose2SDM=[36 32 33 36 41 33 38 33];
CRRose2SDMBC=[32 33 32 33 39 30 40 38];
CRRose2SDOXSHAM=[33 40 44 34 42 38 40 44];
CRRose2SDOXE2=[31 31 31 31 31 32 31 31];
%make a bar chart of this data
figure;b=bar([mean(CRRose2SDM) mean(CRRose2SDMBC) mean(CRRose2SDOXSHAM) mean(CRRose2SDOXE2)]);
b.FaceColor = 'flat';
b.CData(1,:) = [0 0.6 1]; b.CData(2,:) = [0 0.3 0.5]; b.CData(3,:)= [0.7 0.6 0.6]; b.CData(4,:) = [0.8100 0.3100 0.0700]; %set colors for each bar
ylim( [25 45]);
%Kruskal Wallis and Dunn's Correction: Are these rise days different?
[pCRRise,tblCRRise,statsCRRise]=kruskalwallis([ CRRose2SDM', CRRose2SDMBC', CRRose2SDOXSHAM', CRRose2SDOXE2'])
correction=multcompare(statsCRRise)
%Source SS df MS Chi-sq Prob>Chi-sq
%-------------------------------------------------------
%Columns 1634.81 3 544.938 18.96 0.0003
%Error 1037.69 28 37.06
%Total 2672.5 31
% 1.0000 2.0000 -9.1766 2.7500 14.6766 0.9344
% 1.0000 3.0000 -18.7391 -6.8125 5.1141 0.4573
% 1.0000 4.0000 1.1359 13.0625 24.9891 0.0253 *
% 2.0000 3.0000 -21.4891 -9.5625 2.3641 0.1665
% 2.0000 4.0000 -1.6141 10.3125 22.2391 0.1174
% 3.0000 4.0000 7.9484 19.8750 31.8016 0.0001 *
%% Violin plots and Statistics of CR power by time of puberty
%early to mid puberty
kw1=reshape(mCRearlytomid,[16*8,1]);kw2=reshape(mbcCRearlytomid,[16*8,1]);
kw3=reshape(oxshamCRearlytomid,[16*8,1]);kw4=reshape(oxE2CRearlytomid2,[16*8,1]);
%kw4=reshape(oxE2CRearlytomid,[14*8,1]);
%Additionally Doing Friedman's Test Because I have Multiple Samples Per
%Individual
[FpearlyCR,FtblearlyCR,FstatsearlyCR]=friedman([kw1, kw2, kw3, kw4],4);
%Source SS df MS Chi-sq Prob>Chi-sq
%-------------------------------------------------------------
%Columns 2855.02 3 951.672 125.96 4.02102e-27
%Interaction 5152.48 93 55.403
%Error 2872.5 384 7.48
%Total 10880 511
correction=multcompare(FstatsearlyCR)
% 1.0000 2.0000 -5.7921 -2.7344 0.3234 0.0986
% 1.0000 3.0000 0.3876 3.4453 6.5031 0.0199 %intact v ox
% 1.0000 4.0000 -4.8624 -1.8047 1.2531 0.4277
% 2.0000 3.0000 3.1219 6.1797 9.2374 0.0000 %mbc v ox
% 2.0000 4.0000 -2.1281 0.9297 3.9874 0.8631
% 3.0000 4.0000 -8.3078 -5.2500 -2.1922 0.0001 %ox v e2
[pearlyCR,tblearlyCR,statsearlyCR]=kruskalwallis([kw1, kw2, kw3, kw4])
correction=multcompare(statsearlyCR)
%Source SS df MS Chi-sq Prob>Chi-sq
%-------------------------------------------------------------
%Columns 1.46791e+06 3 489303.3 67.06 1.81397e-14
%Error 9.71686e+06 508 19127.7
%Total 1.11848e+07 511
% 1.0000 2.0000 -107.4550 -59.9453 -12.4356 0.0065 %intact vs% mbc
% 1.0000 3.0000 27.7637 75.2734 122.7832 0.0003 %intact v ox
% 1.0000 4.0000 -97.6191 -50.1094 -2.5996 0.0340 %intact v e2
% 2.0000 3.0000 87.7090 135.2188 182.7285 0.0000 %mbc v ox
% 2.0000 4.0000 -37.6738 9.8359 57.3457 0.9513 *mbc v e2
% 3.0000 4.0000 -172.8925 -125.3828 -77.8731 0.0000 %ox v e2
figure;
subplot(3,1,1);
[h,L,MX,MED]=violin({kw1,kw2,kw3,kw4},'facecolor',[0.0 0.6 1.0;0.0 0.3 0.5;0.7 0.6 0.6;0.81 0.31 0.07],'edgecolor','k');
%title('early to mid');
ylim([-0.1 1.9]);b = gca; legend(b,'off');set(gca,'Xticklabel',[],'FontSize',10)
%mid puberty to late puberty
kw1=reshape(mCRmidtolate,[16*8,1]);kw2=reshape(mbcCRmidtolate,[16*8,1]);
kw3=reshape(oxshamCRmidtolate,[16*8,1]);kw4=reshape(oxE2CRmidtolate,[16*8,1]);
[FpmidCR,FtblmidCR,FstatsmidCR]=friedman([kw1, kw2, kw3, kw4],4)
%Source SS df MS Chi-sq Prob>Chi-sq
%-------------------------------------------------------------
%Columns 2555.44 3 851.813 112.74 2.82244e-24
%Interaction 6290.56 93 67.64
%Error 2034 384 5.297
%Total 10880 511
correction=multcompare(FstatsmidCR)
% 1.0000 2.0000 -5.2921 -2.2344 0.8234 0.2378
% 1.0000 3.0000 0.4735 3.5313 6.5890 0.0159 %intact v ox
% 1.0000 4.0000 -0.6046 2.4531 5.5109 0.1660
% 2.0000 3.0000 2.7079 5.7656 8.8234 0.0000 %mbc v ox
% 2.0000 4.0000 1.6297 4.6875 7.7453 0.0005 %mbc v e2
% 3.0000 4.0000 -4.1359 -1.0781 1.9796 0.8018
[pmidCR,tblmidCR,statsmidCR]=kruskalwallis([kw1, kw2, kw3, kw4])
correction=multcompare(statsmidCR)
%Source SS df MS Chi-sq Prob>Chi-sq
%-------------------------------------------------------------
%Columns 2.17829e+06 3 726095.1 99.52 1.97144e-21
%Error 9.00648e+06 508 17729.3
%Total 1.11848e+07 511
% 1.0000 2.0000 -104.8613 -57.3516 -9.8418 0.0104
% 1.0000 3.0000 58.8965 106.4063 153.9160 0.0000
% 1.0000 4.0000 34.2481 81.7578 129.2675 0.0001
% 2.0000 3.0000 116.2481 163.7578 211.2675 0.0000
% 2.0000 4.0000 91.5996 139.1094 186.6191 0.0000
% 3.0000 4.0000 -72.1582 -24.6484 22.8613 0.5419
subplot(3,1,2);
[h,L,MX,MED]=violin({kw1,kw2,kw3,kw4},'facecolor',[0.0 0.6 1.0;0.0 0.3 0.5;0.7 0.6 0.6;0.81 0.31 0.07],'edgecolor','k');
%title('mid to late');
ylim([-0.1 1.9]);b = gca; legend(b,'off');set(gca,'Xticklabel',[],'FontSize',10)
%late puberty to early adulthood
kw1=reshape(mCRearlyadult,[16*8,1]);kw2=reshape(mbcCRearlyadult,[16*8,1]);
kw3=reshape(oxshamCRearlyadult,[16*8,1]);kw4=reshape(oxE2CRearlyadult,[16*8,1]);
[FplateCR,FtbllateCR,FstatslateCR]=friedman([kw1, kw2, kw3, kw4],4)
correction=multcompare(FstatslateCR)
%Source SS df MS Chi-sq Prob>Chi-sq
%-------------------------------------------------------------
%Columns 859.66 3 286.552 37.93 2.93028e-08
%Interaction 7767.34 93 83.52
%Error 2253 384 5.867
%Total 10880 511
% 1.0000 2.0000 0.0516 3.1094 6.1671 0.0445 %only
% difference is mbc vs m
% 1.0000 3.0000 -0.7296 2.3281 5.3859 0.2049
% 1.0000 4.0000 -2.6515 0.4063 3.4640 0.9863
% 2.0000 3.0000 -3.8390 -0.7813 2.2765 0.9133
% 2.0000 4.0000 -5.7609 -2.7031 0.3546 0.1048
% 3.0000 4.0000 -4.9796 -1.9219 1.1359 0.3702
[padultCR,tbladultCR,statsadultCR]=kruskalwallis([kw1,kw2,kw3,kw4]);
correction=multcompare(statsadultCR)
%Source SS df MS Chi-sq Prob>Chi-sq
%------------------------------------------------------------
%Columns 544064.5 3 181354.8 24.86 1.65428e-05
%Error 10640703.5 508 20946.3
%Total 11184768 511
% 1.0000 2.0000 33.1465 80.6563 128.1660 0.0001
% 1.0000 3.0000 21.8731 69.3828 116.8925 0.0010
% 1.0000 4.0000 -21.5800 25.9297 73.4394 0.4980 %intact and
% oxe2 not different
% 2.0000 3.0000 -58.7832 -11.2734 36.2363 0.9291 %mbc and ox
% not different
% 2.0000 4.0000 -102.2363 -54.7266 -7.2168 0.0163
% 3.0000 4.0000 -90.9629 -43.4531 4.0566 0.0871
subplot(3,1,3);
[h,L,MX,MED]=violin({kw1,kw2,kw3,kw4},'facecolor',[0.0 0.6 1.0;0.0 0.3 0.5;0.7 0.6 0.6;0.81 0.31 0.07],'edgecolor','k');
%title('late to adult');
ylim([-0.1 1.9]);b = gca; legend(b,'off');set(gca,'Xticklabel',[],'FontSize',10)
%% Circadian Power to Estradiol Correlations and Statistics Figure 2.
%% Redoing Scatters and Regressionss with Individualized Colors and Mixed Effects
%% MBC Post Birth Control Individual Color Scatters an Mixed Effects Results
%(Singleton figure for Inset in Fig 2I)
%plotting post birth control on top right
figure;
for i=1:8;
for j=length(pubertycohortnaf{16,new5mbc(i)})-13:length(pubertycohortnaf{16,new5mbc(i)})
circadianstartpoint=1440*(pubertycohortnaf{16,new5mbc(i)}(j,1)-18);
circadianmediantoplot=median(pubertycohortnaf{27,new5mbc(i)}(circadianstartpoint:circadianstartpoint+1439))
circadianstandarddeviation=std(pubertycohortnaf{27,new5mbc(i)}(circadianstartpoint:circadianstartpoint+1439))
ColormapInterval=8
AzureMBCRed=zeros(1,ColormapInterval);
AzureMBCGreen=[0.6:-(0.5/(ColormapInterval-1)):0.1];
AzureMBCBlue=[(1:-(0.6/(ColormapInterval-1)):0.4)];
%figure;hold on; plot(AzureMBCBlue,'b');plot(AzureMBCGreen,'g');plot(AzureMBCRed,'r');
AzureMBC=[AzureMBCRed' AzureMBCGreen' AzureMBCBlue']; %colorbar=figure; imagesc([1:1:48]);colormap(AzureMBC);
t=scatter(pubertycohortnaf{16,new5mbc(i)}(j,2),circadianmediantoplot,50,[0.0 0.3 0.5],'filled'); hold on;
t.MarkerFaceAlpha=0.4;t.MarkerEdgeAlpha=0.4;
setMarkerColor(t,AzureMBC(i,:),1);
ylim([0 1.6]); xlim([0 5000]);
xpostmbc{i,j}=pubertycohortnaf{16,new5mbc(i)}(j,2);ypostmbc{i,j}=circadianmediantoplot;
disp(j)
end
disp(i)
end
%Mixed Effects MBC Post MBC -- Not significant anymore woohoo!
clear zmforfitlme zpostmbc
for i=1:8
for j=length(pubertycohortnaf{16,new5mbc(i)})-13:length(pubertycohortnaf{16,new5mbc(i)})
zpostmbc{i,j}=i;
end
disp(i)
end
xmforfitlm=cell2mat(reshape(xpostmbc,[8*31,1]));ymforfitlm=cell2mat(reshape(ypostmbc,[8*31,1]));
zmforfitlme=cell2mat(reshape(zpostmbc,[8*31,1]));
clear tblpostmbc
tblpostmbc=table(xmforfitlm,ymforfitlm,zmforfitlme,'VariableNames',{'xvalues','yvalues','groupingvalues'});
%participant=random effect
%estradiol = predictor effectcr
%power = outcome effect
%model 1
lme=fitlme(tblpostmbc,'yvalues~xvalues+(1|groupingvalues)+(xvalues-1|groupingvalues)');
%model 2 alternate setup; correlated slope and intercept variation
%outcome~independent+(independent|group)
lme=fitlme(tblpostmbc,'yvalues~xvalues+(xvalues|groupingvalues)')
%Linear mixed-effects model fit by ML
%Model information:
% Number of observations 112
% Fixed effects coefficients 2
% Random effects coefficients 16
% Covariance parameters 4
%Formula:
% yvalues ~ 1 + xvalues + (1 + xvalues | groupingvalues)
%Model fit statistics:
% AIC BIC LogLikelihood Deviance
% -38.355 -22.044 25.178 -50.355
%Fixed effects coefficients (95% CIs):
% Name Estimate SE tStat DF pValue Lower Upper
% {'(Intercept)'} 0.94954 0.053198 17.849 110 2.8649e-34 0.84412 1.055
% {'xvalues' } 1.5038e-05 2.7455e-05 0.54774 110 0.58498 -3.9372e-05 6.9448e-05
%Random effects covariance parameters (95% CIs):
%Group: groupingvalues (8 Levels)
% Name1 Name2 Type Estimate Lower Upper
% {'(Intercept)'} {'(Intercept)'} {'std' } 0.052019 0.0068967 0.39236
% {'xvalues' } {'(Intercept)'} {'corr'} 1 NaN NaN
% {'xvalues' } {'xvalues' } {'std' } 1.9342e-05 1.4559e-06 0.00025696
%Group: Error
% Name Estimate Lower Upper
% {'Res Std'} 0.18367 0.16035 0.21038
%lme=fitlme(tblpostmbc,'groupingvalues~yvalues+(yvalues|xvalues)')
%% Intact Scatters and Mixed Effects Results
clear xm ym
figure;subplot(2,2,1)
for i=1:8;
for j=1:20;%length(pubertycohortnaf{16,new5m(i)})
circadianstartpoint=1440*(pubertycohortnaf{16,new5m(i)}(j,1)-18);
circadianmediantoplot=median(pubertycohortnaf{27,new5m(i)}(circadianstartpoint:circadianstartpoint+1439))
circadianstandarddeviation=std(pubertycohortnaf{27,new5m(i)}(circadianstartpoint:circadianstartpoint+1439))
ColormapInterval=8%length(pubertycohortnaf{16,new5m(i)})%20;%length(allData{i});
clear AzureM
AzureMRed=[0.6843:-(0.6/(ColormapInterval-1)):0.0843];
AzureMGreen=[0.9157:-(0.6/(ColormapInterval-1)):0.3157];
AzureMBlue=[(0.9882:-(0.5/(ColormapInterval-1)):0.4882)];
%figure;hold on; plot(AzureMBlue,'b');plot(AzureMGreen,'g');plot(AzureMRed,'r');
AzureM=[AzureMRed' AzureMGreen' AzureMBlue']; %colorbar=figure; imagesc([1:1:48]);colormap(AzureM);
t=scatter(pubertycohortnaf{16,new5m(i)}(j,2),circadianmediantoplot,50,[0 0.6 1],'filled'); hold on;
t.MarkerFaceAlpha=0.05;t.MarkerEdgeAlpha=0.05;
setMarkerColor(t,AzureM(i,:),1);
ylim([0 1.6]); xlim([0 5000]);
xm{i,j}=pubertycohortnaf{16,new5m(i)}(j,2);ym{i,j}=circadianmediantoplot;
disp(j)
end
disp(i)
end
clear zmforfitlme
xmforfitlm=cell2mat(reshape(xm,[8*20,1]));ymforfitlm=cell2mat(reshape(ym,[8*20,1]));
zmforfitlme(1:20)=1;zmforfitlme(21:40)=2;
zmforfitlme(41:60)=3; zmforfitlme(61:80)=4;
zmforfitlme(81:100)=5;zmforfitlme(101:120)=6;
zmforfitlme(121:140)=7;zmforfitlme(141:160)=8;
clear tbl
tbl=table(xmforfitlm,ymforfitlm,zmforfitlme(1:160)','VariableNames',{'xvalues','yvalues','groupingvalues'});
%participant=random effect
%estradiol = predictor effectcr
%power = outcome effect
%model 1
%lme=fitlme(tbl,'yvalues~xvalues+(1|groupingvalues)+(xvalues-1|groupingvalues)');
%model 2 alternate setup; correlated slope and intercept variation
%outcome~independent+(independent|group)
lme=fitlme(tbl,'yvalues~xvalues+(xvalues|groupingvalues)')
%alternate one not using
%lme=fitlme(tbl,'groupingvalues~yvalues+(yvalues|xvalues)')
%Linear mixed-effects model fit by ML
%Model information:
% Number of observations 160
% Fixed effects coefficients 2
% Random effects coefficients 16
% Covariance parameters 4
%Formula:
% yvalues ~ 1 + xvalues + (1 + xvalues | groupingvalues)
%Model fit statistics:
% AIC BIC LogLikelihood Deviance
% -26.311 -7.8602 19.156 -38.311
%Fixed effects coefficients (95% CIs):
% Name Estimate SE tStat DF pValue Lower Upper
% {'(Intercept)'} 0.69225 0.086992 7.9577 158 3.1891e-13 0.52044 0.86407
% {'xvalues' } 0.0001017 2.7439e-05 3.7066 158 0.0002902 4.751e-05 0.0001559
%Random effects covariance parameters (95% CIs):
%Group: groupingvalues (8 Levels)
% Name1 Name2 Type Estimate Lower Upper
% {'(Intercept)'} {'(Intercept)'} {'std' } 0.22044 0.12194 0.3985
% {'xvalues' } {'(Intercept)'} {'corr'} -1 NaN NaN
% {'xvalues' } {'xvalues' } {'std' } 3.3365e-05 5.6533e-06 0.00019692
%Group: Error
% Name Estimate Lower Upper
% {'Res Std'} 0.20023 0.17887 0.22413
%% Pre birth control MBC top right
clear xmbc ymbc
subplot(2,2,2);
for i=1:8;
for j=1:length(pubertycohortnaf{16,newmbc(i)})-13;
circadianstartpoint=1440*(pubertycohortnaf{16,newmbc(i)}(j,1)-18);
circadianmediantoplot=median(pubertycohortnaf{27,newmbc(i)}(circadianstartpoint:circadianstartpoint+1439))
circadianstandarddeviation=std(pubertycohortnaf{27,newmbc(i)}(circadianstartpoint:circadianstartpoint+1439))
ColormapInterval=8
AzureMBCRed=zeros(1,ColormapInterval);
AzureMBCGreen=[0.6:-(0.5/(ColormapInterval-1)):0.1];
AzureMBCBlue=[(1:-(0.6/(ColormapInterval-1)):0.4)];
%figure;hold on; plot(AzureMBCBlue,'b');plot(AzureMBCGreen,'g');plot(AzureMBCRed,'r');
AzureMBC=[AzureMBCRed' AzureMBCGreen' AzureMBCBlue']; %colorbar=figure; imagesc([1:1:48]);colormap(AzureMBC);
t=scatter(pubertycohortnaf{16,newmbc(i)}(j,2),circadianmediantoplot,50,[0.0 0.3 0.5],'filled'); hold on;
t.MarkerFaceAlpha=0.4;t.MarkerEdgeAlpha=0.4;
setMarkerColor(t,AzureMBC(i,:),1);
ylim([0 1.6]); xlim([0 5000]);
xmbc{i,j}=pubertycohortnaf{16,newmbc(i)}(j,2);ymbc{i,j}=circadianmediantoplot;
disp(j)
end
disp(i)
end
% Mixed Effects MBC Pre Birth Control
clear zmforfitlme zpostmbc
for i=1:8
for j=1:length(pubertycohortnaf{16,newmbc(i)})-13;
zmbc{i,j}=i;
end
disp(i)
end
xmforfitlm=cell2mat(reshape(xmbc,[8*length(xmbc),1]));ymforfitlm=cell2mat(reshape(ymbc,[8*length(xmbc),1]));
zmforfitlme=cell2mat(reshape(zmbc,[8*length(xmbc),1]));
clear tblpostmbc
tblmbc=table(xmforfitlm,ymforfitlm,zmforfitlme,'VariableNames',{'xvalues','yvalues','groupingvalues'});
%model 2 alternate setup; correlated slope and intercept variation
%outcome~independent+(independent|group)
lme=fitlme(tblmbc,'yvalues~xvalues+(xvalues|groupingvalues)')
%Linear mixed-effects model fit by ML
%Model information:
% Number of observations 116
% Fixed effects coefficients 2
% Random effects coefficients 16
% Covariance parameters 4
%Formula:
% yvalues ~ 1 + xvalues + (1 + xvalues | groupingvalues)
%Model fit statistics:
% AIC BIC LogLikelihood Deviance
% -17.67 -1.1483 14.835 -29.67
%Fixed effects coefficients (95% CIs):
% Name Estimate SE tStat DF pValue Lower Upper
% {'(Intercept)'} 0.61402 0.058574 10.483 114 2.0649e-18 0.49799 0.73005
% {'xvalues' } 0.00012289 5.4113e-05 2.271 114 0.025026 1.5692e-05 0.00023009
%
%Random effects covariance parameters (95% CIs):
%Group: groupingvalues (8 Levels)
% Name1 Name2 Type Estimate Lower Upper
% {'(Intercept)'} {'(Intercept)'} {'std' } 0.098628 0.016613 0.58555
% {'xvalues' } {'(Intercept)'} {'corr'} -0.90266 -0.9984 0.53091
% {'xvalues' } {'xvalues' } {'std' } 0.0001077 3.4046e-05 0.00034071
%Group: Error
% Name Estimate Lower Upper
% {'Res Std'} 0.20339 0.17629 0.23465
%% OVX Scatter and Mixed Effects Model
clear xoxsham yoxsham
subplot(2,2,3)
for i=1:8
for j=1:length(pubertycohortnaf{16,oxsham(i)})
circadianstartpoint=1440*(pubertycohortnaf{16,oxsham(i)}(j,1)-18);
circadianmediantoplot=median(pubertycohortnaf{27,oxsham(i)}(circadianstartpoint:circadianstartpoint+1439))
circadianstandarddeviation=std(pubertycohortnaf{27,oxsham(i)}(circadianstartpoint:circadianstartpoint+1439))
AzureOXSHAMRed=[0.7:-(0.55/(ColormapInterval-1)):0.15];
AzureOXSHAMGreen=[0.6:-(0.55/(ColormapInterval-1)):0.05];
AzureOXSHAMBlue=[(0.6:-(0.55/(ColormapInterval-1)):0.05)];
%figure;hold on; plot(AzureOXSHAMBlue,'b');plot(AzureOXSHAMGreen,'g');plot(AzureOXSHAMRed,'r');
AzureOXSHAM=[AzureOXSHAMRed' AzureOXSHAMGreen' AzureOXSHAMBlue']; %colorbar=figure; imagesc([1:1:48]);colormap(AzureOXSHAM);
t=scatter(pubertycohortnaf{16,oxsham(i)}(j,2),circadianmediantoplot,50,[0.7 0.6 0.6],'filled'); hold on;
t.MarkerFaceAlpha=0.4;t.MarkerEdgeAlpha=0.4;setMarkerColor(t,AzureOXSHAM(i,:),1);
ylim([0 1.6]); xlim([0 5000]);
xoxsham{i,j}=pubertycohortnaf{16,oxsham(i)}(j,2);yoxsham{i,j}=circadianmediantoplot;