This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FIML multilevel | |
# Model described in https://psyarxiv.com/8ha93/ | |
# See also http://statmodel.com/bmuthen/articles/Article_055.pdf | |
# Load packages: | |
library("lavaan") | |
library("psychonetrics") | |
library("bootnet") | |
library("mvtnorm") | |
library("qgraph") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("qgraph") | |
# https://twitter.com/EikoFried/status/1208502815099932685 | |
# Symposia: | |
Symposia <- list( | |
# 1. | |
centrality = c("Eiko Fried", "Ciaran O'Driscoll", "Joshua Buckman", "Donald Robinaugh", "Teague Henry", "Laura Bringmann"), | |
computational = c("Julian Burger", "Donald Robinaugh", "Lucy Robinson", "Jonas Haslbeck", "Teague Henry", "Sacha Epskamp"), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage[ | |
paperwidth=27cm,paperheight=13cm, | |
margin=1cm, | |
]{geometry} | |
\usepackage{amsmath} | |
\usepackage{amsfonts} | |
\usepackage{amssymb} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("bootnet") | |
library("mvtnorm") | |
library("qgraph") | |
# Sample size: | |
n <- 40000 | |
# Generate 10-node chain graph with positive edges: | |
net <- genGGM(10, propPositive = 1, constant = 1.1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("SEset") | |
library("qgraph") | |
library("pcalg") | |
# For true DAG: | |
A <- matrix(c( | |
0,0.25,0.25, | |
0,0,0, | |
0,0,0 | |
),3,3,byrow=TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("SEset") | |
library("qgraph") | |
library("pcalg") | |
# For true DAG: | |
A <- matrix(c( | |
0,0,0, | |
0.25,0,0, | |
0,0.25,0 | |
),3,3,byrow=TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("parSim") | |
parSim( | |
### SIMULATION CONDITIONS | |
# Vary sample size: | |
sampleSize = c(250, 500, 1000), | |
# Vary missingness: | |
missing = c(0, 0.1, 0.25), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("parSim") | |
parSim( | |
### SIMULATION CONDITIONS | |
# Vary sample size: | |
sampleSize = c(250, 500, 1000), | |
# Vary missingness: | |
missing = c(0, 0.1, 0.25), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compareNetworks <- function(true,est, directed = FALSE){ | |
cor0 <- function(x,y,...){ | |
if (sum(!is.na(x)) < 2 || sum(!is.na(y)) < 2 || sd(x,na.rm=TRUE)==0 | sd(y,na.rm=TRUE) == 0){ | |
return(0) | |
} else { | |
return(cor(x,y,...)) | |
} | |
} | |
bias <- function(x,y) mean(abs(x-y),na.rm=TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install from github: | |
devtools::install_github("sachaepskamp/qgraph") | |
library("qgraph") | |
# Example network to play with: | |
# Load data: | |
library("psychTools") | |
data(bfi) | |
# Compute polychoric correlations: |