-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRICLPM_isolation_adhd_sex.html
2393 lines (2277 loc) · 265 KB
/
RICLPM_isolation_adhd_sex.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>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title>Sex differences in RI-CLPM for social isolation and ADHD symptoms in childhood</title>
<script src="site_libs/header-attrs-2.11/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.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>
<style>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;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<script src="site_libs/navigation-1.1/codefolding.js"></script>
<link href="site_libs/pagedtable-1.1/css/pagedtable.css" rel="stylesheet" />
<script src="site_libs/pagedtable-1.1/js/pagedtable.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">
code {
white-space: pre;
}
.sourceCode {
overflow: visible;
}
</style>
<style type="text/css" data-origin="pandoc">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { font-weight: bold; } /* Alert */
code span.an { font-style: italic; } /* Annotation */
code span.cf { font-weight: bold; } /* ControlFlow */
code span.co { font-style: italic; } /* Comment */
code span.cv { font-style: italic; } /* CommentVar */
code span.do { font-style: italic; } /* Documentation */
code span.dt { text-decoration: underline; } /* DataType */
code span.er { font-weight: bold; } /* Error */
code span.in { font-style: italic; } /* Information */
code span.kw { font-weight: bold; } /* Keyword */
code span.pp { font-weight: bold; } /* Preprocessor */
code span.wa { font-style: italic; } /* Warning */
.sourceCode .row {
width: 100%;
}
.sourceCode {
overflow-x: auto;
}
.code-folding-btn {
margin-right: -30px;
}
</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
try { var rules = sheets[i].cssRules; } catch (e) { continue; }
for (var j = 0; j < rules.length; j++) {
var rule = rules[j];
// check if there is a div.sourceCode rule
if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
var style = rule.style.cssText;
// check if color or background-color is set
if (rule.style.color === '' && rule.style.backgroundColor === '') continue;
// replace div.sourceCode by a pre.sourceCode rule
sheets[i].deleteRule(j);
sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
}
}
})();
</script>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
pre code {
padding: 0;
}
</style>
<style type="text/css">
.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: #adb5bd;
}
.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 type="text/javascript">
// 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.tab('show');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
// Navbar adjustments
var navHeight = $(".navbar").first().height() + 15;
var style = document.createElement('style');
var pt = "padding-top: " + navHeight + "px; ";
var mt = "margin-top: -" + navHeight + "px; ";
var css = "";
// offset scroll position for anchor links (for fixed navbar)
for (var i = 1; i <= 6; i++) {
css += ".section h" + i + "{ " + pt + mt + "}\n";
}
style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css;
document.head.appendChild(style);
});
</script>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
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;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
<style type="text/css">
.code-folding-btn { margin-bottom: 4px; }
</style>
<style type="text/css">
#TOC {
margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
position: relative;
width: 100%;
}
}
@media print {
.toc-content {
/* see https://github.com/w3c/csswg-drafts/issues/4434 */
float: right;
}
}
.toc-content {
padding-left: 30px;
padding-right: 40px;
}
div.main-container {
max-width: 1200px;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 85%;
}
@media (min-width: 768px) and (max-width: 991px) {
div.tocify {
width: 25%;
}
}
@media (max-width: 767px) {
div.tocify {
width: 100%;
max-width: none;
}
}
.tocify ul, .tocify li {
line-height: 20px;
}
.tocify-subheader .tocify-item {
font-size: 0.90em;
}
.tocify .list-group-item {
border-radius: 0px;
}
.tocify-subheader {
display: inline;
}
.tocify-subheader .tocify-item {
font-size: 0.95em;
}
</style>
</head>
<body>
<div class="container-fluid main-container">
<!-- setup 3col/9col grid for toc_float and main content -->
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
<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"></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fa fa-home"></span>
Home
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/knthompson26/social-isolation-ADHD-bidirectional-effects">
<span class="fa fa-github fa-lg"></span>
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div id="header">
<div class="btn-group pull-right float-right">
<button type="button" class="btn btn-default btn-xs btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" style="min-width: 50px;">
<li><a id="rmd-show-all-code" href="#">Show All Code</a></li>
<li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li>
</ul>
</div>
<h1 class="title toc-ignore">Sex differences in RI-CLPM for social isolation and ADHD symptoms in childhood</h1>
</div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>dat.raw <span class="ot"><-</span> <span class="fu">read_dta</span>(<span class="fu">paste0</span>(data.raw_path, <span class="st">"Katie_19Jan22.dta"</span>))</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat.raw <span class="sc">%>%</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="at">id =</span> atwinid,</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> sampsex,</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> seswq35,</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> sisoem5, <span class="co"># social isolation mother report</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> sisoem7,</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> sisoem10,</span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> sisoem12,</span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> sisoet5, <span class="co"># social isolation teacher report</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a> sisoet7, </span>
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a> sisoet10,</span>
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a> sisoet12,</span>
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a> sisoe5, <span class="co"># social isolation combined report</span></span>
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a> sisoe7, </span>
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a> sisoe10,</span>
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a> sisoe12,</span>
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a> tadhdem5, <span class="co"># total ADHD mother report</span></span>
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a> tadhdem7,</span>
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a> tadhdem10,</span>
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a> tadhdem12,</span>
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a> tadhdet5, <span class="co"># total ADHD teacher report</span></span>
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a> tadhdet7,</span>
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a> tadhdet10,</span>
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a> tadhdet12,</span>
<span id="cb1-27"><a href="#cb1-27" aria-hidden="true" tabindex="-1"></a> hyem5, <span class="co"># hyperactivity ADHD mother report</span></span>
<span id="cb1-28"><a href="#cb1-28" aria-hidden="true" tabindex="-1"></a> hyem7,</span>
<span id="cb1-29"><a href="#cb1-29" aria-hidden="true" tabindex="-1"></a> hyem10,</span>
<span id="cb1-30"><a href="#cb1-30" aria-hidden="true" tabindex="-1"></a> hyem12, </span>
<span id="cb1-31"><a href="#cb1-31" aria-hidden="true" tabindex="-1"></a> hyet5, <span class="co"># hyperactivity ADHD teacher report</span></span>
<span id="cb1-32"><a href="#cb1-32" aria-hidden="true" tabindex="-1"></a> hyet7,</span>
<span id="cb1-33"><a href="#cb1-33" aria-hidden="true" tabindex="-1"></a> hyet10,</span>
<span id="cb1-34"><a href="#cb1-34" aria-hidden="true" tabindex="-1"></a> hyet12,</span>
<span id="cb1-35"><a href="#cb1-35" aria-hidden="true" tabindex="-1"></a> inem5, <span class="co"># inattention ADHD mother report</span></span>
<span id="cb1-36"><a href="#cb1-36" aria-hidden="true" tabindex="-1"></a> inem7,</span>
<span id="cb1-37"><a href="#cb1-37" aria-hidden="true" tabindex="-1"></a> inem10,</span>
<span id="cb1-38"><a href="#cb1-38" aria-hidden="true" tabindex="-1"></a> inem12,</span>
<span id="cb1-39"><a href="#cb1-39" aria-hidden="true" tabindex="-1"></a> inet5, <span class="co"># inattention ADHD teacher report</span></span>
<span id="cb1-40"><a href="#cb1-40" aria-hidden="true" tabindex="-1"></a> inet7,</span>
<span id="cb1-41"><a href="#cb1-41" aria-hidden="true" tabindex="-1"></a> inet10,</span>
<span id="cb1-42"><a href="#cb1-42" aria-hidden="true" tabindex="-1"></a> inet12</span>
<span id="cb1-43"><a href="#cb1-43" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb1-44"><a href="#cb1-44" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-45"><a href="#cb1-45" aria-hidden="true" tabindex="-1"></a><span class="fu">colnames</span>(dat)</span></code></pre></div>
<p>[1] “id” “sampsex” “seswq35” “sisoem5” “sisoem7” “sisoem10” [7] “sisoem12” “sisoet5” “sisoet7” “sisoet10” “sisoet12” “sisoe5”<br />
[13] “sisoe7” “sisoe10” “sisoe12” “tadhdem5” “tadhdem7” “tadhdem10” [19] “tadhdem12” “tadhdet5” “tadhdet7” “tadhdet10” “tadhdet12” “hyem5”<br />
[25] “hyem7” “hyem10” “hyem12” “hyet5” “hyet7” “hyet10”<br />
[31] “hyet12” “inem5” “inem7” “inem10” “inem12” “inet5”<br />
[37] “inet7” “inet10” “inet12”</p>
<p>Functions</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Table of model fit </span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>table.model.fit <span class="ot"><-</span> <span class="cf">function</span>(model){</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> model.fit <span class="ot"><-</span> <span class="fu">as.data.frame</span>(<span class="fu">t</span>(<span class="fu">as.data.frame</span>(model<span class="sc">$</span>FIT))) <span class="sc">%>%</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(chisq, df, chisq.scaled, cfi.robust, tli.robust, aic, bic, bic2, rmsea.robust, rmsea.ci.lower.robust, rmsea.ci.upper.robust, srmr) <span class="co">#can only be used with "MLR" estimator</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(model.fit)</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="co"># Table of regression and correlation (standardised covariance) coefficients</span></span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a>table.model.coef <span class="ot"><-</span> <span class="cf">function</span>(model, sex, constraints){</span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (sex <span class="sc">==</span> <span class="st">"Male"</span> <span class="sc">&</span> constraints <span class="sc">==</span> <span class="st">"No"</span>){</span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> model.coef <span class="ot"><-</span> <span class="fu">as.tibble</span>(model<span class="sc">$</span>PE[<span class="fu">c</span>(<span class="dv">86</span><span class="sc">:</span><span class="dv">101</span>),]) <span class="sc">%>%</span> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>block, <span class="sc">-</span>group, <span class="sc">-</span>exo, <span class="sc">-</span>std.lv, <span class="sc">-</span>std.nox)</span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(model.coef)</span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> <span class="cf">if</span>(sex <span class="sc">==</span> <span class="st">"Female"</span> <span class="sc">&</span> constraints <span class="sc">==</span> <span class="st">"No"</span>){</span>
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> model.coef <span class="ot"><-</span> <span class="fu">as.tibble</span>(model<span class="sc">$</span>PE[<span class="fu">c</span>(<span class="dv">17</span><span class="sc">:</span><span class="dv">32</span>),]) <span class="sc">%>%</span> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>block, <span class="sc">-</span>group, <span class="sc">-</span>exo, <span class="sc">-</span>std.lv, <span class="sc">-</span>std.nox)</span>
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(model.coef)</span>
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> <span class="cf">if</span>(sex <span class="sc">==</span> <span class="st">"Male"</span> <span class="sc">&</span> constraints <span class="sc">==</span> <span class="st">"Yes"</span>){</span>
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a> model.coef <span class="ot"><-</span> <span class="fu">as.tibble</span>(model<span class="sc">$</span>PE[<span class="fu">c</span>(<span class="dv">86</span><span class="sc">:</span><span class="dv">101</span>),]) <span class="sc">%>%</span> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>block, <span class="sc">-</span>group, <span class="sc">-</span>exo, <span class="sc">-</span>label, <span class="sc">-</span>std.lv, <span class="sc">-</span>std.nox)</span>
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(model.coef)</span>
<span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> <span class="cf">if</span>(sex <span class="sc">==</span> <span class="st">"Female"</span> <span class="sc">&</span> constraints <span class="sc">==</span> <span class="st">"Yes"</span>){</span>
<span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a> model.coef <span class="ot"><-</span> <span class="fu">as.tibble</span>(model<span class="sc">$</span>PE[<span class="fu">c</span>(<span class="dv">17</span><span class="sc">:</span><span class="dv">32</span>),]) <span class="sc">%>%</span> dplyr<span class="sc">::</span><span class="fu">select</span>(<span class="sc">-</span>block, <span class="sc">-</span>group, <span class="sc">-</span>exo, <span class="sc">-</span>label, <span class="sc">-</span>std.lv, <span class="sc">-</span>std.nox)</span>
<span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(model.coef)</span>
<span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> {model.coef <span class="ot"><-</span> <span class="cn">NULL</span>}</span>
<span id="cb2-23"><a href="#cb2-23" aria-hidden="true" tabindex="-1"></a>}</span></code></pre></div>
<p>To check for group differences in parameter estimates between girls and boys (sex), we can run the same model but test group differences in the lavaan command.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="at">sex =</span> </span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">recode_factor</span>(<span class="fu">as_factor</span>(sampsex),</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="st">"1"</span> <span class="ot">=</span> <span class="st">"Male"</span>,</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="st">"2"</span> <span class="ot">=</span> <span class="st">"Female"</span>))</span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a><span class="fu">table</span>(dat<span class="sc">$</span>sex)</span></code></pre></div>
<p>Male Female 1092 1140</p>
<hr />
<div id="create-combined-adhd-variables" class="section level1">
<h1>Create combined ADHD variables</h1>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># age 5</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">tadhde5 =</span> </span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem5) <span class="sc">&</span> <span class="fu">is.na</span>(tadhdet5) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet5) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdet5),</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdet5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem5) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdem5),</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet5) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(tadhdem5,tadhdet5)))))</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="co"># age 7</span></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">tadhde7 =</span> </span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem7) <span class="sc">&</span> <span class="fu">is.na</span>(tadhdet7) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet7) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdet7),</span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdet7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem7) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdem7),</span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet7) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(tadhdem7,tadhdet7)))))</span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a><span class="co"># age 10</span></span>
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">tadhde10 =</span> </span>
<span id="cb4-22"><a href="#cb4-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb4-23"><a href="#cb4-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem10) <span class="sc">&</span> <span class="fu">is.na</span>(tadhdet10) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb4-24"><a href="#cb4-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet10) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdet10),</span>
<span id="cb4-25"><a href="#cb4-25" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdet10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem10) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdem10),</span>
<span id="cb4-26"><a href="#cb4-26" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet10) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(tadhdem10,tadhdet10)))))</span>
<span id="cb4-27"><a href="#cb4-27" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb4-28"><a href="#cb4-28" aria-hidden="true" tabindex="-1"></a><span class="co"># age 12</span></span>
<span id="cb4-29"><a href="#cb4-29" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb4-30"><a href="#cb4-30" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">tadhde12 =</span> </span>
<span id="cb4-31"><a href="#cb4-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb4-32"><a href="#cb4-32" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem12) <span class="sc">&</span> <span class="fu">is.na</span>(tadhdet12) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb4-33"><a href="#cb4-33" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdem12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet12) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdet12),</span>
<span id="cb4-34"><a href="#cb4-34" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(tadhdet12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem12) <span class="sc">~</span> <span class="fu">as.numeric</span>(tadhdem12),</span>
<span id="cb4-35"><a href="#cb4-35" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(tadhdem12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(tadhdet12) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(tadhdem12,tadhdet12)))))</span>
<span id="cb4-36"><a href="#cb4-36" aria-hidden="true" tabindex="-1"></a> )</span></code></pre></div>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># age 5</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">hye5 =</span> </span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem5) <span class="sc">&</span> <span class="fu">is.na</span>(hyet5) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet5) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyet5),</span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyet5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyem5) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyem5),</span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(hyem5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet5) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(hyem5,hyet5)))))</span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="co"># age 7</span></span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">hye7 =</span> </span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem7) <span class="sc">&</span> <span class="fu">is.na</span>(hyet7) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet7) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyet7),</span>
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyet7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyem7) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyem7),</span>
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(hyem7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet7) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(hyem7,hyet7)))))</span>
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a><span class="co"># age 10</span></span>
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">hye10 =</span> </span>
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem10) <span class="sc">&</span> <span class="fu">is.na</span>(hyet10) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet10) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyet10),</span>
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyet10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyem10) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyem10),</span>
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(hyem10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet10) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(hyem10,hyet10)))))</span>
<span id="cb5-27"><a href="#cb5-27" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb5-28"><a href="#cb5-28" aria-hidden="true" tabindex="-1"></a><span class="co"># age 12</span></span>
<span id="cb5-29"><a href="#cb5-29" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb5-30"><a href="#cb5-30" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">hye12 =</span> </span>
<span id="cb5-31"><a href="#cb5-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb5-32"><a href="#cb5-32" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem12) <span class="sc">&</span> <span class="fu">is.na</span>(hyet12) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb5-33"><a href="#cb5-33" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyem12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet12) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyet12),</span>
<span id="cb5-34"><a href="#cb5-34" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(hyet12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyem12) <span class="sc">~</span> <span class="fu">as.numeric</span>(hyem12),</span>
<span id="cb5-35"><a href="#cb5-35" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(hyem12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(hyet12) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(hyem12,hyet12)))))</span>
<span id="cb5-36"><a href="#cb5-36" aria-hidden="true" tabindex="-1"></a> )</span></code></pre></div>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co"># age 5</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">ine5 =</span> </span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem5) <span class="sc">&</span> <span class="fu">is.na</span>(inet5) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet5) <span class="sc">~</span> <span class="fu">as.numeric</span>(inet5),</span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inet5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inem5) <span class="sc">~</span> <span class="fu">as.numeric</span>(inem5),</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(inem5) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet5) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(inem5,inet5)))))</span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a><span class="co"># age 7</span></span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">ine7 =</span> </span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem7) <span class="sc">&</span> <span class="fu">is.na</span>(inet7) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet7) <span class="sc">~</span> <span class="fu">as.numeric</span>(inet7),</span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inet7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inem7) <span class="sc">~</span> <span class="fu">as.numeric</span>(inem7),</span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(inem7) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet7) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(inem7,inet7)))))</span>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a><span class="co"># age 10</span></span>
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">ine10 =</span> </span>
<span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb6-23"><a href="#cb6-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem10) <span class="sc">&</span> <span class="fu">is.na</span>(inet10) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb6-24"><a href="#cb6-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet10) <span class="sc">~</span> <span class="fu">as.numeric</span>(inet10),</span>
<span id="cb6-25"><a href="#cb6-25" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inet10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inem10) <span class="sc">~</span> <span class="fu">as.numeric</span>(inem10),</span>
<span id="cb6-26"><a href="#cb6-26" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(inem10) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet10) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(inem10,inet10)))))</span>
<span id="cb6-27"><a href="#cb6-27" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb6-28"><a href="#cb6-28" aria-hidden="true" tabindex="-1"></a><span class="co"># age 12</span></span>
<span id="cb6-29"><a href="#cb6-29" aria-hidden="true" tabindex="-1"></a>dat <span class="ot"><-</span> dat <span class="sc">%>%</span></span>
<span id="cb6-30"><a href="#cb6-30" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">ine12 =</span> </span>
<span id="cb6-31"><a href="#cb6-31" aria-hidden="true" tabindex="-1"></a> <span class="fu">case_when</span>(</span>
<span id="cb6-32"><a href="#cb6-32" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem12) <span class="sc">&</span> <span class="fu">is.na</span>(inet12) <span class="sc">~</span> <span class="cn">NA_real_</span>,</span>
<span id="cb6-33"><a href="#cb6-33" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inem12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet12) <span class="sc">~</span> <span class="fu">as.numeric</span>(inet12),</span>
<span id="cb6-34"><a href="#cb6-34" aria-hidden="true" tabindex="-1"></a> <span class="fu">is.na</span>(inet12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inem12) <span class="sc">~</span> <span class="fu">as.numeric</span>(inem12),</span>
<span id="cb6-35"><a href="#cb6-35" aria-hidden="true" tabindex="-1"></a> <span class="sc">!</span><span class="fu">is.na</span>(inem12) <span class="sc">&</span> <span class="sc">!</span><span class="fu">is.na</span>(inet12) <span class="sc">~</span> <span class="fu">as.numeric</span>(<span class="fu">rowMeans</span>(<span class="fu">across</span>(<span class="at">.cols =</span> <span class="fu">c</span>(inem12,inet12)))))</span>
<span id="cb6-36"><a href="#cb6-36" aria-hidden="true" tabindex="-1"></a> )</span></code></pre></div>
<hr />
</div>
<div id="constrained-models" class="section level1">
<h1>Constrained models</h1>
<p>In the script “RICLPM_isolation_adhd.Rmd” and “RICLPMcomb_isolation_adhd.Rmd”, we decided that combined and mother report models will be constrained to have equal cross lags onlly, and teacher report models will be constrained to have equal autoregressive and crosslags.</p>
<p>Here, we will apply sex difference testing to each of these reporter models.</p>
<p>All models are using robust test statistics and standard errors.</p>
<table>
<colgroup>
<col width="58%" />
<col width="41%" />
</colgroup>
<thead>
<tr class="header">
<th>Model</th>
<th>Sex differences</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Combined report, total ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="even">
<td>Combined report, hyperactivity ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="odd">
<td>Combined report, inattention ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="even">
<td>Mother report, total ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="odd">
<td>Mother report, hyperactivity ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="even">
<td>Mother report, inattention ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="odd">
<td>Teacher report, total ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="even">
<td>Teacher report, hyperactivity ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
<tr class="odd">
<td>Teacher report, inattention ADHD symptoms</td>
<td>No significant sex differences</td>
</tr>
</tbody>
</table>
<p>Imposing constraints to the model can be achieved through <strong>pre-multiplication</strong>. It means that we have to prepend the number that we want to fix the parameter to, and an asterisk, to the parameter in the model specification. For example, <code>F =~ 0*x1</code> fixes the factor loading of item <code>x1</code> to factor <code>F</code> to 0. Using pre-multiplication we can also constrain parameters to be the same by giving them the same label. Below we specify an RI-CLPM with the following constraints:</p>
<p>Naming: a = lag in ad b = lag in si c = cross lag ad->si d = cross lag si->ad</p>
<p>sex.c = sex differences in constrained model lag.c = lag constrained model sex.lag.c = sex and lag constrained model</p>
<p>We will text for sex differences in two steps: 1) Estimate a model where constraints are applied across lags but not for each of the groups (female/male) 2) Estimate a model where constraints are applied across both lags and the groups (female/male)</p>
<p>An example of the constraining: For lag c, I have constrained each lag to be set to c1 for females and c2 for males. They layout for group specification is c(group 1, group 2). This provides the same estimates across each lag, but that they differ for girls and boys.</p>
<div id="combined-report" class="section level2">
<h2>Combined report</h2>
<div id="total-adhd" class="section level3">
<h3>Total ADHD</h3>
<div class="sourceCode" id="cb7"><pre class="sourceCode r fold-show"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.lag.c <span class="ot"><-</span> <span class="st">'</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="st"> # Create beween components (random intercepts treated as factors here)</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad =~ 1*tadhde5 + 1*tadhde7 + 1*tadhde10 + 1*tadhde12 #x</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="st"> RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="st"> # Create within-person centered variables</span></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 =~ 1*tadhde5</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 =~ 1*tadhde7</span></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 =~ 1*tadhde10 </span></span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 =~ 1*tadhde12</span></span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi5 =~ 1*sisoe5</span></span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 =~ 1*sisoe7</span></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 =~ 1*sisoe10</span></span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 =~ 1*sisoe12</span></span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a><span class="st"> # Constrained lagged effects beween the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across lags (all lags constrained). We want to constrain c and d lags but free the autoregressive lags. Variables without notation are freely estimated across sexes.</span></span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~ wad5 + c(d1, d2)*wsi5 </span></span>
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 ~ c(c1, c2)*wad5 + wsi5</span></span>
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~ wad7 + c(d1, d2)*wsi7</span></span>
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 ~ c(c1,c2)*wad7 + wsi7</span></span>
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~ wad10 + c(d1,d2)*wsi10</span></span>
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 ~ c(c1,c2)*wad10 + wsi10</span></span>
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the covariance beween the within-person centered variables at the first wave</span></span>
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 ~~ wsi5 # Covariance</span></span>
<span id="cb7-28"><a href="#cb7-28" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb7-29"><a href="#cb7-29" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the covariances beween the residuals of the within-person centered variables (the innovations)</span></span>
<span id="cb7-30"><a href="#cb7-30" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~~ wsi7</span></span>
<span id="cb7-31"><a href="#cb7-31" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~~ wsi10</span></span>
<span id="cb7-32"><a href="#cb7-32" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~~ wsi12</span></span>
<span id="cb7-33"><a href="#cb7-33" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb7-34"><a href="#cb7-34" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the variance and covariance of the random intercepts</span></span>
<span id="cb7-35"><a href="#cb7-35" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad ~~ RIad</span></span>
<span id="cb7-36"><a href="#cb7-36" aria-hidden="true" tabindex="-1"></a><span class="st"> RIsi ~~ RIsi</span></span>
<span id="cb7-37"><a href="#cb7-37" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad ~~ RIsi</span></span>
<span id="cb7-38"><a href="#cb7-38" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb7-39"><a href="#cb7-39" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the (residual) variance of the within-person centered variables.</span></span>
<span id="cb7-40"><a href="#cb7-40" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 ~~ wad5 # Variances</span></span>
<span id="cb7-41"><a href="#cb7-41" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi5 ~~ wsi5 </span></span>
<span id="cb7-42"><a href="#cb7-42" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~~ wad7 # Residual variances</span></span>
<span id="cb7-43"><a href="#cb7-43" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 ~~ wsi7 </span></span>
<span id="cb7-44"><a href="#cb7-44" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~~ wad10 </span></span>
<span id="cb7-45"><a href="#cb7-45" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 ~~ wsi10 </span></span>
<span id="cb7-46"><a href="#cb7-46" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~~ wad12 </span></span>
<span id="cb7-47"><a href="#cb7-47" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 ~~ wsi12</span></span>
<span id="cb7-48"><a href="#cb7-48" aria-hidden="true" tabindex="-1"></a><span class="st">'</span></span></code></pre></div>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.lag.c.fit <span class="ot"><-</span> <span class="fu">lavaan</span>(RICLPMcomb.lag.c, </span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> dat, </span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="at">missing =</span> <span class="st">'ML'</span>, </span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="st">"sex"</span>,</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a> <span class="at">meanstructure =</span> <span class="cn">TRUE</span>, </span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a> <span class="at">int.ov.free =</span> <span class="cn">TRUE</span>,</span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a> <span class="at">se =</span> <span class="st">"robust"</span>,</span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a> <span class="at">estimator =</span> <span class="st">"MLR"</span> <span class="co">#maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic</span></span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true" tabindex="-1"></a> ) </span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-11"><a href="#cb8-11" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.lag.c.fit.summary <span class="ot"><-</span> <span class="fu">summary</span>(RICLPMcomb.lag.c.fit,</span>
<span id="cb8-12"><a href="#cb8-12" aria-hidden="true" tabindex="-1"></a> <span class="at">fit.measures =</span> <span class="cn">TRUE</span>,</span>
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true" tabindex="-1"></a> <span class="at">standardized =</span> <span class="cn">TRUE</span>)</span></code></pre></div>
<p>lavaan 0.6-10 ended normally after 161 iterations</p>
<p>Estimator ML Optimization method NLMINB Number of model parameters 70 Number of equality constraints 8</p>
<p>Number of observations per group:<br />
Female 1140 Male 1092 Number of missing patterns per group:<br />
Female 7 Male 9</p>
<p>Model Test User Model: Standard Robust Test Statistic 93.253 56.699 Degrees of freedom 26 26 P-value (Chi-square) 0.000 0.000 Scaling correction factor 1.645 Yuan-Bentler correction (Mplus variant)<br />
Test statistic for each group: Female 29.825 18.134 Male 63.428 38.565</p>
<p>Model Test Baseline Model:</p>
<p>Test statistic 6220.595 3142.297 Degrees of freedom 56 56 P-value 0.000 0.000 Scaling correction factor 1.980</p>
<p>User Model versus Baseline Model:</p>
<p>Comparative Fit Index (CFI) 0.989 0.990 Tucker-Lewis Index (TLI) 0.977 0.979</p>
<p>Robust Comparative Fit Index (CFI) 0.992 Robust Tucker-Lewis Index (TLI) 0.982</p>
<p>Loglikelihood and Information Criteria:</p>
<p>Loglikelihood user model (H0) -31415.294 -31415.294 Scaling correction factor 2.355 for the MLR correction<br />
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 2.359 for the MLR correction</p>
<p>Akaike (AIC) 62954.587 62954.587 Bayesian (BIC) 63308.648 63308.648 Sample-size adjusted Bayesian (BIC) 63111.664 63111.664</p>
<p>Root Mean Square Error of Approximation:</p>
<p>RMSEA 0.048 0.033 90 Percent confidence interval - lower 0.038 0.024 90 Percent confidence interval - upper 0.059 0.042 P-value RMSEA <= 0.05 0.594 1.000</p>
<p>Robust RMSEA 0.042 90 Percent confidence interval - lower 0.027 90 Percent confidence interval - upper 0.057</p>
<p>Standardized Root Mean Square Residual:</p>
<p>SRMR 0.034 0.034</p>
<p>Parameter Estimates:</p>
<p>Standard errors Sandwich Information bread Observed Observed information based on Hessian</p>
<p>Group 1 [Female]:</p>
<p>Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~<br />
tadhde5 1.000 1.497 0.611 tadhde7 1.000 1.497 0.710 tadhde10 1.000 1.497 0.737 tadhde12 1.000 1.497 0.697 RIsi =~<br />
sisoe5 1.000 0.620 0.595 sisoe7 1.000 0.620 0.572 sisoe10 1.000 0.620 0.510 sisoe12 1.000 0.620 0.494 wad5 =~<br />
tadhde5 1.000 1.939 0.792 wad7 =~<br />
tadhde7 1.000 1.483 0.704 wad10 =~<br />
tadhde10 1.000 1.372 0.676 wad12 =~<br />
tadhde12 1.000 1.539 0.717 wsi5 =~<br />
sisoe5 1.000 0.837 0.804 wsi7 =~<br />
sisoe7 1.000 0.888 0.820 wsi10 =~<br />
sisoe10 1.000 1.044 0.860 wsi12 =~<br />
sisoe12 1.000 1.091 0.870</p>
<p>Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~<br />
wad5 0.226 0.054 4.155 0.000 0.295 0.295 wsi5 (d1) -0.006 0.065 -0.086 0.932 -0.003 -0.003 wsi7 ~<br />
wad5 (c1) 0.029 0.021 1.368 0.171 0.063 0.063 wsi5 0.173 0.077 2.245 0.025 0.163 0.163 wad10 ~<br />
wad7 0.040 0.104 0.381 0.704 0.043 0.043 wsi7 (d1) -0.006 0.065 -0.086 0.932 -0.004 -0.004 wsi10 ~<br />
wad7 (c1) 0.029 0.021 1.368 0.171 0.041 0.041 wsi7 0.259 0.067 3.851 0.000 0.220 0.220 wad12 ~<br />
wad10 0.389 0.108 3.591 0.000 0.346 0.346 wsi10 (d1) -0.006 0.065 -0.086 0.932 -0.004 -0.004 wsi12 ~<br />
wad10 (c1) 0.029 0.021 1.368 0.171 0.037 0.037 wsi10 0.421 0.053 7.878 0.000 0.403 0.403</p>
<p>Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~<br />
wsi5 0.400 0.101 3.964 0.000 0.247 0.247 .wad7 ~~<br />
.wsi7 0.247 0.115 2.158 0.031 0.200 0.200 .wad10 ~~<br />
.wsi10 0.339 0.089 3.816 0.000 0.244 0.244 .wad12 ~~<br />
.wsi12 0.249 0.082 3.041 0.002 0.174 0.174 RIad ~~<br />
RIsi 0.500 0.100 5.008 0.000 0.539 0.539</p>
<p>Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhde5 1.851 0.072 25.552 0.000 1.851 0.756 .tadhde7 1.388 0.064 21.842 0.000 1.388 0.658 .tadhde10 1.077 0.061 17.708 0.000 1.077 0.530 .tadhde12 1.058 0.065 16.400 0.000 1.058 0.493 .sisoe5 0.746 0.031 24.409 0.000 0.746 0.716 .sisoe7 0.760 0.032 23.389 0.000 0.760 0.702 .sisoe10 0.874 0.037 23.704 0.000 0.874 0.720 .sisoe12 0.869 0.038 22.750 0.000 0.869 0.693 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000</p>
<p>Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 2.242 0.301 7.439 0.000 1.000 1.000 RIsi 0.384 0.069 5.527 0.000 1.000 1.000 wad5 3.760 0.402 9.344 0.000 1.000 1.000 wsi5 0.700 0.096 7.326 0.000 1.000 1.000 .wad7 2.010 0.300 6.693 0.000 0.913 0.913 .wsi7 0.760 0.079 9.645 0.000 0.964 0.964 .wad10 1.878 0.395 4.757 0.000 0.998 0.998 .wsi10 1.031 0.108 9.564 0.000 0.946 0.946 .wad12 2.086 0.287 7.264 0.000 0.881 0.881 .wsi12 0.988 0.102 9.715 0.000 0.830 0.830 .tadhde5 0.000 0.000 0.000 .tadhde7 0.000 0.000 0.000 .tadhde10 0.000 0.000 0.000 .tadhde12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000</p>
<p>Group 2 [Male]:</p>
<p>Latent Variables: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad =~<br />
tadhde5 1.000 1.953 0.641 tadhde7 1.000 1.953 0.675 tadhde10 1.000 1.953 0.700 tadhde12 1.000 1.953 0.692 RIsi =~<br />
sisoe5 1.000 0.737 0.592 sisoe7 1.000 0.737 0.588 sisoe10 1.000 0.737 0.544 sisoe12 1.000 0.737 0.506 wad5 =~<br />
tadhde5 1.000 2.341 0.768 wad7 =~<br />
tadhde7 1.000 2.137 0.738 wad10 =~<br />
tadhde10 1.000 1.995 0.715 wad12 =~<br />
tadhde12 1.000 2.036 0.722 wsi5 =~<br />
sisoe5 1.000 1.002 0.806 wsi7 =~<br />
sisoe7 1.000 1.013 0.809 wsi10 =~<br />
sisoe10 1.000 1.135 0.839 wsi12 =~<br />
sisoe12 1.000 1.254 0.862</p>
<p>Regressions: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad7 ~<br />
wad5 0.208 0.055 3.802 0.000 0.228 0.228 wsi5 (d2) 0.133 0.094 1.419 0.156 0.062 0.062 wsi7 ~<br />
wad5 (c2) 0.039 0.020 1.964 0.050 0.090 0.090 wsi5 0.241 0.082 2.939 0.003 0.239 0.239 wad10 ~<br />
wad7 0.093 0.076 1.215 0.224 0.099 0.099 wsi7 (d2) 0.133 0.094 1.419 0.156 0.067 0.067 wsi10 ~<br />
wad7 (c2) 0.039 0.020 1.964 0.050 0.074 0.074 wsi7 0.276 0.084 3.283 0.001 0.246 0.246 wad12 ~<br />
wad10 0.191 0.085 2.258 0.024 0.187 0.187 wsi10 (d2) 0.133 0.094 1.419 0.156 0.074 0.074 wsi12 ~<br />
wad10 (c2) 0.039 0.020 1.964 0.050 0.062 0.062 wsi10 0.436 0.061 7.097 0.000 0.395 0.395</p>
<p>Covariances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all wad5 ~~<br />
wsi5 0.718 0.198 3.637 0.000 0.306 0.306 .wad7 ~~<br />
.wsi7 0.522 0.145 3.600 0.000 0.260 0.260 .wad10 ~~<br />
.wsi10 0.715 0.164 4.353 0.000 0.332 0.332 .wad12 ~~<br />
.wsi12 0.746 0.151 4.949 0.000 0.330 0.330 RIad ~~<br />
RIsi 0.750 0.112 6.722 0.000 0.521 0.521</p>
<p>Intercepts: Estimate Std.Err z-value P(>|z|) Std.lv Std.all .tadhde5 2.667 0.091 29.324 0.000 2.667 0.875 .tadhde7 2.255 0.090 25.138 0.000 2.255 0.779 .tadhde10 2.075 0.085 24.277 0.000 2.075 0.743 .tadhde12 1.868 0.087 21.420 0.000 1.868 0.662 .sisoe5 0.883 0.037 23.782 0.000 0.883 0.710 .sisoe7 0.906 0.038 23.570 0.000 0.906 0.723 .sisoe10 1.008 0.042 24.012 0.000 1.008 0.745 .sisoe12 1.015 0.045 22.523 0.000 1.015 0.698 RIad 0.000 0.000 0.000 RIsi 0.000 0.000 0.000 wad5 0.000 0.000 0.000 .wad7 0.000 0.000 0.000 .wad10 0.000 0.000 0.000 .wad12 0.000 0.000 0.000 wsi5 0.000 0.000 0.000 .wsi7 0.000 0.000 0.000 .wsi10 0.000 0.000 0.000 .wsi12 0.000 0.000 0.000</p>
<p>Variances: Estimate Std.Err z-value P(>|z|) Std.lv Std.all RIad 3.813 0.349 10.913 0.000 1.000 1.000 RIsi 0.543 0.092 5.871 0.000 1.000 1.000 wad5 5.479 0.496 11.038 0.000 1.000 1.000 wsi5 1.005 0.181 5.557 0.000 1.000 1.000 .wad7 4.271 0.389 10.991 0.000 0.935 0.935 .wsi7 0.945 0.120 7.845 0.000 0.922 0.922 .wad10 3.906 0.467 8.358 0.000 0.982 0.982 .wsi10 1.190 0.119 9.989 0.000 0.923 0.923 .wad12 3.938 0.431 9.140 0.000 0.950 0.950 .wsi12 1.294 0.130 9.982 0.000 0.823 0.823 .tadhde5 0.000 0.000 0.000 .tadhde7 0.000 0.000 0.000 .tadhde10 0.000 0.000 0.000 .tadhde12 0.000 0.000 0.000 .sisoe5 0.000 0.000 0.000 .sisoe7 0.000 0.000 0.000 .sisoe10 0.000 0.000 0.000 .sisoe12 0.000 0.000 0.000</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co">#Table of model fit </span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.lag.c.fit.summary.fit <span class="ot"><-</span> <span class="fu">table.model.fit</span>(RICLPMcomb.lag.c.fit.summary)</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Table of regression and correlation (standardised covariances) coefficients</span></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.lag.c.fit.summary.reg.female <span class="ot"><-</span> <span class="fu">table.model.coef</span>(RICLPMcomb.lag.c.fit.summary, <span class="at">sex =</span> <span class="st">"Female"</span>, <span class="at">constraints =</span> <span class="st">"Yes"</span>)</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.lag.c.fit.summary.reg.male <span class="ot"><-</span> <span class="fu">table.model.coef</span>(RICLPMcomb.lag.c.fit.summary, <span class="at">sex =</span> <span class="st">"Male"</span>, <span class="at">constraints =</span> <span class="st">"Yes"</span>)</span></code></pre></div>
<div class="sourceCode" id="cb10"><pre class="sourceCode r fold-show"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.sex.lag.c <span class="ot"><-</span> <span class="st">'</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="st"> # Create beween components (random intercepts treated as factors here)</span></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad =~ 1*tadhde5 + 1*tadhde7 + 1*tadhde10 + 1*tadhde12 #x</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="st"> RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y</span></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a><span class="st"> # Create within-person centered variables</span></span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 =~ 1*tadhde5</span></span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 =~ 1*tadhde7</span></span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 =~ 1*tadhde10 </span></span>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 =~ 1*tadhde12</span></span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi5 =~ 1*sisoe5</span></span>
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 =~ 1*sisoe7</span></span>
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 =~ 1*sisoe10</span></span>
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 =~ 1*sisoe12</span></span>
<span id="cb10-15"><a href="#cb10-15" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-16"><a href="#cb10-16" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the lagged effects beween the within-person centered variables. a and b parameters are constrained to be the same across the groups c(females, males), but are different across the lags. c and d parameters are the same across lag and group. </span></span>
<span id="cb10-17"><a href="#cb10-17" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~ c(a1, a1)*wad5 + c(d, d)*wsi5</span></span>
<span id="cb10-18"><a href="#cb10-18" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 ~ c(c, c)*wad5 + c(b1, b1)*wsi5</span></span>
<span id="cb10-19"><a href="#cb10-19" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-20"><a href="#cb10-20" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~ c(a2, a2)*wad7 + c(d, d)*wsi7</span></span>
<span id="cb10-21"><a href="#cb10-21" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 ~ c(c, c)*wad7 + c(b2, b2)*wsi7</span></span>
<span id="cb10-22"><a href="#cb10-22" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-23"><a href="#cb10-23" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~ c(a3, a3)*wad10 + c(d, d)*wsi10</span></span>
<span id="cb10-24"><a href="#cb10-24" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 ~ c(c, c)*wad10 + c(b3, b3)*wsi10 </span></span>
<span id="cb10-25"><a href="#cb10-25" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-26"><a href="#cb10-26" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the covariance beween the within-person centered variables at the first wave</span></span>
<span id="cb10-27"><a href="#cb10-27" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 ~~ wsi5 # Covariance</span></span>
<span id="cb10-28"><a href="#cb10-28" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-29"><a href="#cb10-29" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the covariances beween the residuals of the within-person centered variables (the innovations)</span></span>
<span id="cb10-30"><a href="#cb10-30" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~~ wsi7</span></span>
<span id="cb10-31"><a href="#cb10-31" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~~ wsi10</span></span>
<span id="cb10-32"><a href="#cb10-32" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~~ wsi12</span></span>
<span id="cb10-33"><a href="#cb10-33" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-34"><a href="#cb10-34" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the variance and covariance of the random intercepts</span></span>
<span id="cb10-35"><a href="#cb10-35" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad ~~ RIad</span></span>
<span id="cb10-36"><a href="#cb10-36" aria-hidden="true" tabindex="-1"></a><span class="st"> RIsi ~~ RIsi</span></span>
<span id="cb10-37"><a href="#cb10-37" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad ~~ RIsi</span></span>
<span id="cb10-38"><a href="#cb10-38" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb10-39"><a href="#cb10-39" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the (residual) variance of the within-person centered variables.</span></span>
<span id="cb10-40"><a href="#cb10-40" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 ~~ wad5 # Variances</span></span>
<span id="cb10-41"><a href="#cb10-41" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi5 ~~ wsi5 </span></span>
<span id="cb10-42"><a href="#cb10-42" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~~ wad7 # Residual variances</span></span>
<span id="cb10-43"><a href="#cb10-43" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 ~~ wsi7 </span></span>
<span id="cb10-44"><a href="#cb10-44" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~~ wad10 </span></span>
<span id="cb10-45"><a href="#cb10-45" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 ~~ wsi10 </span></span>
<span id="cb10-46"><a href="#cb10-46" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~~ wad12 </span></span>
<span id="cb10-47"><a href="#cb10-47" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 ~~ wsi12</span></span>
<span id="cb10-48"><a href="#cb10-48" aria-hidden="true" tabindex="-1"></a><span class="st">'</span></span></code></pre></div>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>RICLPMcomb.sex.lag.c.fit <span class="ot"><-</span> <span class="fu">lavaan</span>(RICLPMcomb.sex.lag.c, </span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> dat, </span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="at">missing =</span> <span class="st">'ML'</span>, </span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="st">"sex"</span>,</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="at">meanstructure =</span> <span class="cn">TRUE</span>, </span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="at">int.ov.free =</span> <span class="cn">TRUE</span>,</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> <span class="at">se =</span> <span class="st">"robust"</span>,</span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="at">estimator =</span> <span class="st">"MLR"</span> <span class="co">#maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic</span></span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> ) </span></code></pre></div>
<p>Now we see if there is a significantly worse fit when the lagged-parameers are constrained to be equal across groups.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">lavTestLRT</span>(RICLPMcomb.lag.c.fit, RICLPMcomb.sex.lag.c.fit, <span class="at">mehod =</span> <span class="st">"satorra.bentler.2010"</span>)</span></code></pre></div>
<div data-pagedtable="false">
<script data-pagedtable-source type="application/json">
{"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["Df"],"name":[1],"type":["int"],"align":["right"]},{"label":["AIC"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["BIC"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["Chisq"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["Chisq diff"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["Df diff"],"name":[6],"type":["int"],"align":["right"]},{"label":["Pr(>Chisq)"],"name":[7],"type":["dbl"],"align":["right"]}],"data":[{"1":"26","2":"62954.59","3":"63308.65","4":"93.25346","5":"NA","6":"NA","7":"NA","_rn_":"RICLPMcomb.lag.c.fit"},{"1":"34","2":"62954.09","3":"63262.47","4":"108.75971","5":"6.759571","6":"8","7":"0.5627814","_rn_":"RICLPMcomb.sex.lag.c.fit"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
<p>The chi-square difference test of these two nested models is <em>NON significant</em> (p=0.5628). <strong>Therefore, we conclude there are no sex differences in the constrained RICLPM combined report, total ADHD symptoms.</strong></p>
</div>
<div id="hyperactivity-symptoms" class="section level3">
<h3>Hyperactivity symptoms</h3>
<div class="sourceCode" id="cb13"><pre class="sourceCode r fold-show"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>RICLPMcomb_hyp.lag.c <span class="ot"><-</span> <span class="st">'</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="st"> # Create beween components (random intercepts treated as factors here)</span></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad =~ 1*hye5 + 1*hye7 + 1*hye10 + 1*hye12 #x</span></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="st"> RIsi =~ 1*sisoe5 + 1*sisoe7 + 1*sisoe10 + 1*sisoe12 #y</span></span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a><span class="st"> # Create within-person centered variables</span></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 =~ 1*hye5</span></span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 =~ 1*hye7</span></span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 =~ 1*hye10 </span></span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 =~ 1*hye12</span></span>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi5 =~ 1*sisoe5</span></span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 =~ 1*sisoe7</span></span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 =~ 1*sisoe10</span></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 =~ 1*sisoe12</span></span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true" tabindex="-1"></a><span class="st"> # Constrained lagged effects beween the within-person centered variables. c(group1/females, group2/males) - different values across groups, but the same values within groups and across cross lags.</span></span>
<span id="cb13-17"><a href="#cb13-17" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~ wad5 + c(d1, d2)*wsi5 </span></span>
<span id="cb13-18"><a href="#cb13-18" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 ~ c(c1, c2)*wad5 + wsi5</span></span>
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~ wad7 + c(d1, d2)*wsi7</span></span>
<span id="cb13-21"><a href="#cb13-21" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 ~ c(c1,c2)*wad7 + wsi7</span></span>
<span id="cb13-22"><a href="#cb13-22" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-23"><a href="#cb13-23" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~ wad10 + c(d1,d2)*wsi10</span></span>
<span id="cb13-24"><a href="#cb13-24" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 ~ c(c1,c2)*wad10 + wsi10</span></span>
<span id="cb13-25"><a href="#cb13-25" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-26"><a href="#cb13-26" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the covariance beween the within-person centered variables at the first wave</span></span>
<span id="cb13-27"><a href="#cb13-27" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 ~~ wsi5 # Covariance</span></span>
<span id="cb13-28"><a href="#cb13-28" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-29"><a href="#cb13-29" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the covariances beween the residuals of the within-person centered variables (the innovations)</span></span>
<span id="cb13-30"><a href="#cb13-30" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~~ wsi7</span></span>
<span id="cb13-31"><a href="#cb13-31" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~~ wsi10</span></span>
<span id="cb13-32"><a href="#cb13-32" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~~ wsi12</span></span>
<span id="cb13-33"><a href="#cb13-33" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-34"><a href="#cb13-34" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the variance and covariance of the random intercepts</span></span>
<span id="cb13-35"><a href="#cb13-35" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad ~~ RIad</span></span>
<span id="cb13-36"><a href="#cb13-36" aria-hidden="true" tabindex="-1"></a><span class="st"> RIsi ~~ RIsi</span></span>
<span id="cb13-37"><a href="#cb13-37" aria-hidden="true" tabindex="-1"></a><span class="st"> RIad ~~ RIsi</span></span>
<span id="cb13-38"><a href="#cb13-38" aria-hidden="true" tabindex="-1"></a><span class="st"> </span></span>
<span id="cb13-39"><a href="#cb13-39" aria-hidden="true" tabindex="-1"></a><span class="st"> # Estimate the (residual) variance of the within-person centered variables.</span></span>
<span id="cb13-40"><a href="#cb13-40" aria-hidden="true" tabindex="-1"></a><span class="st"> wad5 ~~ wad5 # Variances</span></span>
<span id="cb13-41"><a href="#cb13-41" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi5 ~~ wsi5 </span></span>
<span id="cb13-42"><a href="#cb13-42" aria-hidden="true" tabindex="-1"></a><span class="st"> wad7 ~~ wad7 # Residual variances</span></span>
<span id="cb13-43"><a href="#cb13-43" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi7 ~~ wsi7 </span></span>
<span id="cb13-44"><a href="#cb13-44" aria-hidden="true" tabindex="-1"></a><span class="st"> wad10 ~~ wad10 </span></span>
<span id="cb13-45"><a href="#cb13-45" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi10 ~~ wsi10 </span></span>
<span id="cb13-46"><a href="#cb13-46" aria-hidden="true" tabindex="-1"></a><span class="st"> wad12 ~~ wad12 </span></span>
<span id="cb13-47"><a href="#cb13-47" aria-hidden="true" tabindex="-1"></a><span class="st"> wsi12 ~~ wsi12</span></span>
<span id="cb13-48"><a href="#cb13-48" aria-hidden="true" tabindex="-1"></a><span class="st">'</span></span></code></pre></div>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>RICLPMcomb_hyp.lag.c.fit <span class="ot"><-</span> <span class="fu">lavaan</span>(RICLPMcomb_hyp.lag.c, </span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="at">data =</span> dat, </span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> <span class="at">missing =</span> <span class="st">'ML'</span>, </span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="st">"sex"</span>,</span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> <span class="at">meanstructure =</span> <span class="cn">TRUE</span>, </span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a> <span class="at">int.ov.free =</span> <span class="cn">TRUE</span>,</span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a> <span class="at">se =</span> <span class="st">"robust"</span>,</span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a> <span class="at">estimator =</span> <span class="st">"MLR"</span> <span class="co">#maximum likelihood with robust (Huber-White) standard errors and a scaled (Yuan-Bentler) and robust test statistic</span></span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a> ) </span>
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a>RICLPMcomb_hyp.lag.c.fit.summary <span class="ot"><-</span> <span class="fu">summary</span>(RICLPMcomb_hyp.lag.c.fit,</span>
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a> <span class="at">fit.measures =</span> <span class="cn">TRUE</span>,</span>
<span id="cb14-13"><a href="#cb14-13" aria-hidden="true" tabindex="-1"></a> <span class="at">standardized =</span> <span class="cn">TRUE</span>)</span></code></pre></div>
<p>lavaan 0.6-10 ended normally after 61 iterations</p>
<p>Estimator ML Optimization method NLMINB Number of model parameters 70 Number of equality constraints 8</p>
<p>Number of observations per group:<br />
Female 1140 Male 1092 Number of missing patterns per group:<br />
Female 7 Male 9</p>
<p>Model Test User Model: Standard Robust Test Statistic 71.082 45.700 Degrees of freedom 26 26 P-value (Chi-square) 0.000 0.010 Scaling correction factor 1.555 Yuan-Bentler correction (Mplus variant)<br />
Test statistic for each group: Female 24.870 15.989 Male 46.212 29.711</p>
<p>Model Test Baseline Model:</p>
<p>Test statistic 5615.686 3028.921 Degrees of freedom 56 56 P-value 0.000 0.000 Scaling correction factor 1.854</p>
<p>User Model versus Baseline Model:</p>
<p>Comparative Fit Index (CFI) 0.992 0.993 Tucker-Lewis Index (TLI) 0.983 0.986</p>
<p>Robust Comparative Fit Index (CFI) 0.994 Robust Tucker-Lewis Index (TLI) 0.988</p>
<p>Loglikelihood and Information Criteria:</p>
<p>Loglikelihood user model (H0) -26900.182 -26900.182 Scaling correction factor 2.213 for the MLR correction<br />
Loglikelihood unrestricted model (H1) NA NA Scaling correction factor 2.220 for the MLR correction</p>
<p>Akaike (AIC) 53924.364 53924.364 Bayesian (BIC) 54278.424 54278.424 Sample-size adjusted Bayesian (BIC) 54081.440 54081.440</p>
<p>Root Mean Square Error of Approximation:</p>
<p>RMSEA 0.039 0.026 90 Percent confidence interval - lower 0.029 0.016 90 Percent confidence interval - upper 0.051 0.036 P-value RMSEA <= 0.05 0.941 1.000</p>
<p>Robust RMSEA 0.032 90 Percent confidence interval - lower 0.016 90 Percent confidence interval - upper 0.048</p>
<p>Standardized Root Mean Square Residual:</p>
<p>SRMR 0.029 0.029</p>
<p>Parameter Estimates:</p>
<p>Standard errors Sandwich Information bread Observed Observed information based on Hessian</p>