paytonjjones / networktree Goto Github PK
View Code? Open in Web Editor NEWRecursive partitioning (tree models) of psychometric networks
Home Page: https://paytonjjones.github.io/networktree/
Recursive partitioning (tree models) of psychometric networks
Home Page: https://paytonjjones.github.io/networktree/
There is no dedicated predict method for network trees.
RStudio not recognizing compare tree; see below error. Thanks Payton!
comparetree(tree1, id1 = 1,id2 = 2, plot=TRUE)
Error in comparetree(tree1, id1 = 1, id2 = 2, plot = TRUE) :
could not find function "comparetree"
Hi Payton,
the files tipi.rda and dass.rda are "gzip compressed data, from HPFS filesystem (OS/2, NT)."
This means that I get the message
Warning: file ‘dass.rda’ has magic number 'RDX3' Use of save versions prior to 2 is deprecated
Error in load(zfile, envir = envir) : bad restore file magic number (file may be corrupted) -- no data loaded
when trying to install networktree.
The file workaholic.rda is "bzip2 compressed data, block size = 900k" and gives no problem.
Bye
I get a weird looking plot when I tried to plot:
code:
tree <- networktree(nodevars=all_var[,2:28],
splitvars=all_var[,c("age","Marital","Education","pride","life",
"family","economy","contribute","threats","perception")],
type="glasso")
plot(tree, layout="spring")
Warning messages:
1: In graphics::par(fig = gridBase::gridFIG(), mar = rep(0, 4), new = TRUE) :
calling par(new=TRUE) with no plot
2: In doTryCatch(return(expr), name, parentenv, handler) :
cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)
3: In doTryCatch(return(expr), name, parentenv, handler) :
cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)
Hello,
I've been trying to run networktree on the attached data (which I understand to be a random sample of the publicly available BIG 5 data from IPIP), I'm guessing that the reason why networktree fails to run is because there are some sub-groups that have too small a sample relative to the number of nodes in the network.
Would there be a way to perhaps persist on computing the network on the sub-group either by using some variant of GLASSO or simply throwing up a warning message for the sub-groups on which a correlational network could not be estimated?
library(data.table)
library(networktree)
d_efa <- data.table::fread(input = here::here("data/EFA_BIG5.csv"))
col_idx <- colnames(d_efa)[-1:-6]
networktree::networktree(
nodevars = d_efa[, col_idx, with = FALSE],
splitvars = d_efa[, c("race", "age", "engnat", "gender", "hand", "country")],
method = "mob",
model = "correlation",
transform = "cor"
)
#> Error in fit(y = y, x = x, start = start, weights = weights, offset = offset, : mvnfit: n < k*(k-1)/2, correlation matrix is not identified.
Created on 2024-04-29 with reprex v2.1.0
In some cases plotting a network tree in a new device fails.
I detected the problem writing a vignette:
networktree/vignettes/returns.Rmd
Line 98 in 78498a9
However, the issue also occurs when plotting in an interactive R session, e.g.:
library("networktree")
set.seed(111)
data("FXRatesCHF", package = "fxregime")
currencies <- c("USD", "JPY", "DUR", "CNY", "INR", "GBP", "ZAR")
returns <- fxregime::fxreturns(currencies, data = FXRatesCHF)
returns <- na.omit(returns)
returns$year <- as.POSIXlt(zoo::index(returns))$year
returns$isLeap <- (returns$year %% 4) == 0
returns$yday <- as.POSIXlt(zoo::index(returns))$yday
returns$time <- 1900 + returns$year + returns$yday / ifelse(returns$isLeap, 366, 365)
f <- paste(paste(currencies, collapse = " + "), "~ time")
f <- as.formula(f)
tr <- networktree(f, data = returns, cor = TRUE, maxdepth = 3)
plot(tr, type = "pcor", posCol = "#008585", negCol = "#C7522B", maximum = 1)
Add a plot for models with splits in mean and variance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.