R Under development (unstable) (2024-02-11 r85891 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-02-11 r85891 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-11 loaded via a namespace (and not attached): [1] graph_1.80.0 igraph_2.0.1.1 DEoptimR_1.1-3 [4] clue_0.3-65 magrittr_2.0.3 fastICA_1.2-4 [7] abind_1.4-5 BiocGenerics_0.48.1 pkgconfig_2.0.3 [10] stats4_4.4.0 lifecycle_1.0.4 cli_3.6.2 [13] sfsmisc_1.1-17 ggm_2.5.1 corpcor_1.6.10 [16] robustbase_0.99-2 compiler_4.4.0 RBGL_1.78.0 [19] cluster_2.1.6 bdsmatrix_1.3-6 Rcpp_1.0.12 [22] BiocManager_1.30.22 rlang_1.1.3 > .libPaths() [1] "D:/temp/RtmpiqjOvm/RLIBS_24a5c7323bd7" [2] "D:/RCompile/recent/R/library" > packageDescription("pcalg") Package: pcalg Version: 2.7-11 Date: 2024-02-12 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-02-12 10:30:09 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.4.0; x86_64-w64-mingw32; 2024-02-12 11:25:07 UTC; windows Archs: x64 -- File: D:/RCompile/CRANincoming/R-devel/lib/pcalg/Meta/package.rds > packageDescription("Matrix") Package: Matrix Version: 1.6-5 VersionNote: do also bump src/version.h, inst/include/Matrix/version.h Date: 2024-01-06 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, notably CHOLMOD and AMD", "collaborators listed in dir(pattern=\"^[A-Z]+[.]txt$\", full.names=TRUE, system.file(\"doc\", \"SuiteSparse\", package=\"Matrix\"))")), person("Jens", "Oehlschlägel", role = "ctb", comment = "initial nearPD()"), 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("R Core Team", role = "ctb", comment = "base R's matrix implementation")) Depends: R (>= 3.5.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-01-11 08:36:29 UTC; maechler Author: Douglas Bates [aut] (), Martin Maechler [aut, cre] (), Mikael Jagan [aut] (), Timothy A. Davis [ctb] (, SuiteSparse libraries, notably CHOLMOD and AMD, collaborators listed in dir(pattern="^[A-Z]+[.]txt$", full.names=TRUE, system.file("doc", "SuiteSparse", package="Matrix"))), Jens Oehlschlägel [ctb] (initial nearPD()), Jason Riedy [ctb] (, GNU Octave's condest() and onenormest(), Copyright: Regents of the University of California), R Core Team [ctb] (base R's matrix implementation) Maintainer: Martin Maechler Repository: CRAN Date/Publication: 2024-01-11 17:50:15 UTC Built: R 4.4.0; x86_64-w64-mingw32; 2024-02-12 02:00:50 UTC; windows Archs: x64 -- File: D:/temp/RtmpiqjOvm/RLIBS_24a5c7323bd7/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.11 0.02 0.13 > > 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 2.70 0.37 3.06