data

 wideData=reshape(data=data,idvar =  c("subject_accession","visit_name","infant_arm","delivery_mode","arm_name"),
                  timevar = "feature", direction = "wide")

#wideData=wideData[,-c(3:5)]
timepoints=ifelse(wideData$visit_name=="prevaccinated",2,ifelse(wideData$visit_name=="mo4",4,ifelse(wideData$visit_name=="vaccinated",5,9)))

wideData$visit_name=timepoints
wideData=wideData[order(wideData$subject_accession,wideData$visit_name),]
index=which(is.na(wideData),arr.ind = T)
aa=as.numeric(names(which(table(index[,2])>0.1*nrow(wideData))))
fulldata=wideData[,-aa]
fulldata[78,4]="Vaginal Delivery"
fulldata[is.na(fulldata)]<- 0
fulldata[,-c(1:5)]=log10(1+fulldata[,-c(1:5)])
index=which(fulldata$subject_accession==23)
fulldata=fulldata[-index,]

ddd=c()
for (i in c(2,4,5,9)) {
  index=which(fulldata$visit_name==i)
  dd=fulldata[index,]
  dd[,-c(1:5)]=scale(dd[,-c(1:5)],center = TRUE,scale = FALSE)
  ddd=rbind(ddd,dd)
}
fulldata=ddd[order(ddd$subject_accession,ddd$visit_name),]
antibodyName=substr(colnames(fulldata),16,length(colnames(fulldata)))[-c(1:5)]
colnames(fulldata)[-c(1:5)]=antibodyName

homogeneous subjects

one-stage model (post vaccination data,2.2min)

index=which(fulldata$visit_name==2)
postdata=fulldata[-index,]
aa1=lglasso(data=postdata[,-c(3:5)],lambda = 0.004961126,random = FALSE,trace = T,tol = 0.01)
## [1] "iteration 1 precision difference: 20.71 /correlation tau difference: 0.943"
## [1] "iteration 2 precision difference: 7.754 /correlation tau difference: 0.311"
## [1] "iteration 3 precision difference: 5.242 /correlation tau difference: 0.289"
## [1] "iteration 4 precision difference: 4.312 /correlation tau difference: 0.215"
## [1] "iteration 5 precision difference: 3.685 /correlation tau difference: 0.188"
## [1] "iteration 6 precision difference: 2.992 /correlation tau difference: 0.163"
## [1] "iteration 7 precision difference: 2.722 /correlation tau difference: 0.132"
## [1] "iteration 8 precision difference: 2.031 /correlation tau difference: 0.121"
## [1] "iteration 9 precision difference: 1.903 /correlation tau difference: 0.09"
## [1] "iteration 10 precision difference: 1.343 /correlation tau difference: 0.084"
## [1] "iteration 11 precision difference: 1.279 /correlation tau difference: 0.057"
## [1] "iteration 12 precision difference: 0.821 /correlation tau difference: 0.054"
## [1] "iteration 13 precision difference: 0.788 /correlation tau difference: 0.034"
## [1] "iteration 14 precision difference: 0.469 /correlation tau difference: 0.033"
## [1] "iteration 15 precision difference: 0.452 /correlation tau difference: 0.019"
## [1] "iteration 16 precision difference: 0.255 /correlation tau difference: 0.019"
## [1] "iteration 17 precision difference: 0.246 /correlation tau difference: 0.011"
## [1] "iteration 18 precision difference: 0.135 /correlation tau difference: 0.01"
## [1] "iteration 19 precision difference: 0.13 /correlation tau difference: 0.006"
## [1] "iteration 20 precision difference: 0.072 /correlation tau difference: 0.006"
## [1] "iteration 21 precision difference: 0.07 /correlation tau difference: 0.003"
## [1] "iteration 22 precision difference: 0.038 /correlation tau difference: 0.003"
## [1] "iteration 23 precision difference: 0.037 /correlation tau difference: 0.002"
## [1] "iteration 24 precision difference: 0.02 /correlation tau difference: 0.002"
## [1] "iteration 25 precision difference: 0.02 /correlation tau difference: 0.001"
## [1] "iteration 26 precision difference: 0.011 /correlation tau difference: 0.001"
## [1] "iteration 27 precision difference: 0.01 /correlation tau difference: 0"
aa1$wi[[1]][1:10,1:10]
##              FIM_IgG4    TT_IgG3   IPV1_IgG3 ACT_FcgR2a     TT_ADNP    FHA_IgG
## FIM_IgG4    4.4361446 -0.1711308  0.18501323  0.0000000  0.00000000  0.0000000
## TT_IgG3    -0.1711355 13.5873604  0.00000000  0.8261342  0.00000000  0.0000000
## IPV1_IgG3   0.1850104  0.0000000  9.30248256  0.2393365 -0.08290309  0.1633662
## ACT_FcgR2a  0.0000000  0.8262238  0.23925532 20.2064939 -0.26130698 -0.6177311
## TT_ADNP     0.0000000  0.0000000 -0.08297878 -0.2611709 12.40672201  0.0000000
## FHA_IgG     0.0000000  0.0000000  0.16321220 -0.6177133  0.00000000 13.4757572
## PRN_FcgR2a  0.0000000  0.0000000  0.00000000  0.0000000  0.00000000  1.3863920
## IPV3_ADCD   0.0000000  0.0000000  0.00000000  0.4894627  0.00000000  0.0000000
## IPV1_IgG4   0.0000000  0.0000000 -3.13366945  0.0000000  0.00000000  0.0000000
## PT_FcgR2a   0.0000000  0.1749166 -0.19618023 -0.0434143  0.00000000  1.0245754
##            PRN_FcgR2a  IPV3_ADCD IPV1_IgG4   PT_FcgR2a
## FIM_IgG4    0.0000000  0.0000000  0.000000  0.00000000
## TT_IgG3     0.0000000  0.0000000  0.000000  0.17508159
## IPV1_IgG3   0.0000000  0.0000000 -3.133669 -0.19606164
## ACT_FcgR2a  0.0000000  0.4884597  0.000000 -0.04396804
## TT_ADNP     0.0000000  0.0000000  0.000000  0.00000000
## FHA_IgG     1.3864639  0.0000000  0.000000  1.02442618
## PRN_FcgR2a 18.2587992  0.0000000  0.000000 -0.72799917
## IPV3_ADCD   0.0000000 37.7208465  0.000000  0.00000000
## IPV1_IgG4   0.0000000  0.0000000 13.381729  0.00000000
## PT_FcgR2a  -0.7282688  0.0000000  0.000000 17.84096343
aa1$tau
## [1] 0.245302
adjMatrix=ifelse(abs(aa1$wi[[1]])<10^(-5),0,1)
gg=graph_from_adjacency_matrix(
adjmatrix =  adjMatrix,
mode = c("undirected"),
weighted = NULL,
diag = FALSE
)
edgeListHomo1=as_edgelist(gg)
write.csv(edgeListHomo1,file="edgeListHomo1.CSV")
saveRDS(edgeListHomo1,file="edgeListHomo1.rds")

two-stage model (full data)

heterogeneous subjects

one-stage model (post vaccination data,2.2min)

aa1=lglasso(data=postdata[,-c(3:5)],lambda = 0.005670864,random = TRUE,trace = T)
## [1] "alpha estimate: 1"
## [1] "iteration 1 precision difference: 12.628 /correlation alpha difference: 14.051"
## [1] "alpha estimate: 15.051201861239"
## [1] "iteration 2 precision difference: 2.213 /correlation alpha difference: 1.777"
## [1] "alpha estimate: 13.2739103818436"
## [1] "iteration 3 precision difference: 1.419 /correlation alpha difference: 3.437"
## [1] "alpha estimate: 9.83729504575252"
## [1] "iteration 4 precision difference: 0.87 /correlation alpha difference: 2.511"
## [1] "alpha estimate: 7.3266095328824"
## [1] "iteration 5 precision difference: 0.657 /correlation alpha difference: 1.484"
## [1] "alpha estimate: 5.84290709868853"
## [1] "iteration 6 precision difference: 0.421 /correlation alpha difference: 0.828"
## [1] "alpha estimate: 5.01481463104218"
## [1] "iteration 7 precision difference: 0.286 /correlation alpha difference: 0.624"
## [1] "alpha estimate: 4.39052127059415"
## [1] "iteration 8 precision difference: 0.191 /correlation alpha difference: 0.225"
## [1] "alpha estimate: 4.16586544143655"
## [1] "iteration 9 precision difference: 0.128 /correlation alpha difference: 0.274"
## [1] "alpha estimate: 3.89216432967499"
## [1] "iteration 10 precision difference: 0.104 /correlation alpha difference: 0.035"
## [1] "alpha estimate: 3.85766351841488"
## [1] "iteration 11 precision difference: 0.115 /correlation alpha difference: 0.037"
## [1] "alpha estimate: 3.82059673885408"
## [1] "iteration 12 precision difference: 0.081 /correlation alpha difference: 0.017"
aa1$wi[[1]][1:10,1:10]
##             FIM_IgG4    TT_IgG3   IPV1_IgG3 ACT_FcgR2a     TT_ADNP    FHA_IgG
## FIM_IgG4   6.2313605  0.0000000  0.12383455  0.0000000  0.00000000  0.0000000
## TT_IgG3    0.0000000 12.3594992  0.00000000  0.7087086  0.00000000  0.0000000
## IPV1_IgG3  0.1238568  0.0000000  9.19658539  0.1781837  0.00000000  0.0000000
## ACT_FcgR2a 0.0000000  0.7086643  0.17824696 18.3837752 -0.24155236 -0.6798852
## TT_ADNP    0.0000000  0.0000000  0.00000000 -0.2415638 10.86840062  0.0000000
## FHA_IgG    0.0000000  0.0000000  0.00000000 -0.6799054  0.00000000 13.2755022
## PRN_FcgR2a 0.0000000 -0.0613783  0.00000000  0.0000000  0.00000000  1.2722874
## IPV3_ADCD  0.0000000  0.0000000  0.00000000  0.4096089  0.00000000  0.0000000
## IPV1_IgG4  0.0000000  0.0000000 -2.87103550  0.0000000  0.00000000  0.0000000
## PT_FcgR2a  0.0000000  0.0000000 -0.06009077  0.0000000  0.07916382  0.7203898
##             PRN_FcgR2a  IPV3_ADCD IPV1_IgG4   PT_FcgR2a
## FIM_IgG4    0.00000000  0.0000000  0.000000  0.00000000
## TT_IgG3    -0.06144336  0.0000000  0.000000  0.00000000
## IPV1_IgG3   0.00000000  0.0000000 -2.871033 -0.06008371
## ACT_FcgR2a  0.00000000  0.4098423  0.000000  0.00000000
## TT_ADNP     0.00000000  0.0000000  0.000000  0.07914308
## FHA_IgG     1.27228015  0.0000000  0.000000  0.72036271
## PRN_FcgR2a 16.57955361  0.0000000  0.000000 -0.56849713
## IPV3_ADCD   0.00000000 34.7492731  0.000000  0.00000000
## IPV1_IgG4   0.00000000  0.0000000 13.139356  0.00000000
## PT_FcgR2a  -0.56845599  0.0000000  0.000000 16.66298634
aa1$tau
##              [,1]
##   [1,] 0.32294065
##   [2,] 0.41120393
##   [3,] 0.23581741
##   [4,] 0.32997446
##   [5,] 0.64689868
##   [6,] 0.17830071
##   [7,] 0.19952555
##   [8,] 0.21376751
##   [9,] 0.21719283
##  [10,] 0.13931214
##  [11,] 0.04899138
##  [12,] 0.08500584
##  [13,] 0.04157536
##  [14,] 0.17076139
##  [15,] 0.05504076
##  [16,] 0.40002711
##  [17,] 0.22850727
##  [18,] 0.18847646
##  [19,] 0.15308519
##  [20,] 0.06095524
##  [21,] 0.18227891
##  [22,] 0.32778946
##  [23,] 0.11335923
##  [24,] 0.05934030
##  [25,] 0.20813052
##  [26,] 0.05145638
##  [27,] 0.18887001
##  [28,] 0.08969840
##  [29,] 0.09246103
##  [30,] 0.22112939
##  [31,] 0.20523908
##  [32,] 0.13499815
##  [33,] 0.13592933
##  [34,] 0.19490843
##  [35,] 0.37457548
##  [36,] 0.13532722
##  [37,] 0.34413341
##  [38,] 0.23893279
##  [39,] 0.69281153
##  [40,] 0.34278997
##  [41,] 0.18003713
##  [42,] 0.57430218
##  [43,] 0.22851937
##  [44,] 0.38054626
##  [45,] 0.19162455
##  [46,] 0.10254076
##  [47,] 0.66241437
##  [48,] 0.34238288
##  [49,] 0.22628557
##  [50,] 0.19313336
##  [51,] 0.16523150
##  [52,] 0.12075913
##  [53,] 0.09657972
##  [54,] 0.13320785
##  [55,] 0.32421003
##  [56,] 0.05934850
##  [57,] 0.10813437
##  [58,] 0.14013748
##  [59,] 0.91495702
##  [60,] 0.07461182
##  [61,] 0.27615683
##  [62,] 0.41506812
##  [63,] 0.07412226
##  [64,] 0.12114411
##  [65,] 0.17176926
##  [66,] 0.13458028
##  [67,] 0.55343538
##  [68,] 0.06606451
##  [69,] 0.15389460
##  [70,] 0.07936813
##  [71,] 0.07549770
##  [72,] 0.15048421
##  [73,] 0.09889201
##  [74,] 0.12012091
##  [75,] 0.09865107
##  [76,] 0.14850582
##  [77,] 0.18770132
##  [78,] 0.05540880
##  [79,] 0.13221031
##  [80,] 0.10500811
##  [81,] 0.60032659
##  [82,] 0.08593307
##  [83,] 0.22564865
##  [84,] 0.22615725
##  [85,] 0.21020616
##  [86,] 0.18679712
##  [87,] 0.18151487
##  [88,] 0.10694443
##  [89,] 0.92305171
##  [90,] 0.10161552
##  [91,] 0.39811856
##  [92,] 0.42707533
##  [93,] 0.05764923
##  [94,] 0.08426755
##  [95,] 0.25609133
##  [96,] 0.14075785
##  [97,] 0.28540195
##  [98,] 0.32161414
##  [99,] 0.22506176
## [100,] 0.12778905
## [101,] 0.10832909
## [102,] 0.43407772
## [103,] 0.08614450
## [104,] 0.22206752
## [105,] 0.58514487
## [106,] 0.22916045
## [107,] 0.70781326
## [108,] 0.86628184
## [109,] 0.47101994
## [110,] 1.02506957
## [111,] 0.18116380
## [112,] 0.17780393
## [113,] 0.06412562
## [114,] 0.14685675
## [115,] 0.82447727
## [116,] 0.29534965
## [117,] 0.13779985
## [118,] 0.18393832
## [119,] 0.15921334
## [120,] 0.33836826
## [121,] 0.07807826
## [122,] 0.62680257
## [123,] 0.32252971
## [124,] 0.16861262
## [125,] 0.10675034
## [126,] 0.12191496
## [127,] 0.11393661
## [128,] 0.10520094
## [129,] 0.07611548
## [130,] 0.05005381
## [131,] 0.06985187
## [132,] 0.34367487
## [133,] 0.12370193
## [134,] 0.18846106
## [135,] 0.27623793
## [136,] 0.29266653
## [137,] 0.18518666
## [138,] 0.31354703
## [139,] 0.69504549
## [140,] 1.07473622
## [141,] 0.20042926
## [142,] 1.35263345
## [143,] 0.11679440
## [144,] 0.06638076
## [145,] 0.05676611
## [146,] 0.38301627
## [147,] 0.30680104
## [148,] 0.13285243
## [149,] 0.21384446
## [150,] 0.10161476
## [151,] 0.14308433
## [152,] 0.28568427
## [153,] 0.40412242
## [154,] 0.03529635
## [155,] 0.14313785
## [156,] 0.14313522
## [157,] 0.14911434
## [158,] 0.21891500
## [159,] 0.09704320
## [160,] 0.07356775
## [161,] 0.29222569
## [162,] 0.21069130
## [163,] 0.64200607
## [164,] 0.14232544
## [165,] 0.28788128
## [166,] 1.13912823
## [167,] 0.11323173
## [168,] 0.15397005
## [169,] 0.21469150
## [170,] 0.11078735
## [171,] 0.16166601
## [172,] 0.17014112
## [173,] 0.09649565
## [174,] 0.16427994
## [175,] 0.27466684
## [176,] 0.72409513
## [177,] 0.22002190
## [178,] 0.30299638
## [179,] 0.66322325
## [180,] 0.14382660
## [181,] 0.19242611
## [182,] 0.26753385
## [183,] 1.11841770
## [184,] 0.10397376
## [185,] 0.13322593
## [186,] 0.27463337
## [187,] 0.07317555
## [188,] 0.07356629
## [189,] 0.16860416
## [190,] 0.61450285
## [191,] 0.12420310
## [192,] 0.07805813
## [193,] 0.04722516
## [194,] 0.23484877
## [195,] 0.10257349
## [196,] 0.50091828
## [197,] 0.90365496
## [198,] 0.05810137
## [199,] 0.47930551
## [200,] 0.26078562
## [201,] 0.61406191
## [202,] 0.09001542
## [203,] 0.55458747
## [204,] 0.16106076
## [205,] 0.17158602
## [206,] 0.16868296
## [207,] 0.09974421
## [208,] 0.18311607
## [209,] 0.14001977
## [210,] 0.30283709
## [211,] 0.17680308
## [212,] 0.20464391
## [213,] 0.37833716
## [214,] 0.15509033
## [215,] 0.36250240
## [216,] 0.29507996
## [217,] 0.19318461
## [218,] 0.19962192
## [219,] 0.23572198
## [220,] 0.16705160
## [221,] 0.21109902
## [222,] 0.18556833
## [223,] 0.19687828
## [224,] 0.13106570
## [225,] 0.58281209
## [226,] 0.20599108
## [227,] 0.08550390
## [228,] 0.18437365
## [229,] 0.80114724
## [230,] 0.21559845
## [231,] 1.19336249
## [232,] 0.21646568
## [233,] 0.07219403
## [234,] 0.54908506
## [235,] 0.71829076
## [236,] 0.17227010
## [237,] 0.17751920
## [238,] 0.30339503
## [239,] 0.26517624
aa1$alpha
## [1] 3.803809
dd=unique(postdata[,c(1,3:5)])
boxplot(aa1$tau~dd$infant_arm)

summary(lm(aa1$tau~dd$infant_arm))
## 
## Call:
## lm(formula = aa1$tau ~ dd$infant_arm)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.25885 -0.12801 -0.07404  0.04245  1.13476 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      0.21787    0.02122   10.27  < 2e-16 ***
## dd$infant_armwP  0.08821    0.02970    2.97  0.00329 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2295 on 237 degrees of freedom
## Multiple R-squared:  0.03588,    Adjusted R-squared:  0.03181 
## F-statistic:  8.82 on 1 and 237 DF,  p-value: 0.003287
boxplot(aa1$tau~dd$delivery_mode)

summary(lm(aa1$tau~dd$delivery_mode))
## 
## Call:
## lm(formula = aa1$tau ~ dd$delivery_mode)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.23116 -0.14364 -0.07758  0.04372  1.08618 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                       0.20106    0.06470   3.107  0.00212 **
## dd$delivery_modeVaginal Delivery  0.06539    0.06654   0.983  0.32671   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2333 on 237 degrees of freedom
## Multiple R-squared:  0.004059,   Adjusted R-squared:  -0.0001433 
## F-statistic: 0.9659 on 1 and 237 DF,  p-value: 0.3267
boxplot(aa1$tau~dd$arm_name)

summary(lm(aa1$tau~dd$arm_name))
## 
## Call:
## lm(formula = aa1$tau ~ dd$arm_name)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.27779 -0.12780 -0.06359  0.04161  1.15703 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         0.24476    0.03152   7.764 2.52e-13 ***
## dd$arm_nameTdaP_wP  0.04415    0.04262   1.036    0.301    
## dd$arm_nameTT_aP   -0.04916    0.04262  -1.153    0.250    
## dd$arm_nameTT_wP    0.08026    0.04361   1.840    0.067 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2295 on 235 degrees of freedom
## Multiple R-squared:  0.04435,    Adjusted R-squared:  0.03215 
## F-statistic: 3.635 on 3 and 235 DF,  p-value: 0.01357
adjMatrix=ifelse(abs(aa1$wi[[1]])<10^(-5),0,1)
gg=graph_from_adjacency_matrix(
adjmatrix =  adjMatrix,
mode = c("undirected"),
weighted = NULL,
diag = FALSE
)
edgeListHeter1=as_edgelist(gg)
write.csv(edgeListHeter1,file="edgeListHeter1.CSV")
saveRDS(edgeListHeter1,file="edgeListHeter1.rds")

two-stage model (full data,5.7min)

group=ifelse(fulldata$visit_name==2,1,2)
aa2=lglasso(data=fulldata[,-c(3:5)],lambda = c(0.01174363,0.329193),group = group,random = TRUE,trace = T)
## [1] "alpha estimate: 1"
## [1] "iteration 1 precision difference: 8.422 /correlation alpha difference: 13.448"
## [1] "alpha estimate: 14.4475327149633"
## [1] "iteration 2 precision difference: 1.78 /correlation alpha difference: 3.631"
## [1] "alpha estimate: 10.8164840594234"
## [1] "iteration 3 precision difference: 1.299 /correlation alpha difference: 4.052"
## [1] "alpha estimate: 6.76451192330618"
## [1] "iteration 4 precision difference: 0.922 /correlation alpha difference: 1.994"
## [1] "alpha estimate: 4.77076500066998"
## [1] "iteration 5 precision difference: 0.532 /correlation alpha difference: 0.912"
## [1] "alpha estimate: 3.85894187265782"
## [1] "iteration 6 precision difference: 0.244 /correlation alpha difference: 0.461"
## [1] "alpha estimate: 3.3980340059494"
## [1] "iteration 7 precision difference: 0.112 /correlation alpha difference: 0.099"
## [1] "alpha estimate: 3.29858031765356"
## [1] "iteration 8 precision difference: 0.049 /correlation alpha difference: 0.053"
aa2$wi[[1]][1:10,1:10]
##                 FIM_IgG4       TT_IgG3     IPV1_IgG3    ACT_FcgR2a
## FIM_IgG4    9.930509e+01  2.071051e-07 -2.606191e-07  4.459130e-07
## TT_IgG3     2.071051e-07  4.899573e+01  9.410921e-07 -1.660629e-06
## IPV1_IgG3  -2.606191e-07  9.410921e-07  1.287435e+01  1.984936e-01
## ACT_FcgR2a  4.459130e-07 -1.660629e-06  1.984936e-01  1.685178e+01
## TT_ADNP     3.022390e-07  4.282021e-07 -8.289307e-07 -1.327945e-07
## FHA_IgG     3.545154e-07  2.735582e-02 -6.173215e-07 -6.975407e-01
## PRN_FcgR2a  6.901900e-08 -2.973752e-07 -9.981627e-07 -3.759593e-01
## IPV3_ADCD  -3.616374e-08 -3.496281e-07 -6.070792e-07 -1.535118e-06
## IPV1_IgG4   2.195377e-07  3.217237e-07 -2.745955e+00 -3.359303e-07
## PT_FcgR2a   1.994590e-07 -7.519280e-07 -1.528049e-06 -8.335685e-02
##                  TT_ADNP       FHA_IgG    PRN_FcgR2a     IPV3_ADCD
## FIM_IgG4    3.022390e-07  3.545154e-07  6.901900e-08 -3.616374e-08
## TT_IgG3     4.282021e-07  2.735582e-02 -2.973752e-07 -3.496281e-07
## IPV1_IgG3  -8.289307e-07 -6.173215e-07 -9.981627e-07 -6.070792e-07
## ACT_FcgR2a -1.327945e-07 -6.975407e-01 -3.759593e-01 -1.535118e-06
## TT_ADNP     1.303620e+01 -2.828367e-08 -1.517031e-06  1.246659e-06
## FHA_IgG    -2.828367e-08  1.462483e+01  2.806981e-01  1.371743e-02
## PRN_FcgR2a -1.517031e-06  2.806981e-01  1.061332e+01 -2.061207e-06
## IPV3_ADCD   1.246659e-06  1.371743e-02 -2.061207e-06  2.896878e+01
## IPV1_IgG4   2.948348e-07 -3.653664e-07 -1.928859e-07 -3.511775e-07
## PT_FcgR2a  -1.710913e-06  1.109669e-06 -8.339525e-01 -2.286853e-06
##                IPV1_IgG4     PT_FcgR2a
## FIM_IgG4    2.195377e-07  1.994590e-07
## TT_IgG3     3.217237e-07 -7.519280e-07
## IPV1_IgG3  -2.745955e+00 -1.528049e-06
## ACT_FcgR2a -3.359303e-07 -8.335685e-02
## TT_ADNP     2.948348e-07 -1.710913e-06
## FHA_IgG    -3.653664e-07  1.109669e-06
## PRN_FcgR2a -1.928859e-07 -8.339525e-01
## IPV3_ADCD  -3.511775e-07 -2.286853e-06
## IPV1_IgG4   3.569084e+01  1.781065e-07
## PT_FcgR2a   1.781065e-07  1.435052e+01
aa2$wi[[2]][1:10,1:10]
##                 FIM_IgG4       TT_IgG3     IPV1_IgG3    ACT_FcgR2a
## FIM_IgG4    6.105314e+00  6.358992e-07 -9.312490e-07  9.033971e-07
## TT_IgG3     6.358992e-07  1.235651e+01  7.774927e-07 -1.125640e-06
## IPV1_IgG3  -9.312490e-07  7.774927e-07  9.884217e+00  1.984952e-01
## ACT_FcgR2a  9.033971e-07 -1.125640e-06  1.984952e-01  1.817845e+01
## TT_ADNP     3.623571e-07  2.946126e-07 -3.554546e-07  9.040422e-07
## FHA_IgG     6.817066e-07  2.735814e-02  2.809947e-06 -6.975421e-01
## PRN_FcgR2a  8.247872e-08  2.409139e-06  1.204605e-06 -3.759606e-01
## IPV3_ADCD   8.215201e-08  1.106072e-07  2.571048e-08  1.198487e-07
## IPV1_IgG4   1.884002e-07  2.463721e-07 -2.745955e+00  1.573658e-07
## PT_FcgR2a  -3.644733e-08  7.025158e-07  1.065294e-06 -8.336386e-02
##                  TT_ADNP       FHA_IgG    PRN_FcgR2a     IPV3_ADCD
## FIM_IgG4    3.623571e-07  6.817066e-07  8.247872e-08  8.215201e-08
## TT_IgG3     2.946126e-07  2.735814e-02  2.409139e-06  1.106072e-07
## IPV1_IgG3  -3.554546e-07  2.809947e-06  1.204605e-06  2.571048e-08
## ACT_FcgR2a  9.040422e-07 -6.975421e-01 -3.759606e-01  1.198487e-07
## TT_ADNP     1.259663e+01  1.308294e-07  2.387840e-08  2.622623e-07
## FHA_IgG     1.308294e-07  1.391464e+01  2.806995e-01  1.372102e-02
## PRN_FcgR2a  2.387840e-08  2.806995e-01  1.175460e+01  4.760504e-07
## IPV3_ADCD   2.622623e-07  1.372102e-02  4.760504e-07  3.232732e+01
## IPV1_IgG4   2.261578e-07  1.595074e-07  3.470418e-08 -1.127671e-07
## PT_FcgR2a  -1.156879e-06 -3.917391e-06 -8.339546e-01  7.282460e-07
##                IPV1_IgG4     PT_FcgR2a
## FIM_IgG4    1.884002e-07 -3.644733e-08
## TT_IgG3     2.463721e-07  7.025158e-07
## IPV1_IgG3  -2.745955e+00  1.065294e-06
## ACT_FcgR2a  1.573658e-07 -8.336386e-02
## TT_ADNP     2.261578e-07 -1.156879e-06
## FHA_IgG     1.595074e-07 -3.917391e-06
## PRN_FcgR2a  3.470418e-08 -8.339546e-01
## IPV3_ADCD  -1.127671e-07  7.282460e-07
## IPV1_IgG4   1.316437e+01  5.205890e-07
## PT_FcgR2a   5.205890e-07  1.562105e+01
dd=unique(fulldata[,c(1,3:5)])
boxplot(aa2$tau~dd$infant_arm)

summary(lm(aa2$tau~dd$infant_arm))
## 
## Call:
## lm(formula = aa2$tau ~ dd$infant_arm)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.29737 -0.15855 -0.08399  0.07076  1.33762 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      0.26486    0.02542   10.42   <2e-16 ***
## dd$infant_armwP  0.08469    0.03558    2.38   0.0181 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.275 on 237 degrees of freedom
## Multiple R-squared:  0.02334,    Adjusted R-squared:  0.01922 
## F-statistic: 5.664 on 1 and 237 DF,  p-value: 0.01811
boxplot(aa2$tau~dd$delivery_mode)

summary(lm(aa2$tau~dd$delivery_mode))
## 
## Call:
## lm(formula = aa2$tau ~ dd$delivery_mode)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.27302 -0.16572 -0.09276  0.05448  1.28996 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)   
## (Intercept)                       0.23117    0.07701   3.002  0.00297 **
## dd$delivery_modeVaginal Delivery  0.08135    0.07919   1.027  0.30536   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2777 on 237 degrees of freedom
## Multiple R-squared:  0.004433,   Adjusted R-squared:  0.0002319 
## F-statistic: 1.055 on 1 and 237 DF,  p-value: 0.3054
boxplot(aa2$tau~dd$arm_name)

summary(lm(aa2$tau~dd$arm_name))
## 
## Call:
## lm(formula = aa2$tau ~ dd$arm_name)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.32343 -0.15875 -0.07918  0.05850  1.36275 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         0.29520    0.03776   7.818  1.8e-13 ***
## dd$arm_nameTdaP_wP  0.03072    0.05106   0.602    0.548    
## dd$arm_nameTT_aP   -0.05548    0.05106  -1.087    0.278    
## dd$arm_nameTT_wP    0.08041    0.05224   1.539    0.125    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2749 on 235 degrees of freedom
## Multiple R-squared:  0.0323, Adjusted R-squared:  0.01994 
## F-statistic: 2.614 on 3 and 235 DF,  p-value: 0.0519
adjMatrix1=ifelse(abs(aa2$wi[[1]])<10^(-5),0,1)
adjMatrix2=ifelse(abs(aa2$wi[[2]])<10^(-5),0,1)
gg1=graph_from_adjacency_matrix(
adjmatrix =  adjMatrix1,
mode = c("undirected"),
weighted = NULL,
diag = FALSE
)

gg2=graph_from_adjacency_matrix(
adjmatrix =  adjMatrix2,
mode = c("undirected"),
weighted = NULL,
diag = FALSE
)
edgeListHeter21=as_edgelist(gg1)
edgeListHeter22=as_edgelist(gg2)
edgeListHeter2=list(edgeListHeter21,edgeListHeter22)
write.csv(edgeListHeter21,file="edgeListHeter21.CSV")
write.csv(edgeListHeter22,file="edgeListHeter22.CSV")
saveRDS(edgeListHeter2,file="edgeListHeter2.rds")