R Under development (unstable) (2024-09-06 r87103 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. > library(pcalg) > doExtras <- pcalg:::doExtras() > > source(system.file(package="Matrix", "test-tools-1.R", mustWork=TRUE)) Loading required package: tools > ##--> showProc.time(), assertError(), relErrV(), ... > R.home(); sessionInfo() # helping package maintainers to debug ... [1] "D:/RCompile/recent/R" R Under development (unstable) (2024-09-06 r87103 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2022 x64 (build 20348) Matrix products: default locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.utf8 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] tools stats graphics grDevices utils datasets methods [8] base other attached packages: [1] pcalg_2.7-12 loaded via a namespace (and not attached): [1] graph_1.82.0 igraph_2.0.3 DEoptimR_1.1-3 [4] clue_0.3-65 magrittr_2.0.3 fastICA_1.2-5.1 [7] abind_1.4-5 BiocGenerics_0.50.0 pkgconfig_2.0.3 [10] stats4_4.5.0 lifecycle_1.0.4 cli_3.6.3 [13] sfsmisc_1.1-19 ggm_2.5.1 corpcor_1.6.10 [16] robustbase_0.99-4 compiler_4.5.0 RBGL_1.80.0 [19] cluster_2.1.6 bdsmatrix_1.3-7 Rcpp_1.0.13 [22] BiocManager_1.30.25 rlang_1.1.4 > .libPaths() [1] "D:/temp/Rtmp8cLpRq/RLIBS_76c4389f364" [2] "D:/RCompile/recent/R/library" > packageDescription("pcalg") Package: pcalg Version: 2.7-12 Date: 2024-09-05 Title: Methods for Graphical Models and Causal Inference Description: Functions for causal structure learning and causal inference using graphical models. The main algorithms for causal structure learning are PC (for observational data without hidden variables), FCI and RFCI (for observational data with hidden variables), and GIES (for a mix of data from observational studies (i.e. observational data) and data from experiments involving interventions (i.e. interventional data) without hidden variables). For causal inference the IDA algorithm, the Generalized Backdoor Criterion (GBC), the Generalized Adjustment Criterion (GAC) and some related functions are implemented. Functions for incorporating background knowledge are provided. Maintainer: Markus Kalisch Authors@R: c(person("Markus","Kalisch", email="kalisch@stat.math.ethz.ch", role=c("aut","cre")), person("Alain", "Hauser", role="aut"), person("Martin","Maechler", role="aut"), person("Diego", "Colombo", role="ctb"), person("Doris", "Entner", role="ctb"), person("Patrik", "Hoyer", role="ctb"), person("Antti", "Hyttinen", role="ctb"), person("Jonas", "Peters", role="ctb"), person("Nicoletta", "Andri", role="ctb"), person("Emilija", "Perkovic", role="ctb"), person("Preetam", "Nandy", role="ctb"), person("Philipp", "Ruetimann", role="ctb"),person("Daniel", "Stekhoven", role="ctb"), person("Manuel", "Schuerch", role="ctb"), person("Marco", "Eigenmann", role="ctb"), person("Leonard", "Henckel", role = "ctb"),person("Joris", "Mooij", role = "ctb")) Depends: R (>= 3.5.0) LinkingTo: Rcpp (>= 0.11.0), RcppArmadillo, BH Imports: stats, graphics, utils, methods, abind, graph, RBGL, igraph, ggm, corpcor, robustbase, vcd, Rcpp, bdsmatrix, sfsmisc (>= 1.0-26), fastICA, clue Suggests: MASS, Matrix, Rgraphviz, mvtnorm, huge, ggplot2, dagitty NeedsCompilation: yes Encoding: UTF-8 License: GPL (>= 2) URL: https://pcalg.r-forge.r-project.org/ Packaged: 2024-09-05 16:53:13 UTC; kalischm Author: Markus Kalisch [aut, cre], Alain Hauser [aut], Martin Maechler [aut], Diego Colombo [ctb], Doris Entner [ctb], Patrik Hoyer [ctb], Antti Hyttinen [ctb], Jonas Peters [ctb], Nicoletta Andri [ctb], Emilija Perkovic [ctb], Preetam Nandy [ctb], Philipp Ruetimann [ctb], Daniel Stekhoven [ctb], Manuel Schuerch [ctb], Marco Eigenmann [ctb], Leonard Henckel [ctb], Joris Mooij [ctb] Built: R 4.5.0; x86_64-w64-mingw32; 2024-09-06 18:05:04 UTC; windows Archs: x64 -- File: D:/RCompile/CRANincoming/R-devel/lib/pcalg/Meta/package.rds > packageDescription("Matrix") Package: Matrix Version: 1.7-0 VersionNote: do also bump src/version.h, inst/include/Matrix/version.h Date: 2024-03-16 Priority: recommended Title: Sparse and Dense Matrix Classes and Methods Description: A rich hierarchy of sparse and dense matrix classes, including general, symmetric, triangular, and diagonal matrices with numeric, logical, or pattern entries. Efficient methods for operating on such matrices, often wrapping the 'BLAS', 'LAPACK', and 'SuiteSparse' libraries. License: GPL (>= 2) | file LICENCE URL: https://Matrix.R-forge.R-project.org BugReports: https://R-forge.R-project.org/tracker/?atid=294&group_id=61 Contact: Matrix-authors@R-project.org Authors@R: c(person("Douglas", "Bates", role = "aut", comment = c(ORCID = "0000-0001-8316-9503")), person("Martin", "Maechler", role = c("aut", "cre"), email = "mmaechler+Matrix@gmail.com", comment = c(ORCID = "0000-0002-8685-9910")), person("Mikael", "Jagan", role = "aut", comment = c(ORCID = "0000-0002-3542-2938")), person("Timothy A.", "Davis", role = "ctb", comment = c(ORCID = "0000-0001-7614-6899", "SuiteSparse libraries", "collaborators listed in dir(system.file(\"doc\", \"SuiteSparse\", package=\"Matrix\"), pattern=\"License\", full.names=TRUE, recursive=TRUE)")), person("George", "Karypis", role = "ctb", comment = c(ORCID = "0000-0003-2753-1437", "METIS library", "Copyright: Regents of the University of Minnesota")), person("Jason", "Riedy", role = "ctb", comment = c(ORCID = "0000-0002-4345-4200", "GNU Octave's condest() and onenormest()", "Copyright: Regents of the University of California")), person("Jens", "Oehlschlägel", role = "ctb", comment = "initial nearPD()"), person("R Core Team", role = "ctb", comment = "base R's matrix implementation")) Depends: R (>= 4.4.0), methods Imports: grDevices, graphics, grid, lattice, stats, utils Suggests: MASS, datasets, sfsmisc, tools Enhances: SparseM, graph LazyData: no LazyDataNote: not possible, since we use data/*.R and our S4 classes BuildResaveData: no Encoding: UTF-8 NeedsCompilation: yes Packaged: 2024-03-19 17:15:14 UTC; maechler Author: Douglas Bates [aut] (), Martin Maechler [aut, cre] (), Mikael Jagan [aut] (), Timothy A. Davis [ctb] (, SuiteSparse libraries, collaborators listed in dir(system.file("doc", "SuiteSparse", package="Matrix"), pattern="License", full.names=TRUE, recursive=TRUE)), George Karypis [ctb] (, METIS library, Copyright: Regents of the University of Minnesota), Jason Riedy [ctb] (, GNU Octave's condest() and onenormest(), Copyright: Regents of the University of California), Jens Oehlschlägel [ctb] (initial nearPD()), R Core Team [ctb] (base R's matrix implementation) Maintainer: Martin Maechler Repository: CRAN Date/Publication: 2024-04-26 12:03:02 UTC Built: R 4.5.0; x86_64-w64-mingw32; 2024-09-06 11:30:30 UTC; windows Archs: x64 -- File: D:/temp/Rtmp8cLpRq/RLIBS_76c4389f364/Matrix/Meta/package.rds > > ## load the functions for the simulations of this paper > ## source("/u/colombo/Diss/RAusw/First_paper_RFCI/functions_for_the_simulations.R") > > ## RFCI improves the output > ##______________________________________________ > ## Input: L1=1; L2=2; X1=6; X2=4; X3=3; X4=5; X5=7; X6=8 > ## Output: X1=4; X2=2; X3=1; X4=3; X5=5; X6=6 > > amat <- rbind(0,# 2 3 4 5 6 7 8 + c(0,0,0,0,1,1,0,0), + c(0,1,0,1,0,1,0,0), + c(1,0,0,0,0,1,0,0), + c(0,0,0,0,0,1,0,0), + c(1,1,0,0,0,0,0,0), + c(0,0,0,1,1,0,0,0), + 0) > colnames(amat) <- rownames(amat) <- as.character(1:8) > Matrix::Matrix(amat) # to "visualize" 8 x 8 sparse Matrix of class "dgCMatrix" 1 2 3 4 5 6 7 8 1 . . . . . . . . 2 . . . . 1 1 . . 3 . 1 . 1 . 1 . . 4 1 . . . . 1 . . 5 . . . . . 1 . . 6 1 1 . . . . . . 7 . . . 1 1 . . . 8 . . . . . . . . > L <- c(1,2) > V <- as.character(1:8) > edL <- setNames(vector("list", length=length(V)), V) > edL[[6]] <- list(edges=NULL, weights=NULL) > edL[[8]] <- list(edges=NULL, weights=NULL) > edL[[4]] <- list(edges=c(7,8), weights=c(abs(rnorm(1)),abs(rnorm(1)))) > edL[[3]] <- list(edges=c(4,5,8), weights=c(abs(rnorm(1)),abs(rnorm(1)),abs(rnorm(1)))) > edL[[5]] <- list(edges=c(6,8), weights=c(abs(rnorm(1)),abs(rnorm(1)))) > edL[[7]] <- list(edges= 8, weights=abs(rnorm(1))) > edL[[1]] <- list(edges=c(4,6), weights=c(abs(rnorm(1)),abs(rnorm(1)))) > edL[[2]] <- list(edges=c(5,7), weights=c(abs(rnorm(1)),abs(rnorm(1)))) > g <- new("graphNEL", nodes=V, edgeL=edL, edgemode="directed") > if(dev.interactive()) + plot(g) > > ## Compute the true covariance matrix of g > cov.mat <- trueCov(g) > ## Delete rows and columns which belong to L > true.cov <- cov.mat[-L,-L] > ## Transform it in a correlation matrix > true.corr <- cov2cor(true.cov) > > suffStat <- list(C=true.corr, n=10^9) > showSys.time(pop.fci1 <- + fci(suffStat, gaussCItest, labels=V[-L], + alpha=0.9999, doPdsep=TRUE,verbose=FALSE)@amat) Time user system elapsed Time 0.08 0.00 0.08 > > showSys.time(pop.rfci1 <- + rfci(suffStat, gaussCItest, labels=V[-L], + alpha=0.9999, verbose=FALSE)@amat) Time user system elapsed Time 0.03 0.00 0.03 > > if (any(pop.fci1 != pop.rfci1)) { + stop("Test of RFCI wrong: small example!") + } > > ## if (doExtras) { > if (FALSE) { + ## Thomas' example (version number 8) about discriminating path orientation rule + + V <- as.character(1:25) + edL <- setNames(vector("list", length=length(V)), V) + edL[[ 1]] <- list(edges=c(14,18),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 2]] <- list(edges=c(16,18),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 3]] <- list(edges=c(16,24),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 4]] <- list(edges=c(18,24),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 5]] <- list(edges=c(15,25),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 6]] <- list(edges=c(17,19),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 7]] <- list(edges=c(14,19),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 8]] <- list(edges=c(14,24),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[ 9]] <- list(edges=c(19,20),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[10]] <- list(edges=c(20,25),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[11]] <- list(edges=c(23,25),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[12]] <- list(edges=c(22,24),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[13]] <- list(edges=c(21,23),weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[14]] <- list(edges=NULL, weights=NULL) + edL[[15]] <- list(edges=c(16,17,24),weights=c(abs(rnorm(1)),abs(rnorm(1)),abs(rnorm(1)))) + edL[[16]] <- list(edges=c(19,25), weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[17]] <- list(edges=c(18,24,25),weights=c(abs(rnorm(1)),abs(rnorm(1)),abs(rnorm(1)))) + edL[[18]] <- list(edges=c(21,25), weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[19]] <- list(edges=c(23,24,25),weights=c(abs(rnorm(1)),abs(rnorm(1)),abs(rnorm(1)))) + edL[[20]] <- list(edges= 24, weights=abs(rnorm(1))) + edL[[21]] <- list(edges=c(22,25), weights=c(abs(rnorm(1)),abs(rnorm(1)))) + edL[[22]] <- list(edges= 25, weights=abs(rnorm(1))) + edL[[23]] <- list(edges= 24, weights=abs(rnorm(1))) + edL[[24]] <- list(edges=NULL,weights=NULL) + edL[[25]] <- list(edges=NULL,weights=NULL) + (g <- new("graphNEL", nodes=V, edgeL=edL,edgemode="directed")) + + if(dev.interactive()) + plot(g) + + ## Latent variables (all having no parents): + L <- c(1:13) + + ## Compute the true covariance matrix of g + cov.mat <- trueCov(g) + ## Delete rows and columns which belong to L + true.cov <- cov.mat[-L,-L] + ## Transform it in a correlation matrix + true.corr <- cov2cor(true.cov) + suffStat <- list(C=true.corr, n=10^9) + p.tr <- dim(true.corr)[1] + showSys.time(pop.fci2 <- fci(suffStat, gaussCItest, p=p.tr, + alpha=0.9999, doPdsep=TRUE)@amat) + showSys.time(pop.rfci2 <- rfci(suffStat, gaussCItest, p=p.tr, + alpha=0.9999)@amat) + + if (any(pop.fci2 != pop.rfci2)) { + stop("Test of RFCI wrong: big example!") + } + + } > > proc.time() user system elapsed 1.67 0.28 1.95