-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.Rmd
More file actions
59 lines (45 loc) · 1.97 KB
/
index.Rmd
File metadata and controls
59 lines (45 loc) · 1.97 KB
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
---
output: github_document
---
<!-- index.md is generated from index.Rmd. Please edit that file and run rmarkdown::render("index.Rmd") -->
## Network Trees: Recursive Partitioning of Network Models
```{r, include = FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/index-"
)
library("networktree")
library("qgraph")
library("grid")
data("dass", package = "networktree")
abbrev <- function(x, n = 7L) {
ifelse(nchar(x) > (n + 1L), paste0(substr(x, 1, n), "."), x)
}
```
Correlation-based network models, also known as psychometric networks, provide information about the
statistical relationships between observed variables. To reveal significant differences in such networks
with respect to covariates, network trees recursively partition the data and fit separate network models
in the resulting subsamples.
The **networktree** package implements two network tree algorithms:
model-based trees based on a multivariate normal model and nonparametric trees based on covariance
structures.
```{r networktree, echo = FALSE, fig.width=12, fig.height=7, dev="svg"}
# depression items from dass 21
nodeVars <- c("dass3_D", "dass42_D", "dass10_D", "dass13_D",
"dass31_D", "dass17_D", "dass38_D")
dNames <- c("anhedonia", "initiative", "lookforward", "sad",
"unenthused", "worthless", "meaningless")
dNames <- abbrev(dNames, n = 8L)
colnames(dass)[match(nodeVars, colnames(dass))] <- dNames
tree_complex <- networktree(
nodevars = dass[,dNames],
splitvars = dass[,c("age", "race"), drop=FALSE],
alpha = 0.01)
plot(tree_complex, transform = "pcor",
labels = dNames, vsize = 20, label.norm = "OOOOO",
tnex = 2.75,
partyargs = list(gp = gpar(fontsize=11)),
posCol = "#008585", negCol = "#C7522B") ## from hcl.colors(2, "Geyser")
```
**Reference:**
Jones, P.J., Mair, P., Simon, T., Zeileis, A. (2020). Network trees: A method for recursively partitioning covariance structures. _Psychometrika_.
**85**(4), 926-945. [doi:10.1007/s11336-020-09731-4](https://doi.org/10.1007/s11336-020-09731-4)