https://github.com/paytonjjones/networktree
Recursive partitioning (tree models) of psychometric networks
https://github.com/paytonjjones/networktree
network-analysis psychometrics tree-models
Last synced: 4 months ago
JSON representation
Recursive partitioning (tree models) of psychometric networks
- Host: GitHub
- URL: https://github.com/paytonjjones/networktree
- Owner: paytonjjones
- Created: 2018-10-30T18:00:49.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2022-09-05T18:44:29.000Z (almost 4 years ago)
- Last Synced: 2026-02-17T05:54:21.561Z (4 months ago)
- Topics: network-analysis, psychometrics, tree-models
- Language: R
- Homepage: https://paytonjjones.github.io/networktree/
- Size: 36 MB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/README-"
)
require(networktree)
require(qgraph)
require(grid)
data("dass")
```
Psychometric networks provide information about the statistical relationships between observed variables. ***networktree*** is a package for partitioning psychometric networks to reveal heterogeneity.
Consider a depression network where the nodes represent different symptoms:
```{r, echo = FALSE, fig.height=4, fig.width=4}
# 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")
colnames(dass)[match(nodeVars, colnames(dass))] <- dNames
pcorDassDep <- qgraph(cor(dass[,dNames]), graph="pcor", labels=dNames, vsize=15, layout="spring", label.norm="OOOOO")
```
***networktree*** can be used to identify if this depression network is heterogeneous depending on the sample characteristics. For instance, we can test whether the network differs depending on participants' marital status.
```{r, echo = FALSE}
tree1 <- networktree(nodevars=dass[,dNames], splitvars=dass[,"married",drop=F])
plot(tree1, transform="pcor",
labels=dNames, vsize=15, layout=pcorDassDep$layout, label.norm="OOOOO",
partyargs=list(gp=gpar(fontsize=10)))
```
We can explore multiple characteristics at once, with the more important splitting characteristics being prioritized in the tree model. Continuous partitioning variables (e.g., age) can be included, and ***networktree*** will automatically search for the ideal split point(s).
```{r, echo = FALSE, fig.width=10, fig.height=6.5}
tree_complex <- networktree(nodevars=dass[,dNames], splitvars=dass[,c("age", "race"),drop=F])
plot(tree_complex,transform="pcor",
labels=dNames, vsize=15, layout=pcorDassDep$layout, label.norm="OOOOO",
partyargs=list(gp=gpar(fontsize=7)))
```
Resources:
* [Home Page](https://paytonjjones.github.io/networktree/)
* [Getting Started - Tutorial](https://paytonjjones.github.io/networktree/index.html)
* [CRAN documentation](https://cran.r-project.org/web/packages/networktree/index.html)
* [Example application](https://paytonjjones.github.io/networktree/articles/returns.html)
* [Published paper](https://rdcu.be/b9Kyw) for a more advanced look.
To cite ***networktree***, use:
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)