rcausal

R Wrapper for Tetrad Library, for more details see https://github.com/bd2kccd/r-causal.

R Library Requirement

R >= 3.3.0, stringr, rJava

Installation

Install the R library requirements:

### These packages should be available upon building due to DESCRIPTION imports clause.
#install.packages("stringr")
#install.packages("rJava")

Install the r-causal from github

library(devtools)
#install_github("bd2kccd/r-causal")
require(rcausal)

Example

data("charity")    #Load the charity dataset
tetradrunner <- tetradrunner(algoId = 'fges',df = charity,scoreId = 'sem-bic', dataType = 'continuous',faithfulnessAssumed=TRUE,maxDegree=-1,verbose=TRUE)    #Compute FGES search
tetradrunner$nodes #Show the result's nodes
tetradrunner$edges #Show the result's edges

graph <- tetradrunner$graph
graph$getAttribute('BIC')

nodes <- graph$getNodes()
for(i in 0:as.integer(nodes$size()-1)){
    node <- nodes$get(i)
    cat(node$getName(),": ",node$getAttribute('BIC'),"\n")
}


bd2kccd/r-causal documentation built on Aug. 29, 2023, 9:17 a.m.