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
| # Input: | |
| payout <- 35 | |
| winSpaces <- 1 | |
| allSpaces <- 37 | |
| bet <- 10 | |
| # Probability: | |
| p <- winSpaces / allSpaces | |
| # Expected value: |
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") | |
| 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: |
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") | |
| library("bootnet") | |
| set.seed(1) | |
| # Number of nodes: | |
| nNode <- 10 | |
| # random point estimates: | |
| pointests <- runif(nNode,0,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
| # 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: |
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
| # Packages needed: | |
| library("qgraph") | |
| library("dplyr") | |
| # Create a deck: | |
| createDeck <- function(){ | |
| data.frame( | |
| card = 1:60, | |
| type = rep(c("land","spell","spell"), length = 60) | |
| ) |
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: |
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
| 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
| 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) |