Git Product home page Git Product logo

r-causal's Introduction

Note 2023--4-1: This version of RCausal uses an older version of Tetrad from at least 5 years ago. We have updated our Python integration to the most recent version of Tetrad in a separste project--see rpy-tetrad.

R-causal has not been maintained for some time now, as the tireless maintainer has since moved on to different work :-)... but going back through some of the issues posted for r-causal gives some hints as to additional functionality that pytetrad/R should have. We'll try to get caught up.

r-causal

R Wrapper for Tetrad Library

R Library Requirement

R >= 3.3.0, stringr, rJava

Installation

  • Install the R library requirements:
install.packages("stringr")
install.packages("rJava")
  • Install r-causal from github:
library(devtools)
install_github("bd2kccd/r-causal")

Example

Continuous Dataset

library(rcausal)
data("charity")   #Load the charity dataset

tetradrunner.getAlgorithmDescription(algoId = 'fges')
#Compute FGES search
tetradrunner <- tetradrunner(algoId = 'fges',df = charity,scoreId = 'sem-bic',
dataType = 'continuous',faithfulnessAssumed=TRUE,maxDegree=-1,verbose=TRUE)

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")
}

Discrete Dataset

library(rcausal)
data("audiology")    #Load the charity dataset

#Compute FGES search
tetradrunner <- tetradrunner(algoId = 'fges',df = audiology,scoreId = 'cg-bic-score',dataType = 'discrete',
faithfulnessAssumed=TRUE,maxDegree=-1,verbose=TRUE)

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")
}

Prior Knowledge

Create PriorKnowledge Object

forbid <- list(c('TangibilityCondition','Impact')) # List of forbidden directed edges
require <- list(c('Sympathy','TangibilityCondition')) # List of required directed edges
forbiddenWithin <- c('TangibilityCondition','Imaginability')
class(forbiddenWithin) <- 'forbiddenWithin' # Make this tier forbidden within
temporal <- list(forbiddenWithin, c('Sympathy','AmountDonated'),c('Impact')) # List of temporal node tiers
prior <- priorKnowledge(forbiddirect = forbid, requiredirect = require, addtemporal = temporal)
tetradrunner <- tetradrunner(algoId = 'fges',df = charity,scoreId = 'fisher-z',
dataType = 'continuous',alpha=0.1,faithfulnessAssumed=TRUE,maxDegree=-1,verbose=TRUE, 
priorKnowledge = prior)

Load Knowledge File

# knowledge file: audiology.prior
# /knowledge
# forbiddirect
# class tymp
# class age_gt_60
# class notch_at_4k
# 
# requiredirect
# history_noise class
#
# addtemporal
# 0* bser late_wave_poor tymp notch_at_4k o_ar_c ar_c airBoneGap air bone o_ar_u airBoneGap
# 1 history_noise history_dizziness history_buzzing history_roaring history_recruitment history_fluctuating history_heredity history_nausea
# 2 class

prior <- priorKnowledgeFromFile('audiology.prior')
tetradrunner <- tetradrunner(algoId = 'fges',df = audiology,scoreId = 'bdeu',dataType = 'discrete',
alpha=0.1,faithfulnessAssumed=TRUE,maxDegree=-1,verbose=TRUE, priorKnowledge = prior)

Plot a DOT graph

library(DOT)
graph_dot <- tetradrunner.tetradGraphToDot(tetradrunner$graph)
dot(graph_dot)

Useful rJava Trouble-shooting Installation in Mac OS X Links

  1. http://stackoverflow.com/questions/26948777/how-can-i-make-rjava-use-the-newer-version-of-java-on-osx/32544358#32544358
  2. http://andrewgoldstone.com/blog/2015/02/03/rjava/
  3. https://stackoverflow.com/questions/7019912/using-the-rjava-package-on-win7-64-bit-with-r/7604469#7604469

Citation

DOI

r-causal's People

Contributors

amurrayw avatar chirayukong avatar espinoj avatar jdramsey avatar professorbeautiful avatar scottporter avatar yasu-sh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r-causal's Issues

Catastrophic error with r-causal javax.xml.documentbuilder

Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

# note: this works, well, doesn't work, that is, it breaks with "real" (read: "truthy") data as well =>
> library(rcausal)
> a <- c(1,1,1,0,0,0)
> b <- c(1,1,1,1,0,0)
> c <- c(0,0,0,1,0,0)
> dat <- data.frame(a,b,c)
> fges.discrete(dat)
Datasets:
dat 

Error in .jnew("edu/cmu/tetrad/search/Fges", score) : 
  java.lang.NoClassDefFoundError: Could not initialize class edu.cmu.tetrad.util.TetradLogger
> pcmax(dat)
Error in .jnew("edu/cmu/tetrad/search/IndTestFisherZ", tetradData, significance) : 
  javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created

Seeing similar issue in Java API.
Java versions: 9ea, 8u121, 8u111, 7, both oracle and openjdk.
Not sure what has happened. 8/

unsupported major/minor issue on OS X


> a <- c(1,1,1,0,0,0)
> b <- c(1,0,0,1,1,0)
> c <- c(0,1,1,1,0,0)
> dat <- data.frame(a,b,c)
> fges.discrete(dat)
node_names:  a 
value: [1] 0 1

Error in .jnew("edu/cmu/tetrad/data/DiscreteVariable", nodname, cate_list) : 
  java.lang.UnsupportedClassVersionError: edu/cmu/tetrad/data/DiscreteVariable : Unsupported major.minor version 51.0

Is it possible to get the score of each training data?

It seems the graph object (returned by tetradrunner) contains only the model and nodes scores. I wonder whether there are any ways to also get the scores of data in R?

I am running continuous fGES with 'sem-bic-score'. Thanks in advance!

CCD algorithm does not work

library(stringr)
library(rJava)
library(rcausal)
data("audiology")
ccd <- ccd(df=audiology, continuous = FALSE, depth = -1, verbose = TRUE)

Error in .jcall(ccd_instance, "V", "setVerbose", verbose) :
method setVerbose with signature (Z)V not found

Unrecognized edge type o--

Running a bootstrapped tetradrunner using FCI will sometimes output an edge type like 'o--'.

This produces the error in the title when I try to use the causality package to get the edge stability.

Why would tetrad produce that edge type?

no pcmax implementation in bd2kccd/r-causal

Greetings,
Please put a means to implement pcmax in r-causal. I am performing randomized sub-sampling of millions of rows/observations (and between 20 to 30K+ discrete binary variables) and I am going to do an alpha = .000005. I will be looking for stable edges across samples.
Thanks!
Scott

Add ccd-helpdesk as member of this repository

Hi,

This is Ruben in behalf the CCD-helpdesk. Can you add this github user: "ccd-helpdesk" as members of the bdk2kccd/r-causal repository. We just want to be notified in our gmail account about issues we can response to, for example, problems formatting data, interpretation of algorithm output, etc.

Thanks,

Ruben

documentation comment - converting graphNEL to igraph

Put "library(igraph)" in the code snippet area in invoke package when converting graphNEL object to igraph. Otherwise, it would likely annoy the user. I would change the name of the variable as well to, say, "g", a nice generic graph variable name that is not to be confused with the pckg name.
Best,
-S

gfci.discrete weirdness (can't execute)

gfci.discrete(
df= maxPathLength= verbose=
structurePrior= significance= java.parameters=
samplePrior= completeRuleSetUsed= priorKnowledge=
maxDegree= faithfulnessAssumed=
gfci.discrete(df = dat)
Error: could not find function "gfci.discrete"

Converting discrete data to continuous

Greetings,
Is it viable to convert discrete data (1 and 0) to continuous (1.0 and 0.0)? Going further, would it be ok to convert discrete data to continuous and from continuous data to a pairwise correlation matrix?

assorted r-causal issues

A few things:

  • fges/fges.discrete: what happened to graphNEL output? It seems to have gone missing this iteration. The graphNEL format is really convenient for exporting graph topology from TETRAD when working with other packages (bnlearn, deal, etc.). Please add that back in at your earliest convenience! If not graphNEL, then the outputObject$edges should at least be in some format that is easily exportable to graph, In igraph, or network R packages/libraries. In terms of r-causal being an API, it should probably be consistent across structure learning algorithms, with the notable exceptions of the FCI variants (fci/rfci/gfci/etc.) on account of the 'hidden latent variable' indicator notation in the resulting graphs.
  • gfci/gfci.discrete: still seeing null pointer exception.
  • bayesEst: unsightly "java-Object" in output. Tedious material to parse.
 $dag
[1] "Java-Object{Graph Nodes:\na,b,c,d\n\nGraph Edges:\n1. b --> a\n}"
  • documentation on README.md: this is out of date. graphNEL code snippet will no longer work. Also, it is usually not a good idea to name variables after functions.

Different FGES results R and Tetrad

Hello,

I am trying to validate the FGES results I get in R with the results I get in Tetrad. I simulated a graph with 40 variables and simulated data from that graph using a Generalized SEM. Then I ran a FGES search in both R and Tetrad.

This is the command and output in R:
fgs_sim <- fges(sim, penaltydiscount=2, maxDegree=100, numOfThreads=1,faithfulnessAssumed=FALSE)

Datasets:
sim

Graph Parameters:
penalty discount = 2
maxDegree = 100
faithfulnessAssumed = FALSE
numOfThreads = 1
verbose = FALSE

No graph is returned.

This is the data I used:
simulation.txt

GFCI <- include this one too!

Just read Jiji Zhang's dissertation. Please include GFCI in future iterations as well, since it models hidden latent variables, which may be very important with messy clinical data derived (through several steps that could potentially introduce noise) from electronic health records.
Thanks!
-S

unused argument (numOfThreads = 2)

Hi, I followed instruction and installed R library requirements and r-causal. But I couldn't use function "fges" due to following error of "unused argument (numOfThreads = 2)". Could you help me? Thanks!

library(rcausal)
data("charity") #Load the charity dataset
fges <- fges(df = charity, penaltydiscount = 2, maxDegree = -1, faithfulnessAssumed = TRUE, numOfThreads = 2, verbose = TRUE)

Error in fges(df = charity, penaltydiscount = 2, maxDegree = -1, faithfulnessAssumed = TRUE, :
unused argument (numOfThreads = 2)

Failed to install "rcausal" on Windows 10

> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)
nickname You Stupid Darkness

> library(devtools)
> install_github("bd2kccd/r-causal")
Downloading GitHub repo bd2kccd/r-causal@master
from URL https://api.github.com/repos/bd2kccd/r-causal/zipball/master
Installing rcausal
"C:/PROGRA1/R/R-341.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL
"C:/Users/mot16/AppData/Local/Temp/RtmpUvrEdR/devtools20e8156b4ee8/bd2kccd-r-causal-481abd3"
--library="C:/Users/mot16/Documents/R/win-library/3.4" --install-tests

* installing source package 'rcausal' ...
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'rcausal':
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/mot16/Documents/R/win-library/3.4/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/mot16/Documents/R/win-library/3.4/rcausal'
Installation failed: Command failed (1)

Problem setting up r-causal

@chirayukong

Hi, this problem came from Peter Spirtes, through the Helpdesk:

I tried to follow the instructions for using r-causal but I could not get it to work.

install.packages("stringr")
install.packages("rJava”)
library(devtools)
install_github("bd2kccd/r-causal")
Downloading GitHub repo bd2kccd/r-causal@master
from URL https://api.github.com/repos/bd2kccd/r-causal/zipball/master
Installing rcausal
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD
INSTALL
'/private/var/folders/ph/2js0sw_j4sd01tbfb72gm5hw0000gp/T/RtmpZOcbT1/devtools1e22f624572/bd2kccd-r-causal-7c5be55'
--library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' --install-tests

  • installing source package ‘rcausal’ ...
    ** R
    ** data
    ** inst
    ** preparing package for lazy loading
    Error : .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
    Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
    Reason: image not found
    ERROR: lazy loading failed for package ‘rcausal’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rcausal’
    Installation failed: Command failed (1)

In addition, when I tried to add the libraries “rJava” using the library command, it said it couldn’t find it.

segmentation fault (core dump) on Ubuntu 17.10

> install_github("bd2kccd/r-causal", force = TRUE)
Downloading GitHub repo bd2kccd/r-causal@master
from URL https://api.github.com/repos/bd2kccd/r-causal/zipball/master
Installing rcausal
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet  \
  CMD INSTALL '/tmp/RtmpR6d2ha/devtools764c426c8253/bd2kccd-r-causal-d4f4920'  \
  --library='/usr/local/lib/R/site-library' --install-tests 

* installing *source* package ‘rcausal’ ...
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Segmentation fault (core dumped)
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/rcausal’
* restoring previous ‘/usr/local/lib/R/site-library/rcausal’
Installation failed: Command failed (1)
> 

Also, when I load up rcausal from R console, I get the same (lolololol):

smalec@smalec-ThinkPad-P50:~$ sudo R

R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(rcausal)
Segmentation fault (core dumped)
smalec@smalec-ThinkPad-P50:~$ 

List of available algorithms

Hi @chirayukong,

Is there a function to display the list of available algorithms for r-causal ?
Also, does the current version of r-causal, correspond to the most recent Tetrad version ?

Thanks,

Ruben

Prior knowledge not working correctly, at least with FGS discrete

We got a CCD Helpdesk query about prior knowledge. To answer it I created a worked example, and I found a bug: When my Prior Knowledge includes just some prior edges, it prevents FGS discrete from creating any other edges.

Here's the example. First load the library and data:

library(rcausal)
data("sim_discrete_data_20vars_100cases")

Run FGS discrete with NO prior knowledge:

fgs_agnostic <- fgs.discrete(df = sim_discrete_data_20vars_100cases)

Look at the output:

> fgs_agnostic$edges
[1] "X3 --- X7"   "X9 --- X3"   "X10 --- X4"  "X15 --> X19" "X18 --- X14" 
[6] "X11 --- X14" "X14 --- X16" "X17 --> X19" "X13 --- X6"  "X13 --- X7" 

Now try requiring two of those edges by prior knowledge. Because FGS was able to discover those edges even without prior knowledge, requiring them should not change the output at all.

known_edges <- list()
known_edges[[1]] <- c("X15", "X19")
known_edges[[2]] <- c("X17", "X19")

fgs_with_knowledge <- fgs.discrete(df = sim_discrete_data_20vars_100cases, 
                                   priorKnowledge = priorKnowledge(forbiddirect = NULL, 
                                                                   requiredirect = known_edges, 
                                                                   addtemporal = NULL))

Look at the output:

> fgs_with_knowledge$edges
[1] "X17 --> X19" "X15 --> X19"

_FGS only learns the two edges that were required in the prior knowledge._

I get the same result when instead of passing knowledge as a list, I use a knowledge file with the following text:

/knowledge
addtemporal

forbiddirect

requiredirect
X15 X19
X17 X19

I am using the most current version of R (3.3.1), rcausal, Java, and rJava. I checked that rJava is accessing the most current version of Java:

> .jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
[1] "1.8.0_101-b13"

installation issue (in CentOS)

> install_github("bd2kccd/r-causal")
Downloading GitHub repo bd2kccd/r-causal@master
from URL https://api.github.com/repos/bd2kccd/r-causal/zipball/master
Installing rcausal
'/usr/lib64/R/bin/R' --no-site-file --no-environ --no-save --no-restore  \
  --quiet CMD INSTALL  \
  '/tmp/Rtmpse1Ydn/devtools645b6d7b5a27/bd2kccd-r-causal-8c0fdbb'  \
  --library='/usr/lib64/R/library' --install-tests 

* installing *source* package ‘rcausal’ ...
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package ‘rcausal’
    finding HTML links ... done
    audiology                               html  
    bayesEst                                html  
    ccd                                     html  
    cfci                                    html  
    charity                                 html  
    cpc                                     html  
    cpcstable                               html  
    fci                                     html  
    fges                                    html  
    fges.discrete                           html  
    fges.mixed                              html  
    gfci                                    html  
    gfci.discrete                           html  
    gfci.mixed                              html  
    pc                                      html  
    pcmax                                   html  
    pcstable                                html  
    randomDag                               html  
    rcausal                                 html  
    rfci                                    html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rcausal’ in namespaceExport(ns, exports):
 undefined exports: fas.mixed
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/lib64/R/library/rcausal’
* restoring previous ‘/usr/lib64/R/library/rcausal’
Installation failed: Command failed (1)

fgs version

Is r-causal using the most recent version of fgs (ie. the one in the TETRAD project github repository) ?
Thanks.

bayesEst "Java-Object" needs to be prettified

f <- bayesEst(df = dat[sample(nrow(dat), replace = FALSE, size = 0.001*nrow(dat)),], significance = 0.05, depth = 2, verbose = TRUE); plot(igraph.from.graphNEL(f$graphNEL))
# where dat is a large, sparse binary matrix
> f$bayesIm
[1] "Java-Object{\n\nNode: aspirin\n\nvaricosity\tanticoagulants\tvascular_diseases\tesophageal_varices\tmalloryHYPHENweiss_syndrome\tacute_gastric_mucosal_erosion\t\n0\t0\t0\t0\t0\t0\t0.9294\t0.0706
\t\n0\t0\t1\t0\t0\t0\t0.6000\t0.4000\t\n0\t1\t0\t0\t0\t0\t0.7619\t0.2381\t\n0\t1\t1\t0\t0\t0\t�\t�\t\n1\t0\t0\t0
\t0\t0\t0.7586\t0.2414\t\n1\t0\t1\t0\t0\t0\t�\t�\t\n1\t1\t0\t0\t0\t0\t1.0000\t0.0000\t\n1\t1\t1\t0\t0\t0\t�\t�
\t\n\nNode: hemorrhoids\n\nesophageal_varices\tmalloryHYPHENweiss_syndrome
\tacute_gastric_mucosal_erosion\tmedication\tade\t\n0\t0\t0\t0\t0\t0.9932\t0.0068\t\n0\t0\t0\t0\t1\t0.8367
\t0.1633\t\n0\t0\t0\t1\t0\t0.9468\t0.0532\t\n0\t0\t0\t1\t1\t0.8333\t0.1667\t\n\nNode: varicosity\n
\nanticoagulants\tesophageal_varices\tmalloryHYPHENweiss_syndrome
\tacute_gastric_mucosal_erosion\tade\t\n0\t0\t0\t0\t0\t0.9901\t0.0099\t\n0\t0\t0\t0\t1\t0.8431\t0.1569
\t\n1\t0\t0\t0\t0\t0.8947\t0.1053\t\n1\t0\t0\t0\t1\t1.0000\t0.0000\t\n\nNode: anticoagulants\n
\nliver_cirrhosis\tshigella\tesophageal_... <truncated>

Very cool new feature! Can't wait until it is "purdied" up!

gfci.discrete null pointer exception error

When I

a <- c(1,1,1,0,0,0)
b <- c(1,1,0,1,1,0)
df <- data.frame(cbind(a,b))

gfci.discrete(df)

I get the following:

Graph Parameters:
structurePrior =  1 
samplePrior =  1 
maxDegree =  3 
maxPathLength =  -1 
significance =  0.05 
completeRuleSetUsed =  FALSE 
faithfulnessAssumed =  TRUE 
verbose =  FALSE 
Error in .jcall(gfci_instance, "Ledu/cmu/tetrad/graph/Graph;", "search") : 
  java.lang.NullPointerException

Yes

Do what Harry says!
also: consolidate tetrad-cmd and tetrad.
also: retain and/or import "MULT" pseudocolumn functionality across all versions!
r-causal is a mess! A delightful one, though. Keep up the good work!
BTW, using igraph package, you can convert graphNEL/RGraphviz objects to igraph objects, which are a lot easier to turn into publishable eye candy, IMHO.
-S

is it possible to increase java heap space?

Is it possible to increase java heap space from within R? My data consists of 3.6M observations of 20 variables. This was from using GFCI, the latest addition.
Thanks!

Error in .jnew("RectangularArrayBuilder", .jcast(array), dim) :
java.lang.OutOfMemoryError: Java heap space

pcmax bug I just noticed

Should there be a call to setSignificance in PcMax for pcmax.R:
.jcall(pcmax_instance, "V", "setSignificance", useSignificance)
after
.jcall(pcmax_instance, "V", "setUseHeuristic", useHeuristic)
If not, significance parameter for users will be lost (set to default).
-Scott

Installation issue on Windows 7

I tested the installation on my windows 7, got an error message after I ran install_github("bd2kccd/tetradR"). Below is the content from RStudio.


R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("rJava")
Installing package into ‘C:/Users/zhy19/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/rJava_0.9-8.zip'
Content type 'application/zip' length 766972 bytes (748 KB)
downloaded 748 KB

package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
> source("https://bioconductor.org/biocLite.R") 
Bioconductor version 3.2 (BiocInstaller 1.20.1), ?biocLite for help
> biocLite("graph")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.2 (BiocInstaller 1.20.1), R 3.2.3 (2015-12-10).
Installing package(s) ‘graph’
trying URL 'https://bioconductor.org/packages/3.2/bioc/bin/windows/contrib/3.2/graph_1.48.0.zip'
Content type 'application/zip' length 2729247 bytes (2.6 MB)
downloaded 2.6 MB

package ‘graph’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
Old packages: 'boot', 'Matrix', 'mgcv', 'nlme', 'nnet'
Update all/some/none? [a/s/n]: 
a
Warning in install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  'lib = "C:/Program Files/R/R-3.2.3/library"' is not writable
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/boot_1.3-18.zip'
Content type 'application/zip' length 591611 bytes (577 KB)
downloaded 577 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/Matrix_1.2-4.zip'
Content type 'application/zip' length 3629206 bytes (3.5 MB)
downloaded 3.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/mgcv_1.8-12.zip'
Content type 'application/zip' length 2212921 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/nlme_3.1-126.zip'
Content type 'application/zip' length 2137112 bytes (2.0 MB)
downloaded 2.0 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/nnet_7.3-12.zip'
Content type 'application/zip' length 121144 bytes (118 KB)
downloaded 118 KB

package ‘boot’ successfully unpacked and MD5 sums checked
package ‘Matrix’ successfully unpacked and MD5 sums checked
package ‘mgcv’ successfully unpacked and MD5 sums checked
package ‘nlme’ successfully unpacked and MD5 sums checked
package ‘nnet’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
> biocLite("RBGL")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.2 (BiocInstaller 1.20.1), R 3.2.3 (2015-12-10).
Installing package(s) ‘RBGL’
trying URL 'https://bioconductor.org/packages/3.2/bioc/bin/windows/contrib/3.2/RBGL_1.46.0.zip'
Content type 'application/zip' length 3132926 bytes (3.0 MB)
downloaded 3.0 MB

package ‘RBGL’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
Old packages: 'boot', 'Matrix', 'mgcv', 'nlme', 'nnet'
Update all/some/none? [a/s/n]: 
a
Warning in install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  'lib = "C:/Program Files/R/R-3.2.3/library"' is not writable
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/boot_1.3-18.zip'
Content type 'application/zip' length 591611 bytes (577 KB)
downloaded 577 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/Matrix_1.2-4.zip'
Content type 'application/zip' length 3629206 bytes (3.5 MB)
downloaded 3.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/mgcv_1.8-12.zip'
Content type 'application/zip' length 2212921 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/nlme_3.1-126.zip'
Content type 'application/zip' length 2137112 bytes (2.0 MB)
downloaded 2.0 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/nnet_7.3-12.zip'
Content type 'application/zip' length 121144 bytes (118 KB)
downloaded 118 KB

package ‘boot’ successfully unpacked and MD5 sums checked
package ‘Matrix’ successfully unpacked and MD5 sums checked
package ‘mgcv’ successfully unpacked and MD5 sums checked
package ‘nlme’ successfully unpacked and MD5 sums checked
package ‘nnet’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
> biocLite("Rgraphviz")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.2 (BiocInstaller 1.20.1), R 3.2.3 (2015-12-10).
Installing package(s) ‘Rgraphviz’
trying URL 'https://bioconductor.org/packages/3.2/bioc/bin/windows/contrib/3.2/Rgraphviz_2.14.0.zip'
Content type 'application/zip' length 3670424 bytes (3.5 MB)
downloaded 3.5 MB

package ‘Rgraphviz’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
Old packages: 'boot', 'Matrix', 'mgcv', 'nlme', 'nnet'
Update all/some/none? [a/s/n]: 
a
Warning in install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  'lib = "C:/Program Files/R/R-3.2.3/library"' is not writable
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/boot_1.3-18.zip'
Content type 'application/zip' length 591611 bytes (577 KB)
downloaded 577 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/Matrix_1.2-4.zip'
Content type 'application/zip' length 3629206 bytes (3.5 MB)
downloaded 3.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/mgcv_1.8-12.zip'
Content type 'application/zip' length 2212921 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/nlme_3.1-126.zip'
Content type 'application/zip' length 2137112 bytes (2.0 MB)
downloaded 2.0 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/nnet_7.3-12.zip'
Content type 'application/zip' length 121144 bytes (118 KB)
downloaded 118 KB

package ‘boot’ successfully unpacked and MD5 sums checked
package ‘Matrix’ successfully unpacked and MD5 sums checked
package ‘mgcv’ successfully unpacked and MD5 sums checked
package ‘nlme’ successfully unpacked and MD5 sums checked
package ‘nnet’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
> install.packages("devtools")
Installing package into ‘C:/Users/zhy19/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/devtools_1.10.0.zip'
Content type 'application/zip' length 392605 bytes (383 KB)
downloaded 383 KB

package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhy19\AppData\Local\Temp\Rtmpod80WN\downloaded_packages
> library(devtools)
Warning message:
package ‘devtools’ was built under R version 3.2.4 
> install_github("bd2kccd/tetradR")
Downloading GitHub repo bd2kccd/tetradR@master
from URL https://api.github.com/repos/bd2kccd/tetradR/zipball/master
Installing tetradR
Skipping 2 unavailable packages: graph, RBGL
"C:/Program Files/R/R-32~1.3/bin/x64/R" --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  "C:/Users/zhy19/AppData/Local/Temp/Rtmpod80WN/devtools69bf8c93e7e/bd2kccd-tetradR-be0580e"  \
  --library="C:/Users/zhy19/Documents/R/win-library/3.2"  \
  --install-tests 

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Error: Command failed (1)

@chirayukong it seems to be a path issue.

I'm also not sure why I got the error message of Skipping 2 unavailable packages: graph, RBGL since I've included those two packages.

dataset loads/reads "twice" into gfci.discrete

When I load a dataset into rcausal/gfci.discrete, it seems to load twice, effectively taking twice as long ===>

`> rcausal::gfci.discrete(dat)
node_names: ade
value: [1] 0 1

node_names: medication
value: [1] 0 1

node_names: diabetes_mellitusCOMMA_nonHYPHENinsulinHYPHENdependent
value: [1] 0 1

node_names: ligation
value: [1] 0 1

node_names: insulin_sensitivity
value: [1] 0 1

node_names: ade
value: [1] 0 1

node_names: medication
value: [1] 0 1

node_names: diabetes_mellitusCOMMA_nonHYPHENinsulinHYPHENdependent
value: [1] 0 1

node_names: ligation
value: [1] 0 1

node_names: insulin_sensitivity
value: [1] 0 1
`

Going to try PC and FGeS after this.
--Kingfish777

graphToDot erring out

I am experiencing difficulty with the tetrad runner.tetradGraphToDot method.
MacOS. Java 11.

> tetradrunner.tetradGraphToDot(tetradrunner$graph)
Error in .jcall("edu/cmu/tetrad/graph/GraphUtils", "S", "graphToDot",  : 
  method graphToDot with signature ()Ljava/lang/String; not found

Let me know what other information I can provide.
Best,
Scott

Error: object 'fges' not found

I followed the instructions here bd2kccd/r-causal and successfully installed rcausal package. But the package doesn't seem to contain the function fges. Has this function been removed from the package?

R version:
_
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes

installation error from OS X on R v3.4

> install_github("bd2kccd/r-causal")
Downloading GitHub repo bd2kccd/r-causal@master
from URL https://api.github.com/repos/bd2kccd/r-causal/zipball/master
Installing rcausal
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD INSTALL  \
  '/private/tmp/Rtmppf7TsB/devtoolsa5a24314ee1c/bd2kccd-r-causal-94b2d4d'  \
  --library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library'  \
  --install-tests 

* installing *source* package ‘rcausal’ ...
** R
** data
** inst
** preparing package for lazy loading
Warning in strsplit(msg, "\n") :
  input string 1 is invalid in this locale
Error in parse(nsFile, keep.source = FALSE, srcfile = NULL) : 16:8: unexpected input
15: export("fges.mixed")
16: export(?
           ^
ERROR: lazy loading failed for package ‘rcausal’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rcausal’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rcausal’
Installation failed: Command failed (1)

bioclite install

https might not work. revise readme to indicate that http might be needed.

setMaxDegree error

running current r-causal in master

Error in .jcall(fgs_instance, "V", "setMaxDegree", as.integer(maxDegree)) :
method setMaxDegree with signature (I)V not found

coefficients for FGS

Could you provide coefficients from FGS and other algorithms in the r-causal output?
Also: is there a way to parameterize and estimate the fit of the resulting graphs in r-causal? If not, could such functionality be added? Could we also get std. error out of batch? Perhaps add some flags depending on what we want?

Number of statistical calls

Is there a way to obtain the number of statistical calls (number of tests, number of scores), particularly for fges?

Thanks in advance!

Edit: With some direction from Marco Scutari, I figured out a way to print the calls and capture them in R.

Error when installing on Win10

This is the version info

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.0                         
year           2018                        
month          04                          
day            23                          
svn rev        74626                       
language       R                           
version.string R version 3.5.0 (2018-04-23)
nickname       Joy in Playing   

The packages stringr and rJava were installed normally but an error (see below) occurred when installing r-causal.

> install_github("bd2kccd/r-causal")
Downloading GitHub repo bd2kccd/r-causal@master
√  checking for file 'C:\Users\Shoubo\AppData\Local\Temp\RtmpSCTm95\remotes3d7866da46f3\bd2kccd-r-causal-8d2b178/DESCRIPTION' ...
-  preparing 'rcausal': (7.2s)
√  checking DESCRIPTION meta-information ...
-  checking whether 'INDEX' is up-to-date ... NO
-  use '--force' to remove the existing 'INDEX'
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  looking to see if a 'data/datalist' file should be added
-  building 'rcausal_1.1.1.tar.gz'
   Warning in utils::tar(filepath, pkgname, compression = "gzip", compression_level = 9L,  :
     storing paths of more than 100 bytes is not portable:
     'rcausal/java/edu/cmu/tetrad/algcomparison/algorithm/mixed/pattern/MixedFgesDiscretingContinuousVariables.java'
   Warning in utils::tar(filepath, pkgname, compression = "gzip", compression_level = 9L,  :
     storing paths of more than 100 bytes is not portable:
     'rcausal/java/edu/cmu/tetrad/algcomparison/algorithm/mixed/pattern/MixedFgesTreatingDiscreteAsContinuous.java'
   
Installing package into ‘C:/Users/Shoubo/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'rcausal' ...
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'rcausal'
    finding HTML links ... done
    audiology                               html  
    bayesEst                                html  
    ccd                                     html  
    charity                                 html  
    randomDag                               html  
    rcausal                                 html  
    tetradrunner                            html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'rcausal':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/Shoubo/Documents/R/win-library/3.5/rcausal'
In R CMD INSTALL
Error: Failed to install 'rcausal' from GitHub:
  (converted from warning) installation of package ‘C:/Users/Shoubo/AppData/Local/Temp/RtmpSCTm95/file3d786e1d6783/rcausal_1.1.1.tar.gz’ had non-zero exit status

I was wondering where I went wrong that caused this issue? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.