GithubHelp home page GithubHelp logo

lvnet's People

Contributors

sachaepskamp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lvnet's Issues

Error in if (any(select)) { : missing value where TRUE/FALSE needed

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.

dfs

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.

setup

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

simulate

dat <- MASS::mvrnorm( no, mvec, cmat,emp = TRUE )

fit (saturated) network model

check <- lvnet(dat, omega_theta = diag( 0, nv ) / diag( nv ) )

result

( estpcor <- check$matrices$omega_theta + diag( nv) )

compare with:

cor2pcor( cmat ) # OK!

chi-square (should be 0)

round ( check$fitMeasures$chisq, 8 ) # OK!

dfs (should be 0)

check$fitMeasures$df # Err.... not OK!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.