Skip to content

Commit

Permalink
adding test dataset to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
utooley committed Jun 25, 2024
1 parent 20431cb commit 96c7e33
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions data_demo/example_data_network_demo_data_long.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"","modid","avgweight","modul","avgclustco_both","num_comms_modul","part_coef_pos","part_coef_neg","system_segreg","mean_within_sys","mean_between_sys","system_conn_1","system_conn_2","system_conn_3","system_conn_4","system_conn_5","system_conn_6","system_conn_7","system_conn_8","system_conn_9","system_conn_10","system_conn_11","system_conn_12","system_conn_13","system_conn_14","system_conn_15","system_conn_16","system_conn_17","system_conn_18","system_conn_19","system_conn_20","system_conn_21","system_conn_22","system_conn_23","system_conn_24","system_conn_25","system_conn_26","system_conn_27","system_conn_28","system_conn_29","system_conn_30","system_conn_31","system_conn_32","system_conn_33","system_conn_34","system_conn_35","system_conn_36","system_conn_37","system_conn_38","system_conn_39","system_conn_40","system_conn_41","system_conn_42","system_conn_43","system_conn_44","system_conn_45","system_conn_46","system_conn_47","system_conn_48","system_conn_49","system_conn_50","system_conn_51","system_conn_52","system_conn_53","system_conn_54","system_conn_55","system_conn_56","system_conn_57","system_conn_58","system_conn_59","system_conn_60","system_conn_61","system_conn_62","system_conn_63","system_conn_64","system_conn_65","system_conn_66","system_conn_67","system_conn_68","system_conn_69","system_conn_70","system_conn_71","system_conn_72","system_conn_73","system_conn_74","system_conn_75","system_conn_76","system_conn_77","system_conn_78","system_conn_79","system_conn_80","system_conn_81","system_conn_82","system_conn_83","system_conn_84","system_conn_85","system_conn_86","system_conn_87","system_conn_88","system_conn_89","system_conn_90","system_conn_91","system_conn_92","system_conn_93","system_conn_94","system_conn_95","system_conn_96","system_conn_97","system_conn_98","system_conn_99","system_conn_100","system_conn_101","system_conn_102","system_conn_103","system_conn_104","system_conn_105","system_conn_106","system_conn_107","system_conn_108","system_conn_109","system_conn_110","system_conn_111","system_conn_112","system_conn_113","system_conn_114","system_conn_115","system_conn_116","system_conn_117","system_conn_118","system_conn_119","system_conn_120","system_conn_121","system_conn_122","system_conn_123","system_conn_124","system_conn_125","system_conn_126","system_conn_127","system_conn_128","system_conn_129","system_conn_130","system_conn_131","system_conn_132","system_conn_133","system_conn_134","system_conn_135","system_conn_136","system_conn_137","system_conn_138","system_conn_139","system_conn_140","system_conn_141","system_conn_142","system_conn_143","system_conn_144","system_conn_145","system_conn_146","system_conn_147","system_conn_148","system_conn_149","system_conn_150","system_conn_151","system_conn_152","system_conn_153","system_conn_154","system_conn_155","system_conn_156","system_conn_157","system_conn_158","system_conn_159","system_conn_160","system_conn_161","system_conn_162","system_conn_163","system_conn_164","system_conn_165","system_conn_166","system_conn_167","system_conn_168","system_conn_169","timepoint","part_coef_avg","child_age_mri","child_sex","disadv_prenatal","disadv_y1","disadv_y2","disadv_y3","income_needs_demo_b","income_needs_demo_b_unlogged","income_needs_demo_b_log","demo_edu_b","demo_edu_b_filled_in","avg_FD_of_retained_frames","retained_frames","total_frames.x","avg_FD_of_all_frames","total_frames.y","retained_frames_min","total_frames_min","percent_retained"
"1","1",1.630418e-05,0.400843047775193,0.065581046271814,5.51,0.817990660667419,0.866936028003693,1.110295,0.1196473,-0.01319646,0.2953032,0.0623395,-0.09164974,-0.08310618,-0.06719951,-0.05316828,-0.01675522,-0.0006647618,0.03867096,-0.03063877,0.1524509,0.02531424,-0.04050373,0.0623395,0.07690803,-0.01815335,-0.02205419,-0.01341501,-0.05819147,-0.01013919,-0.01514476,0.1086776,-0.002970814,0.04815514,0.0008726087,-0.05747232,-0.09164976,-0.01815335,0.1295523,0.004521913,0.06153335,0.003550299,0.0414838,-0.04961604,0.04964035,-0.0662123,-0.1336459,0.0162791,-0.0284697,-0.08310617,-0.02205419,0.004521917,0.0792248,0.04451551,0.007798953,-0.006680264,-0.04588262,-0.06464918,0.01997392,-0.06266452,0.02011381,-0.002850922,-0.0671995,-0.01341502,0.06153334,0.0445155,0.1002005,0.007946736,0.02015433,-0.04617264,-0.004487476,-0.05797741,-0.05142374,0.02297722,-0.01706374,-0.05316828,-0.05819147,0.003550298,0.007798953,0.007946735,0.1563765,-0.001799903,0.07576801,-0.07635046,-0.006689662,-0.03454016,-0.05204425,0.03067475,-0.01675522,-0.01013919,0.04148378,-0.006680268,0.02015433,-0.001799904,0.05539706,-0.005638255,0.02246678,-0.03678603,-0.06304325,0.02125456,-0.03072811,-0.0006647594,-0.01514476,-0.04961604,-0.04588262,-0.04617264,0.07576802,-0.005638254,0.1771513,0.009279369,-0.04550238,-0.04990336,-0.04335145,0.09880181,0.03867096,0.1086776,0.04964036,-0.06464916,-0.004487472,-0.07635045,0.02246678,0.009279371,0.2556688,-0.06321201,-0.02937405,-0.01116807,-0.06279981,-0.03063876,-0.002970811,-0.0662123,0.01997392,-0.05797742,-0.006689662,-0.03678602,-0.04550239,-0.06321201,0.1810212,0.1386178,-0.0592942,-0.04077669,0.1524509,0.04815515,-0.1336459,-0.06266452,-0.05142375,-0.03454017,-0.06304325,-0.04990336,-0.02937405,0.1386178,0.5329639,-0.03183712,-0.06913435,0.02531424,0.0008726124,0.0162791,0.02011381,0.02297722,-0.05204425,0.02125457,-0.04335145,-0.01116807,-0.0592942,-0.03183712,0.1442474,-0.01426028,-0.04050372,-0.05747231,-0.02846971,-0.002850921,-0.01706374,0.03067475,-0.03072812,0.0988018,-0.06279981,-0.0407767,-0.06913434,-0.01426028,0.1302662,"y0",0.842463344335556,0.037037037037037,"Male",0.618,-0.95,0.491,0.587,NA,1.16055751110257,0.0646666666666667,NA,2,0.076,1456,1680,1.369,1680,19.4133333333333,22.4,0.866666666666667
"2","1",0.007279763,0.531962549458161,0.155618245236944,3.98,0.792895972728729,0.844165086746216,1.073275,0.2174772,-0.01593569,0.18361721932888,0.0334383472800255,-0.053065050393343,-0.0504359900951385,-0.0772527158260345,0.00566702010110021,-0.0217555575072765,0.0146859912201762,-0.0193777251988649,0.0396812744438648,0.103006027638912,0.00206602131947875,-0.0446188934147358,0.0334383361041546,0.194852158427238,0.0124546075239778,0.0168815441429615,0.0248924177139997,-0.0420698784291744,-0.0126507263630629,-0.131037399172783,0.189825847744942,0.0426831059157848,0.0864585340023041,-0.0360115393996239,-0.106699429452419,-0.0530650429427624,0.0124546075239778,0.233711868524551,-0.072090670466423,0.115748874843121,0.0551871433854103,0.135643690824509,0.0280384179204702,0.11009892821312,-0.125931426882744,-0.043552253395319,0.139964893460274,-0.130123361945152,-0.0504359863698483,0.0168815515935421,-0.0720906853675842,0.206360548734665,0.101672478020191,-0.152180939912796,-0.0404276698827744,-0.18453723192215,-0.0672630369663239,0.00190259795635939,-0.0701667368412018,-0.0104442676529288,0.029161075130105,-0.0772527158260345,0.0248924121260643,0.115748874843121,0.101672492921352,0.180993586778641,-0.0736987143754959,0.0706630870699883,-0.133780956268311,0.0505833737552166,-0.0945772975683212,-0.0691884681582451,0.0866706594824791,-0.0743778571486473,0.00566701870411634,-0.0420698821544647,0.0551871508359909,-0.152180954813957,-0.0736986920237541,0.37170797586441,-0.00684849498793483,0.293181777000427,0.0866924151778221,-0.0340079553425312,0.0445652790367603,-0.05888407304883,0.0287459008395672,-0.0217555575072765,-0.0126507254317403,0.135643675923347,-0.0404276810586452,0.0706630945205688,-0.00684849545359612,0.138999179005623,0.0252234656363726,0.0215236451476812,-0.0974932909011841,-0.0652120038866997,0.125395923852921,-0.0907294228672981,0.0146859930828214,-0.131037414073944,0.0280384235084057,-0.18453723192215,-0.133780956268311,0.293181717395782,0.0252234656363726,0.671651721000671,-0.0147070605307817,-0.0463925898075104,-0.0012911157682538,-0.0962149873375893,0.0859813168644905,-0.0193777251988649,0.189825862646103,0.11009892821312,-0.0672630295157433,0.050583366304636,0.0866924151778221,0.0215236488729715,-0.0147070605307817,0.35698065161705,-0.0469904839992523,0.00965074170380831,-0.0230182018131018,-0.0577266998589039,0.0396812632679939,0.042683120816946,-0.125931411981583,0.00190259946975857,-0.0945773273706436,-0.0340079516172409,-0.0974932760000229,-0.046392597258091,-0.0469904839992523,0.264982938766479,0.125327870249748,-0.139144882559776,-0.0357894152402878,0.103006027638912,0.0864585265517235,-0.0435522608458996,-0.0701667442917824,-0.0691884681582451,0.0445652939379215,-0.0652120038866997,-0.00129111390560865,0.00965072866529226,0.125327855348587,0.568808674812317,-0.136870950460434,-0.110454939305782,0.00206602085381746,-0.0360115393996239,0.139964878559113,-0.0104442704468966,0.0866706743836403,-0.0588840767741203,0.125395968556404,-0.0962149873375893,-0.0230182055383921,-0.139144912362099,-0.136870965361595,0.283994883298874,-0.0886491984128952,-0.0446189008653164,-0.106699429452419,-0.130123376846313,0.0291610676795244,-0.0743778571486473,0.028745898976922,-0.0907294452190399,0.0859813168644905,-0.0577267073094845,-0.0357894189655781,-0.110454924404621,-0.0886492133140564,0.270027041435242,"y2",0.818530529737473,1.98,"Male",0.618,-0.95,0.491,0.587,NA,1.16055751110257,0.0646666666666667,NA,2,0.049,2036,2100,1.247,2100,27.1466666666667,28,0.96952380952381
"3","1",0.008218218,0.548833687572573,0.19144964614237,3,0.815198540687561,0.843683540821075,1.071498,0.2343097,-0.01675268,0.298923,0.06383901,-0.05997922,-0.05076693,-0.05040234,-0.03404608,-0.0184657,-0.08206814,0.05889739,-0.0171008,-0.02434524,0.04650611,-0.03738948,0.06383903,0.2135937,-0.02492008,0.009026771,0.03437007,-0.1194968,-0.0730052,-0.118953,0.1974657,0.1002792,0.06413057,-0.03068409,-0.09352682,-0.05997922,-0.02492008,0.2522004,-0.006993895,0.1267337,-0.007685033,0.1291875,0.04039339,0.1266193,-0.1712254,-0.1655251,0.1544903,-0.09513173,-0.05076693,0.009026771,-0.006993895,0.1949181,0.1149267,-0.09875359,-0.03960712,-0.1870146,-0.04110636,-0.002032994,-0.00550865,0.01358226,-0.005913692,-0.05040235,0.03437006,0.1267337,0.1149267,0.1864543,-0.1129375,0.0504303,-0.08693912,0.07246184,-0.1052239,-0.114603,0.1010483,-0.05472828,-0.03404608,-0.1194968,-0.007685033,-0.09875359,-0.1129375,0.4494055,0.01092133,0.213587,-0.07777207,-0.008838182,0.1041789,-0.1091543,0.03448796,-0.01846571,-0.07300517,0.1291874,-0.03960711,0.0504303,0.01092133,0.1679888,0.08295982,-0.01865136,-0.1708745,-0.1955879,0.1683894,-0.0213042,-0.08206813,-0.118953,0.04039339,-0.1870146,-0.08693912,0.213587,0.08295982,0.6518294,-0.108285,-0.0914916,-0.05610474,-0.04225273,0.1110962,0.05889739,0.1974657,0.1266194,-0.04110637,0.07246184,-0.07777206,-0.01865137,-0.108285,0.3378452,0.0171734,-0.02452263,0.01692253,-0.1374163,-0.01710079,0.1002793,-0.1712254,-0.002032985,-0.1052239,-0.008838184,-0.1708745,-0.0914916,0.0171734,0.3572869,0.289851,-0.2038974,-0.02374697,-0.02434524,0.06413056,-0.1655252,-0.005508654,-0.114603,0.1041789,-0.1955879,-0.05610474,-0.02452263,0.289851,0.7144995,-0.2556178,-0.02757985,0.0465061,-0.0306841,0.1544903,0.01358226,0.1010483,-0.1091543,0.1683893,-0.04225273,0.01692253,-0.2038974,-0.2556177,0.3054237,-0.08667443,-0.03738948,-0.09352684,-0.09513173,-0.005913692,-0.05472826,0.03448796,-0.02130421,0.1110962,-0.1374163,-0.02374697,-0.02757985,-0.08667441,0.1745817,"y3",0.829441040754318,3.13,"Male",0.618,-0.95,0.491,0.587,NA,1.16055751110257,0.0646666666666667,NA,2,0.051,571,668,2.67,706,7.61333333333333,8.90666666666667,0.854790419161677
"4","2",0.004531833,0.472028367269128,0.11435836962254,3.92,0.789107859134674,0.840110599994659,1.084772,0.1960085,-0.016616,0.404855,0.08454632,-0.1602931,-0.1324247,-0.1685127,-0.1846554,-0.07343561,-0.05972126,-0.04652515,0.05561884,0.1480996,0.02105884,-0.08754654,0.08454633,0.1656057,-0.05412673,0.02462967,-0.03963608,-0.1070152,-0.01077752,-0.07392618,0.1184958,0.01505152,0.05681951,0.05195133,-0.1231572,-0.160293,-0.05412672,0.2707914,0.03559415,0.1637123,0.2250901,0.0738583,0.002607056,0.111921,-0.1568542,-0.1806165,0.04497133,-0.01970555,-0.1324248,0.02462968,0.03559415,0.1809177,0.13982,0.0561987,0.009413222,-0.06313499,0.01689602,-0.02477149,-0.1497936,-0.01460181,-0.02919295,-0.1685128,-0.03963607,0.1637122,0.13982,0.2600995,0.1219488,0.04484457,-0.01580385,0.06325718,-0.1083445,-0.1866321,-0.007801543,-0.006372548,-0.1846554,-0.1070152,0.22509,0.0561987,0.1219488,0.4497342,0.045985,0.09392245,0.02982699,-0.1694789,-0.227138,0.006386574,0.02731313,-0.0734356,-0.01077751,0.07385831,0.009413223,0.04484458,0.045985,0.0797499,0.04771155,0.07175721,-0.07360028,-0.05829988,0.03235281,-0.008894896,-0.05972125,-0.07392619,0.002607057,-0.06313498,-0.01580385,0.09392247,0.04771155,0.3536482,-0.01831797,-0.1049636,-0.0009738961,-0.02627704,0.1405385,-0.04652515,0.1184958,0.111921,0.01689602,0.06325718,0.02982699,0.07175721,-0.01831797,0.222181,-0.1106311,-0.05463327,0.07444331,-0.08459405,0.05561884,0.01505153,-0.1568542,-0.02477149,-0.1083445,-0.1694789,-0.07360028,-0.1049635,-0.1106311,0.2408461,0.1532361,-0.09165961,-0.01047159,0.1480996,0.05681951,-0.1806165,-0.1497936,-0.1866321,-0.227138,-0.05829987,-0.0009738975,-0.05463328,0.1532361,0.6295632,-0.03369337,-0.013889,0.02105884,0.05195133,0.04497134,-0.01460181,-0.00780154,0.006386573,0.03235279,-0.02627704,0.07444332,-0.09165959,-0.03369337,0.1603006,-0.04504481,-0.08754653,-0.1231572,-0.01970555,-0.02919295,-0.006372545,0.02731313,-0.008894896,0.1405385,-0.08459405,-0.01047159,-0.01388899,-0.04504481,0.1669776,"y0",0.814609229564667,0.0555555555555556,"Female",0.359,-0.85,0.458,0.774,NA,1.14200147979943,0.0576666666666667,NA,2,0.078,1389,1680,1.368,1680,18.52,22.4,0.826785714285714
13 changes: 11 additions & 2 deletions gamm_models/manuscript_analyses_revisions.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Setup -------------------------------------------------------------------
library(raincloudplots)
library(tidyverse)
library(stats)
library(parallel)
Expand Down Expand Up @@ -193,6 +192,12 @@ amt_of_data %>% tbl_summary(statistic = list(
all_continuous() ~ "{mean} ({min} - {max})",
all_categorical() ~ "{n} / {N} ({p}%)"))

# Save out test dataset for code repo and load it ------------------------------------------
network_demo_data_example <- network_demo_data_long %>% select(-c("MODID.x", "MODID.y", "child_birthweight", "GAWEEKS")) %>% arrange(modid) %>% slice_head(n = 4)
network_demo_data_example$modid <- c("1", "1","1", "2")
write.csv(network_demo_data_example, file = "~/Box/projects/in_progress/Tooley2023_prenatal_env_cortical_network_dev/data_demo/example_data_network_demo_data_long.csv")
network_demo_data_long <- read.csv("~/Box/projects/in_progress/Tooley2023_prenatal_env_cortical_network_dev/data_demo/example_data_network_demo_data_long.csv")

# Make Supplemental Table 1: Demographics ----------------
#filter original birth demo data by those in the network analyses
birth_data <- left_join(y0_network_data, demo_data, by="modid")
Expand Down Expand Up @@ -590,8 +595,12 @@ visreg(lm_bayley_rlang_clustco, "avgclustco_both")

# Figure 5a: Age x SES with composite SES (maternal ed + INR) -----------------------------
#make SES composite from the demo variables in SEM
network_demo_data_long$ses_composite_b_sem <- network_demo_data_long %>% select(c("demo_edu_b_filled_in","income_needs_demo_b_unlogged")) %>% rowMeans(na.rm=T)
network_demo_data_long$ses_composite_b_sem <- network_demo_data_long %>% select(c("demo_edu_b_filled_in","income_needs_demo_b_unlogged")) %>% scale() %>% rowMeans(na.rm=T)
describe(network_demo_data_long$ses_composite_b_sem)
network_demo_data_long$ses_composite_b_sem2 <- network_demo_data_long %>% select(c("demo_edu_b_filled_in","income_needs_demo_b_unlogged")) %>% rowMeans(na.rm=T)
describe(network_demo_data_long$ses_composite_b_sem2)

cor.test(network_demo_data_long$ses_composite_b_sem2, network_demo_data_long$ses_composite_b_sem);scatter.smooth(network_demo_data_long$ses_composite_b_sem2, network_demo_data_long$ses_composite_b_sem)

## System segregation ##
gam_age_ses_segreg_by <- gamm(system_segreg ~ child_sex + s(child_age_mri, k=4)+ s(child_age_mri,by=ses_composite_b_sem, k=4) + avg_FD_of_retained_frames + retained_frames + avgweight , random = list(modid =~ 1), data=network_demo_data_long, method = "REML")
Expand Down

0 comments on commit 96c7e33

Please sign in to comment.