このファイルは,『認知行動療法研究』の特集号「認知行動療法研究の新時代を切り開く研究法」上で樫原 潤・伊藤 正哉が執筆した論文の補足資料です。論文内のFig. 1をどのように求めるのか,より詳細な分析を実施するにはどうすれば良いのか,統計解析ソフトウェアRのコードと出力結果をコメント付きでまとめています。
なお,下記のコードは,本文で引用したEpskamp et al. (2018) に記されているものと基本的に同一です。ただし,Epskamp et al. (2018) の論文執筆時点と比べ,本ファイルの作成時点 (2020年4月25日) ではqgraph, bootnetの両パッケージの仕様が更新されています。仕様の更新に伴いコードを数か所書き換えたことにご留意ください (どこを書き換えたかは,コメント欄でご確認ください)。
PTSDをもつ女性患者359名のデータセット。分析の前にダウンロードしておく必要がある。 https://datashare.nida.nih.gov/study/nida-ctn-0015 にアクセスし,“CTN-0015 Data Files”をクリックすれば,“qs.csv”というデータセットをダウンロードできる。
FullData <- read.csv("qs.csv", stringsAsFactors = FALSE)
# install.packages("dplyr")
# install.packages("tidyr")
library("dplyr")
## Warning: package 'dplyr' was built under R version 3.6.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library("tidyr")
## Warning: package 'tidyr' was built under R version 3.6.3
Data <- FullData %>%
filter(EPOCH == "BASELINE",
grepl("^PSSR\\d+A$",QSTESTCD)) %>%
select(USUBJID,QSTEST,QSORRES) %>%
spread(QSTEST, QSORRES) %>%
select(-USUBJID) %>%
mutate_all(funs(replace(.,.=="NOT ANSWERED",NA))) %>%
mutate_all(funs(ordered(.,c("NOT AT ALL","ONCE A WEEK",
"2-4 TIMES PER WEEK/HALF THE TIME",
"5 OR MORE TIMES PER WEEK/ALMOST ALWAYS"))))
## Warning: funs() is soft deprecated as of dplyr 0.8.0
## Please use a list of either functions or lambdas:
##
## # Simple named list:
## list(mean = mean, median = median)
##
## # Auto named with `tibble::lst()`:
## tibble::lst(mean, median)
##
## # Using lambdas
## list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
## This warning is displayed once per session.
names(Data) <- seq_len(ncol(Data))
# install.packages("bootnet")
# install.packages("qgraph")
# install.packages("glasso")
# install.packages("lavaan", dependencies=TRUE)
library("bootnet")
## Warning: package 'bootnet' was built under R version 3.6.3
## Loading required package: ggplot2
## Registered S3 methods overwritten by 'car':
## method from
## influence.merMod lme4
## cooks.distance.influence.merMod lme4
## dfbeta.influence.merMod lme4
## dfbetas.influence.merMod lme4
## Registered S3 methods overwritten by 'BDgraph':
## method from
## plot.sim huge
## print.sim huge
## This is bootnet 1.3
## For questions and issues, please see github.com/SachaEpskamp/bootnet.
library("qgraph")
library("glasso")
library("lavaan")
## This is lavaan 0.6-5
## lavaan is BETA software! Please report any bugs.
Network <- estimateNetwork(Data, default = "EBICglasso")
## Estimating Network. Using package::function:
## - qgraph::EBICglasso for EBIC model selection
## - using glasso::glasso
## - qgraph::cor_auto for correlation computation
## - using lavaan::lavCor
## Warning in EBICglassoCore(S = S, n = n, gamma = gamma, penalize.diagonal
## = penalize.diagonal, : A dense regularized network was selected (lambda <
## 0.1 * lambda.max). Recent work indicates a possible drop in specificity.
## Interpret the presence of the smallest edges with care. Setting threshold =
## TRUE will enforce higher specificity, at the cost of sensitivity.
plot(Network, layout = "spring",labels = TRUE)
summary(Network)
##
## === Estimated network ===
## Number of nodes: 17
## Number of non-zero edges: 78 / 136
## Mean weight: 0.05421188
## Network stored in object$graph
##
## Default set used: EBICglasso
##
## Use plot(object) to plot estimated network
## Use bootnet(object) to bootstrap edge weights and centrality indices
##
## Relevant references:
##
## Friedman, J. H., Hastie, T., & Tibshirani, R. (2008). Sparse inverse covariance estimation with the graphical lasso. Biostatistics, 9 (3), 432-441.
## Foygel, R., & Drton, M. (2010). Extended Bayesian information criteria for Gaussian graphical models.
## Friedman, J. H., Hastie, T., & Tibshirani, R. (2014). glasso: Graphical lasso estimation of gaussian graphical models. Retrieved from https://CRAN.R-project.org/package=glasso
## Epskamp, S., Cramer, A., Waldorp, L., Schmittmann, V. D., & Borsboom, D. (2012). qgraph: Network visualizations of relationships in psychometric data. Journal of Statistical Software, 48 (1), 1-18.
## Epskamp, S., Borsboom, D., & Fried, E. I. (2016). Estimating psychological networks and their accuracy: a tutorial paper. arXiv preprint, arXiv:1604.08462.
※最後の行のcentralityPlot関数の中で,include = c(“Strength”, “Closeness”, “Betweenness”)というオプションを新たに指定していることに注意。qgraphパッケージのバージョン1.6.5では,オプションを指定しないとstrengthしか表示されない仕様になっている。
centrality(Network) # 中心性指標のz値
## $OutDegree
## 1 2 3 4 5 6 7
## 0.7807567 0.7459199 1.1021043 0.8077383 1.0759936 0.9507475 0.6991832
## 8 9 10 11 12 13 14
## 0.7662144 0.8398475 0.5426060 0.9966820 0.6855510 0.9108691 0.9596699
## 15 16 17
## 0.8323121 1.1100992 1.1801918
##
## $InDegree
## 1 2 3 4 5 6 7
## 0.7807567 0.7459199 1.1021043 0.8077383 1.0759936 0.9507475 0.6991832
## 8 9 10 11 12 13 14
## 0.7662144 0.8398475 0.5426060 0.9966820 0.6855510 0.9108691 0.9596699
## 15 16 17
## 0.8323121 1.1100992 1.1801918
##
## $Closeness
## 1 2 3 4 5 6
## 0.004699286 0.004063582 0.005129577 0.004737683 0.004478050 0.004389139
## 7 8 9 10 11 12
## 0.004142377 0.003908544 0.004037055 0.003883287 0.004546408 0.004361438
## 13 14 15 16 17
## 0.004485866 0.004552754 0.004543258 0.004478820 0.004709385
##
## $Betweenness
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
## 14 0 34 18 16 10 10 0 12 8 22 8 12 18 12 10 42
##
## $InExpectedInfluence
## 1 2 3 4 5 6 7
## 0.7807567 0.7459199 1.1021043 0.8077383 1.0759936 0.9507475 0.6991832
## 8 9 10 11 12 13 14
## 0.7662144 0.8398475 0.4221781 0.9966820 0.5651230 0.9108691 0.9596699
## 15 16 17
## 0.8323121 1.1100992 1.1801918
##
## $OutExpectedInfluence
## 1 2 3 4 5 6 7
## 0.7807567 0.7459199 1.1021043 0.8077383 1.0759936 0.9507475 0.6991832
## 8 9 10 11 12 13 14
## 0.7662144 0.8398475 0.4221781 0.9966820 0.5651230 0.9108691 0.9596699
## 15 16 17
## 0.8323121 1.1100992 1.1801918
##
## $ShortestPathLengths
## 1 2 3 4 5 6 7
## 1 0.000000 14.543176 7.815801 5.512190 13.468679 14.591869 21.698259
## 2 14.543176 0.000000 12.308587 14.612198 24.431638 22.056322 18.165942
## 3 7.815801 12.308587 0.000000 2.303611 12.123051 11.383290 18.489681
## 4 5.512190 14.612198 2.303611 0.000000 13.183717 9.079679 16.186069
## 5 13.468679 24.431638 12.123051 13.183717 0.000000 4.104039 8.978314
## 6 14.591869 22.056322 11.383290 9.079679 4.104039 0.000000 7.106391
## 7 21.698259 18.165942 18.489681 16.186069 8.978314 7.106391 0.000000
## 8 15.691390 25.786284 14.345763 16.588871 7.348172 7.509192 7.620342
## 9 21.573788 21.333650 13.757987 16.061598 11.298117 12.310092 5.203701
## 10 22.755363 14.218762 14.939561 17.243173 18.413004 19.424979 12.318589
## 11 10.905948 21.868907 9.560321 11.863932 2.562730 6.666769 11.541045
## 12 11.391921 13.403206 16.252136 16.904111 12.362593 16.466632 21.340908
## 13 5.833191 11.982817 10.693406 11.345381 17.921323 20.425060 21.131201
## 14 5.224655 9.318521 6.115805 8.419417 18.238856 17.499095 23.476928
## 15 10.542015 9.907932 11.433166 13.736777 19.101439 22.049947 18.159567
## 16 14.821620 7.193203 17.041749 19.345361 18.572596 19.335218 15.444838
## 17 15.492793 4.957154 16.383944 18.687555 20.808646 17.099168 13.208789
## 8 9 10 11 12 13 14
## 1 15.691390 21.573788 22.755363 10.905948 11.391921 5.833191 5.224655
## 2 25.786284 21.333650 14.218762 21.868907 13.403206 11.982817 9.318521
## 3 14.345763 13.757987 14.939561 9.560321 16.252136 10.693406 6.115805
## 4 16.588871 16.061598 17.243173 11.863932 16.904111 11.345381 8.419417
## 5 7.348172 11.298117 18.413004 2.562730 12.362593 17.921323 18.238856
## 6 7.509192 12.310092 19.424979 6.666769 16.466632 20.425060 17.499095
## 7 7.620342 5.203701 12.318589 11.541045 21.340908 21.131201 23.476928
## 8 0.000000 11.036212 18.151099 4.785442 18.914319 21.524581 20.461568
## 9 11.036212 0.000000 7.114887 13.860847 21.486230 15.927500 19.873792
## 10 18.151099 7.114887 0.000000 20.975734 16.607439 20.486087 19.529748
## 11 4.785442 13.860847 20.975734 0.000000 14.925323 16.739139 15.676126
## 12 18.914319 21.486230 16.607439 14.925323 0.000000 5.558730 16.616576
## 13 21.524581 15.927500 20.486087 16.739139 5.558730 0.000000 11.057846
## 14 20.461568 19.873792 19.529748 15.676126 16.616576 11.057846 0.000000
## 15 21.324151 21.327274 14.212387 16.538709 11.562697 12.083242 5.317361
## 16 23.065180 18.612545 11.497658 21.135327 6.210003 8.988429 10.925944
## 17 20.829130 16.376496 9.261609 20.347560 8.446052 11.224478 10.268139
## 15 16 17
## 1 10.542015 14.821620 15.492793
## 2 9.907932 7.193203 4.957154
## 3 11.433166 17.041749 16.383944
## 4 13.736777 19.345361 18.687555
## 5 19.101439 18.572596 20.808646
## 6 22.049947 19.335218 17.099168
## 7 18.159567 15.444838 13.208789
## 8 21.324151 23.065180 20.829130
## 9 21.327274 18.612545 16.376496
## 10 14.212387 11.497658 9.261609
## 11 16.538709 21.135327 20.347560
## 12 11.562697 6.210003 8.446052
## 13 12.083242 8.988429 11.224478
## 14 5.317361 10.925944 10.268139
## 15 0.000000 7.186828 4.950778
## 16 7.186828 0.000000 2.236049
## 17 4.950778 2.236049 0.000000
##
## $ShortestPaths
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14
## 1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 4 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 5 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 6 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 7 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 8 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 9 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 10 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 11 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 12 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 13 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 14 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 15 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 16 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 17 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
## 15 16 17
## 1 NULL NULL NULL
## 2 NULL NULL NULL
## 3 NULL NULL NULL
## 4 NULL NULL NULL
## 5 NULL NULL NULL
## 6 NULL NULL NULL
## 7 NULL NULL NULL
## 8 NULL NULL NULL
## 9 NULL NULL NULL
## 10 NULL NULL NULL
## 11 NULL NULL NULL
## 12 NULL NULL NULL
## 13 NULL NULL NULL
## 14 NULL NULL NULL
## 15 NULL NULL NULL
## 16 NULL NULL NULL
## 17 NULL NULL NULL
centrality_auto(Network) # z値に標準化する前の中心性指標
## $node.centrality
## Betweenness Closeness Strength ExpectedInfluence
## 1 7 0.004699286 0.7807567 0.7807567
## 2 0 0.004063582 0.7459199 0.7459199
## 3 17 0.005129577 1.1021043 1.1021043
## 4 9 0.004737683 0.8077383 0.8077383
## 5 8 0.004478050 1.0759936 1.0759936
## 6 5 0.004389139 0.9507475 0.9507475
## 7 5 0.004142377 0.6991832 0.6991832
## 8 0 0.003908544 0.7662144 0.7662144
## 9 6 0.004037055 0.8398475 0.8398475
## 10 4 0.003883287 0.5426060 0.4221781
## 11 11 0.004546408 0.9966820 0.9966820
## 12 4 0.004361438 0.6855510 0.5651230
## 13 6 0.004485866 0.9108691 0.9108691
## 14 9 0.004552754 0.9596699 0.9596699
## 15 6 0.004543258 0.8323121 0.8323121
## 16 5 0.004478820 1.1100992 1.1100992
## 17 21 0.004709385 1.1801918 1.1801918
##
## $edge.betweenness.centrality
## from to edgebetweenness
## 63 3 4 15
## 41 15 17 13
## 42 16 17 13
## 74 3 14 13
## 98 5 11 13
## 4 9 10 10
## 19 10 17 10
## 24 1 13 10
## 37 14 15 10
## 79 4 6 10
## 60 1 4 9
## 62 2 17 9
## 70 3 11 9
## 99 5 12 8
## 128 7 17 8
## 27 12 13 7
## 131 8 11 7
## 30 12 16 6
## 35 1 14 6
## 106 6 7 6
## 2 1 11 5
## 119 7 9 5
## 34 13 16 4
## 46 2 3 4
## 68 3 9 4
## 92 5 6 4
## 96 5 9 4
## 117 6 17 4
## 118 7 8 4
## 7 9 13 3
## 23 11 15 3
## 38 14 16 3
## 69 3 10 3
## 94 5 7 3
## 58 2 14 2
## 73 3 13 2
## 107 6 8 2
## 129 8 9 2
## 14 10 12 1
## 26 11 17 1
## 29 12 15 1
## 33 13 15 1
## 57 2 13 1
## 132 8 12 1
## 1 1 2 0
## 3 8 17 0
## 5 9 11 0
## 6 9 12 0
## 8 9 14 0
## 9 9 15 0
## 10 9 16 0
## 11 9 17 0
## 12 10 11 0
## 13 1 12 0
## 15 10 13 0
## 16 10 14 0
## 17 10 15 0
## 18 10 16 0
## 20 11 12 0
## 21 11 13 0
## 22 11 14 0
## 25 11 16 0
## 28 12 14 0
## 31 12 17 0
## 32 13 14 0
## 36 13 17 0
## 39 14 17 0
## 40 15 16 0
## 43 1 15 0
## 44 1 16 0
## 45 1 17 0
## 47 2 4 0
## 48 2 5 0
## 49 1 3 0
## 50 2 6 0
## 51 2 7 0
## 52 2 8 0
## 53 2 9 0
## 54 2 10 0
## 55 2 11 0
## 56 2 12 0
## 59 2 15 0
## 61 2 16 0
## 64 3 5 0
## 65 3 6 0
## 66 3 7 0
## 67 3 8 0
## 71 1 5 0
## 72 3 12 0
## 75 3 15 0
## 76 3 16 0
## 77 3 17 0
## 78 4 5 0
## 80 4 7 0
## 81 4 8 0
## 82 1 6 0
## 83 4 9 0
## 84 4 10 0
## 85 4 11 0
## 86 4 12 0
## 87 4 13 0
## 88 4 14 0
## 89 4 15 0
## 90 4 16 0
## 91 4 17 0
## 93 1 7 0
## 95 5 8 0
## 97 5 10 0
## 100 5 13 0
## 101 5 14 0
## 102 5 15 0
## 103 5 16 0
## 104 1 8 0
## 105 5 17 0
## 108 6 9 0
## 109 6 10 0
## 110 6 11 0
## 111 6 12 0
## 112 6 13 0
## 113 6 14 0
## 114 6 15 0
## 115 1 9 0
## 116 6 16 0
## 120 7 10 0
## 121 7 11 0
## 122 7 12 0
## 123 7 13 0
## 124 7 14 0
## 125 7 15 0
## 126 1 10 0
## 127 7 16 0
## 130 8 10 0
## 133 8 13 0
## 134 8 14 0
## 135 8 15 0
## 136 8 16 0
##
## $ShortestPathLengths
## 1 2 3 4 5 6 7
## 1 0.000000 14.543176 7.815801 5.512190 13.468679 14.591869 21.698259
## 2 14.543176 0.000000 12.308587 14.612198 24.431638 22.056322 18.165942
## 3 7.815801 12.308587 0.000000 2.303611 12.123051 11.383290 18.489681
## 4 5.512190 14.612198 2.303611 0.000000 13.183717 9.079679 16.186069
## 5 13.468679 24.431638 12.123051 13.183717 0.000000 4.104039 8.978314
## 6 14.591869 22.056322 11.383290 9.079679 4.104039 0.000000 7.106391
## 7 21.698259 18.165942 18.489681 16.186069 8.978314 7.106391 0.000000
## 8 15.691390 25.786284 14.345763 16.588871 7.348172 7.509192 7.620342
## 9 21.573788 21.333650 13.757987 16.061598 11.298117 12.310092 5.203701
## 10 22.755363 14.218762 14.939561 17.243173 18.413004 19.424979 12.318589
## 11 10.905948 21.868907 9.560321 11.863932 2.562730 6.666769 11.541045
## 12 11.391921 13.403206 16.252136 16.904111 12.362593 16.466632 21.340908
## 13 5.833191 11.982817 10.693406 11.345381 17.921323 20.425060 21.131201
## 14 5.224655 9.318521 6.115805 8.419417 18.238856 17.499095 23.476928
## 15 10.542015 9.907932 11.433166 13.736777 19.101439 22.049947 18.159567
## 16 14.821620 7.193203 17.041749 19.345361 18.572596 19.335218 15.444838
## 17 15.492793 4.957154 16.383944 18.687555 20.808646 17.099168 13.208789
## 8 9 10 11 12 13 14
## 1 15.691390 21.573788 22.755363 10.905948 11.391921 5.833191 5.224655
## 2 25.786284 21.333650 14.218762 21.868907 13.403206 11.982817 9.318521
## 3 14.345763 13.757987 14.939561 9.560321 16.252136 10.693406 6.115805
## 4 16.588871 16.061598 17.243173 11.863932 16.904111 11.345381 8.419417
## 5 7.348172 11.298117 18.413004 2.562730 12.362593 17.921323 18.238856
## 6 7.509192 12.310092 19.424979 6.666769 16.466632 20.425060 17.499095
## 7 7.620342 5.203701 12.318589 11.541045 21.340908 21.131201 23.476928
## 8 0.000000 11.036212 18.151099 4.785442 18.914319 21.524581 20.461568
## 9 11.036212 0.000000 7.114887 13.860847 21.486230 15.927500 19.873792
## 10 18.151099 7.114887 0.000000 20.975734 16.607439 20.486087 19.529748
## 11 4.785442 13.860847 20.975734 0.000000 14.925323 16.739139 15.676126
## 12 18.914319 21.486230 16.607439 14.925323 0.000000 5.558730 16.616576
## 13 21.524581 15.927500 20.486087 16.739139 5.558730 0.000000 11.057846
## 14 20.461568 19.873792 19.529748 15.676126 16.616576 11.057846 0.000000
## 15 21.324151 21.327274 14.212387 16.538709 11.562697 12.083242 5.317361
## 16 23.065180 18.612545 11.497658 21.135327 6.210003 8.988429 10.925944
## 17 20.829130 16.376496 9.261609 20.347560 8.446052 11.224478 10.268139
## 15 16 17
## 1 10.542015 14.821620 15.492793
## 2 9.907932 7.193203 4.957154
## 3 11.433166 17.041749 16.383944
## 4 13.736777 19.345361 18.687555
## 5 19.101439 18.572596 20.808646
## 6 22.049947 19.335218 17.099168
## 7 18.159567 15.444838 13.208789
## 8 21.324151 23.065180 20.829130
## 9 21.327274 18.612545 16.376496
## 10 14.212387 11.497658 9.261609
## 11 16.538709 21.135327 20.347560
## 12 11.562697 6.210003 8.446052
## 13 12.083242 8.988429 11.224478
## 14 5.317361 10.925944 10.268139
## 15 0.000000 7.186828 4.950778
## 16 7.186828 0.000000 2.236049
## 17 4.950778 2.236049 0.000000
##
## attr(,"class")
## [1] "list" "centrality_auto"
centralityPlot(Network, include = c("Strength", "Closeness", "Betweenness"))
## Note: z-scores are shown on x-axis rather than raw centrality indices.
※1行目のbootnet関数の中で,statistics = c(“edge”, “strength”, “closeness”, “betweenness”) というオプションを新たに指定していることに注意。bootnetパッケージのバージョン1.3では,オプションを指定しないとclosenessやbetweennessについての計算が実施されない仕様になっている。
set.seed(2020) # 再現可能な分析結果を得るため,任意のシードを指定
boot1 <- bootnet(Network, nBoots = 2500, nCores =8,
statistics = c("edge", "strength", "closeness", "betweenness"))
## Note: bootnet will store only the following statistics: edge, strength, closeness, betweenness
## Estimating sample network...
## Estimating Network. Using package::function:
## - qgraph::EBICglasso for EBIC model selection
## - using glasso::glasso
## - qgraph::cor_auto for correlation computation
## - using lavaan::lavCor
## Warning in EBICglassoCore(S = S, n = n, gamma = gamma, penalize.diagonal
## = penalize.diagonal, : A dense regularized network was selected (lambda <
## 0.1 * lambda.max). Recent work indicates a possible drop in specificity.
## Interpret the presence of the smallest edges with care. Setting threshold =
## TRUE will enforce higher specificity, at the cost of sensitivity.
## Bootstrapping...
## Computing statistics...
plot(boot1, labels = FALSE, order = "sample")
最終行で出力されるCS係数 (cor=0.7) は,「0.5以上の値を取れば,その中心性指標は十分安定している」という解釈になる。今回の場合,「CS係数が0.44となったstrengthはいくぶん注意すれば解釈可能だが,CS係数が0.05となったclosenessとbetweennessについては結果を鵜呑みにしない方が良い」ということになる。 ※ここでも,tatistics = c(“edge”, “strength”, “closeness”, “betweenness”) というオプションを追加している。
set.seed(2020) # 再現可能な分析結果を得るため,任意のシードを指定
boot2 <- bootnet(Network, nBoots = 2500, type = "case", nCores =8,
statistics = c("strength", "closeness", "betweenness"))
## Note: bootnet will store only the following statistics: strength, closeness, betweenness
## Estimating sample network...
## Estimating Network. Using package::function:
## - qgraph::EBICglasso for EBIC model selection
## - using glasso::glasso
## - qgraph::cor_auto for correlation computation
## - using lavaan::lavCor
## Warning in EBICglassoCore(S = S, n = n, gamma = gamma, penalize.diagonal
## = penalize.diagonal, : A dense regularized network was selected (lambda <
## 0.1 * lambda.max). Recent work indicates a possible drop in specificity.
## Interpret the presence of the smallest edges with care. Setting threshold =
## TRUE will enforce higher specificity, at the cost of sensitivity.
## Bootstrapping...
## Computing statistics...
plot(boot2, c("strength", "closeness", "betweenness"))
## Warning: Removed 3 rows containing missing values (geom_path).
## Warning: Removed 3 rows containing missing values (geom_point).
corStability(boot2)
## === Correlation Stability Analysis ===
##
## Sampling levels tested:
## nPerson Drop% n
## 1 90 74.9 222
## 2 118 67.1 239
## 3 146 59.3 284
## 4 174 51.5 225
## 5 201 44.0 250
## 6 229 36.2 236
## 7 257 28.4 263
## 8 285 20.6 248
## 9 313 12.8 258
## 10 341 5.0 275
##
## Maximum drop proportions to retain correlation of 0.7 in at least 95% of the samples:
##
## betweenness: 0.05 (CS-coefficient is lowest level tested)
## - For more accuracy, run bootnet(..., caseMin = 0, caseMax = 0.128)
##
## closeness: 0.05 (CS-coefficient is lowest level tested)
## - For more accuracy, run bootnet(..., caseMin = 0, caseMax = 0.128)
##
## strength: 0.44
## - For more accuracy, run bootnet(..., caseMin = 0.362, caseMax = 0.515)
##
## Accuracy can also be increased by increasing both 'nBoots' and 'caseN'.
plot(boot1, "edge", plot = "difference", onlyNonZero = TRUE, order = "sample")
## Expected significance level given number of bootstrap samples is approximately: 0.05
下記コード内の“strength”を“closeness”や“betweenness”に書き換えれば,他の中心性指標についても同様の一対比較を実施できる。
plot(boot1,"strength", plot = "difference", order = "sample")
## Expected significance level given number of bootstrap samples is approximately: 0.05