rcausal: R Wrapper for Tetrad Library

rcausalR Documentation

R Wrapper for Tetrad Library

Description

rcausal is an R wrapper package containing a range of causal and statistical model algorithms from the Tetrad library.

Details

rcausal is a program which creates, simulates data from, estimates, tests, predicts with, and searches for causal and statistical models. The aim of the program is to provide sophisticated methods in a friendly interface requiring very little statistical sophistication of the user and no programming knowledge. It is not intended to replace flexible statistical programming systems such as Matlab, Splus or R. rcausal is freeware that performs many of the functions in commercial programs such as Netica, Hugin, LISREL, EQS and other programs, and many discovery functions these commercial programs do not perform.

rcausal is unique in the suite of principled search (“exploration”,“discovery”) algorithms it provides–for example its ability to search when there may be unobserved confounders of measured variables, to search for models of latent structure, and to search for linear feedback models–and in the ability to calculate predictions of the effects of interventions or experiments based on a model. All of its search procedures are “pointwise consistent”–they are guaranteed to converge almost certainly to correct information about the true structure in the large sample limit, provided that structure and the sample data satisfy various commonly made (but not always true!) assumptions.

rcausal is limited to models of categorical data (which can also be used for ordinal data) and to linear models (“structural equation models”) with a Normal probability distribution, and to a very limited class of time series models. The rcausal programs describe causal models in three distinct parts or stages: a picture, representing a directed graph specifying hypothetical causal relations among the variables; a specification of the family of probability distributions and kinds of parameters associated with the graphical model; and a specification of the numerical values of those parameters.

The program and its search algorithms have been developed over several years with support from the National Aeronautics and Space Administration and the Office of Naval Research. Joseph Ramsey has implemented most of the program, with substantial assistance from Frank Wimberly.

Examples

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.