Skip to content

Instantly share code, notes, and snippets.

Sacha Epskamp SachaEpskamp

Block or report user

Report or block SachaEpskamp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SEset2.R
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)
View SEset1.R
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)
View parSim_example_psychonetrics_2
library("parSim")
parSim(
### SIMULATION CONDITIONS
# Vary sample size:
sampleSize = c(250, 500, 1000),
# Vary missingness:
missing = c(0, 0.1, 0.25),
View parSim_example_psychonetrics_1.R
library("parSim")
parSim(
### SIMULATION CONDITIONS
# Vary sample size:
sampleSize = c(250, 500, 1000),
# Vary missingness:
missing = c(0, 0.1, 0.25),
View compareNetworks.R
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)
View ggraph_example.R
# Install from github:
devtools::install_github("sachaepskamp/qgraph")
library("qgraph")
# Example network to play with:
# Load data:
library("psychTools")
data(bfi)
# Compute polychoric correlations:
View magicFuns.R
# Packages needed:
library("qgraph")
library("dplyr")
# Create a deck:
createDeck <- function(){
data.frame(
card = 1:60,
type = rep(c("land","spell","spell"), length = 60)
)
View qgraphmap.R
# Load network:
library("maps")
library("qgraph")
map("world", fill=TRUE, col="white", bg="lightblue", ylim=c(-60, 90), mar=c(0,0,0,0))
# Some network with 4 nodes:
Adj <- matrix(1,4,4)
# Layout using coordinates:
View pieCIexample.R
library("qgraph")
library("bootnet")
set.seed(1)
# Number of nodes:
nNode <- 10
# random point estimates:
pointests <- runif(nNode,0,1)
View pieRange.R
library("qgraph")
library("bootnet")
# Number of nodes:
nNode <- 10
# Make a list with intervals:
intervals <- replicate(nNode,sort(runif(2,0.5,1)),simplify = FALSE)
# Rescale intervals so they represent difference:
You can’t perform that action at this time.