sachaepskamp / lvnet Goto Github PK
View Code? Open in Web Editor NEWLatent variable network models
Latent variable network models
library("lvnet")
library("psych")
library("lavaan")
data(HolzingerSwineford1939)
Data <- HolzingerSwineford1939[,7:15]
Lambda <- matrix(0, 9, 3)
Lambda[1:3,1] <- NA
Lambda[4:6,2] <- NA
Lambda[7:9,3] <- NA
CFA <- lvnet(Data, lambda = Lambda)
Error in if (any(select)) { : missing value where TRUE/FALSE needed
Was simply trying to work through the example on the readme but had the following error pop up.
Hi Sacha,
(I subscribed to GitHub!)
Question: How does lvnet determine the degrees of freedom of a model?
The question follows from the following: Below I fit a confirmatory network model on raw data. The model is saturated, so I expect the chi-square to be 0 with 0 degrees of freedom. According to the outcome of lvnet, the chi-square value is 0 indeed, but it reports a df of 9. That is understandable in the light of the number of parameters lvnet reports, namely 1, but I disagree with that number: lvnet estimated 4 omega_deltas and 6 omega_thetas, so parameters 10 in total (although the parameterization is in theta_inverse, if I understand correctly ). This would make the dfs equal 0.
no <- 250
nv <- 4
mvec <- rep( 0,nv )
cmat <- matrix( scan(), nv, nv, TRUE )
4.3685800 3.9192711 0.8919471 2.427868
3.9192711 6.0460335 0.9923974 2.517379
0.8919471 0.9923974 2.1397640 1.317591
2.4278675 2.5173785 1.3175909 35.906516
dat <- MASS::mvrnorm( no, mvec, cmat,emp = TRUE )
check <- lvnet(dat, omega_theta = diag( 0, nv ) / diag( nv ) )
( estpcor <- check$matrices$omega_theta + diag( nv) )
cor2pcor( cmat ) # OK!
round ( check$fitMeasures$chisq, 8 ) # OK!
check$fitMeasures$df # Err.... not OK!
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.