diff --git a/DESCRIPTION b/DESCRIPTION index becdb7c..ed4c688 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: pcalg -Version: 2.6-10 -Date: 2020-03-3 +Version: 2.6-11 +Date: 2020-08-12 Title: Methods for Graphical Models and Causal Inference Description: Functions for causal structure learning and causal inference using graphical models. The main algorithms @@ -51,6 +51,6 @@ Encoding: UTF-8 License: GPL (>= 2) URL: http://pcalg.r-forge.r-project.org/ RoxygenNote: 6.1.1 -Packaged: 2020-03-03 12:31:36 UTC; kalischm +Packaged: 2020-08-12 12:36:11 UTC; kalischm Repository: CRAN -Date/Publication: 2020-03-03 14:40:07 UTC +Date/Publication: 2020-08-16 16:00:02 UTC diff --git a/MD5 b/MD5 index 562b4bd..352db29 100644 --- a/MD5 +++ b/MD5 @@ -1,6 +1,6 @@ 1c213fc1c5a5ec68e7a5ba9293440dc3 *ChangeLog -4b9b32644c238bb95ec960bbfc0bff0a *DESCRIPTION -f813efd2d2208b900ae1d5ceb8dce2cf *NAMESPACE +ae6a1555639ce7d21db187bdd7482215 *DESCRIPTION +f9c1992369a6565cdfb3fdf5e8d8ebd1 *NAMESPACE 66963591a11cfdb002f5da9070f1500b *R/Aaux.R 83c288d2212114e54bfe624e0edecaaa *R/AllClasses.R 9f99e28f01bd00dedf565c6e01978676 *R/adjustment.R @@ -11,14 +11,14 @@ f813efd2d2208b900ae1d5ceb8dce2cf *NAMESPACE 5c33d7a0849fd620631eb901d6a6540d *R/gies.R aca17dcd6f37ce1136086a8bc285046e *R/isValidGraph.R b363657f7e2c52dc0f2aa083780fa0f7 *R/jointIda.R -386ed9be1a524de90dfac185433b009a *R/lingamFuns.R +f28cf0b020d974238796d27cfde61bf4 *R/lingamFuns.R ace998420ba6145fe7fe3c75c5892e66 *R/optAdjSet.R -af4239ca324cb48eaac6b07fc0cf0061 *R/pcalg.R +37f26524d577b5e73c98060c9eb6a057 *R/pcalg.R 67ec62ad56d7cffaba4bee8f88797136 *R/pcalg2dagitty.R f84d95dd282c42c32595a27ca98f9a3d *R/possDeAn.R 0db1ba6d57801a4d8fc6cdf996384a4d *R/zzz.R d599e23940bca0203504c0fa6b09e01c *TODO -94bed761e02266860aff243b04717fed *build/vignette.rds +f0b3f7d4b26e8dde3ea4a4a4d690f0f9 *build/vignette.rds f832779eae511757a99906c7670fc0ad *cleanup 7cbe431a233e6c454e24f7b92d63fe75 *data/datalist 1d8d4c43b9cbb9dc9dd57acd59f565bf *data/gmB.rda @@ -27,15 +27,15 @@ f832779eae511757a99906c7670fc0ad *cleanup 6d96fac64134a91ecf0c244b4679ec0f *data/gmI.rda 385d41164301819ce274673db8743fc9 *data/gmInt.rda 1b3a78b432a5e46b991f5ae5eb4b77f3 *data/gmL.rda -811a9708268fbddd317bbca12ef93a55 *inst/CITATION +7207fa41fa9372e94d6799af40bd4aa1 *inst/CITATION 2f13a20f69511d72dd63f9212308bc80 *inst/NEWS.Rd 4e33425acbef8bf36705d8a75622baa8 *inst/doc/mkVignettes.R -cc46b1f49edd31faf5316d5cf4d6c1ce *inst/doc/pcalgDoc.R +ea230ec4a19260aa9a751cef43965296 *inst/doc/pcalgDoc.R 6581d4416f174d4d6f07a2a2d4b9d3cb *inst/doc/pcalgDoc.Rnw -277b633e6b422057891d5e6722d84add *inst/doc/pcalgDoc.pdf -01c5a9cb2024f1234d7c4aebb9762db5 *inst/doc/vignette2018.R -65ba145dfc8ae12f50c95d77a8bf8600 *inst/doc/vignette2018.Rnw -23165d2276ae3dd8fee95d261b9b2da9 *inst/doc/vignette2018.pdf +14ab89a1cd46bbaaa76ee71af0f84bc4 *inst/doc/pcalgDoc.pdf +c7e3ec8f056bcb4ffedf8f38e06e1692 *inst/doc/vignette2018.R +e2e81e4c1014989c895e5764846e7a3e *inst/doc/vignette2018.Rnw +e4cb288353e02f194bd8a1a984ca0192 *inst/doc/vignette2018.pdf cee0b4475c720bf58c466e1495451b22 *inst/external/N_6_1000.rds 0d84fdc119d76d992b72f9bdbd0e613d *inst/external/gac-pags.rds e7a2a9117d97986b2ab6afc6b4f77478 *inst/external/test_conservative_pc_data1.rda @@ -72,7 +72,7 @@ b2ded6b2c0cd2cf0c30b845d07646736 *man/corGraph.Rd 3d880e7f58fe68731e9ed4ecb4c13bf4 *man/dreach.Rd e89cc00623c136f141b0427a7476889a *man/dsep.Rd 3c0924e854ffc20b168281b2380d9b61 *man/dsepTest.Rd -e3ec67ee2b013c1127ca799376a2a115 *man/fci.Rd +87ca8597438b85a5d9f801114ec715e4 *man/fci.Rd 4210c617d4929290e295ced5e0eeeb43 *man/fciAlgo-class.Rd 7fb4c8797b23d3d73252beee2610d45f *man/fciPlus.Rd 44127d2a6a6234ed84cf650a3273e504 *man/find.unsh.triple.Rd @@ -89,7 +89,7 @@ cbb33c4976caf365b69cb9c76a7a493e *man/gmB.Rd 66a7855809f1fd6e9a0ced7dbd612af6 *man/gmI.Rd 6a624691a6a19dd55526a9e9585ce0b3 *man/gmInt.Rd 0fc0725cd27113dfa0505deb9504b3ec *man/gmL.Rd -782a90276af56e6801b9edddc2794197 *man/ida.Rd +eb1f2a346b3a92262713be8090f9e64d *man/ida.Rd 7aa46e96c96d02d55e876f3d52c2d5d7 *man/idaFast.Rd 90a088350b43454d621b4b315ab3d2cf *man/iplotPC.Rd 57051c656a17c7be27f38816fddc0b4c *man/isValidGraph.Rd @@ -100,7 +100,7 @@ cd8a6e38249822fc7c54c66b96a6a967 *man/mcor.Rd 1c7ed5406ee7aed47987da8900ab144e *man/opt.target.Rd 088eee045f4ee07c7fd39971203f4c18 *man/optAdjSet.Rd 67426f4203b1334a56a8715423083745 *man/pag2mag.Rd -dd33bd15970a3b76a6c47147cc991c2b *man/pc.Rd +f67ca974ccf8e71a2e62cec316c4da7e *man/pc.Rd 01d980deb40fe93c7e3c2f5039882f9d *man/pc.cons.intern.Rd 342566226ce52d9795a928ef44a7ca3c *man/pcAlgo-class.Rd 143110b2d6797b5ef727a5c05d2790f8 *man/pcAlgo.Rd @@ -202,4 +202,4 @@ b9564ddd59a06782310989e8f33db55e *vignettes/jsslogo.jpg c9b7539de0d214a8ec11c907472128fc *vignettes/pcalgDoc-concordance.tex 6581d4416f174d4d6f07a2a2d4b9d3cb *vignettes/pcalgDoc.Rnw 86183e3233b77b06b41111dd207131ea *vignettes/vignette2018-concordance.tex -65ba145dfc8ae12f50c95d77a8bf8600 *vignettes/vignette2018.Rnw +e2e81e4c1014989c895e5764846e7a3e *vignettes/vignette2018.Rnw diff --git a/NAMESPACE b/NAMESPACE index 8ad3373..51fb60f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,7 +9,10 @@ importFrom("stats", cor, cor.test, cov, cov2cor, importFrom("utils", combn, str) -importFrom("graphics", par, plot.default, plot, title) +importFrom("graphics", par, plot, title) +## For R >= 4.0.0, plot is in 'base' (but in 'graphics', too) +## if(getRversion() < "4.0.0") +## importFrom("graphics", plot) importMethodsFrom("methods", coerce, show) importFrom("methods", diff --git a/R/lingamFuns.R b/R/lingamFuns.R index d646c35..3a92058 100644 --- a/R/lingamFuns.R +++ b/R/lingamFuns.R @@ -11,7 +11,7 @@ ## details. ## ## You should have received a copy of the GNU General Public License along with -## this program; if not, see . +## this program; if not, see . ################################################## ## exported ################################################## diff --git a/R/pcalg.R b/R/pcalg.R index a5f8342..ac92df1 100644 --- a/R/pcalg.R +++ b/R/pcalg.R @@ -5023,7 +5023,7 @@ udag2pag <- function(pag, sepset, rules = rep(TRUE,10), unfVect = NULL, verbose counterX1 <- 0 while (counterX1 < length(indX) && pag[c, a] == 1) { counterX1 <- counterX1 + 1 - first.pos <- indA[counterX1] + first.pos <- indX[counterX1] indX2 <- setdiff(indX, first.pos) counterX2 <- 0 while (counterX2 < length(indX2) && pag[c, a] == 1) { diff --git a/build/vignette.rds b/build/vignette.rds index c237519..8603219 100644 Binary files a/build/vignette.rds and b/build/vignette.rds differ diff --git a/inst/CITATION b/inst/CITATION index d979156..f307868 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -12,13 +12,13 @@ citEntry(entry = "Article", volume = "47", number = "11", pages = "1--26", - url = "http://www.jstatsoft.org/v47/i11/", + url = "https://www.jstatsoft.org/article/view/v047i11", textVersion = paste("Markus Kalisch, Martin Maechler, Diego Colombo, Marloes H. Maathuis, Peter Buehlmann (2012).", "Causal Inference Using Graphical Models with the R Package pcalg.", "Journal of Statistical Software, 47(11), 1-26.", - "URL http://www.jstatsoft.org/v47/i11/.") + "URL https://www.jstatsoft.org/article/view/v047i11.") ) citEntry(entry = "Article", diff --git a/inst/doc/pcalgDoc.R b/inst/doc/pcalgDoc.R index f28d07f..a4b59f0 100644 --- a/inst/doc/pcalgDoc.R +++ b/inst/doc/pcalgDoc.R @@ -1,5 +1,4 @@ ### R code from vignette source 'pcalgDoc.Rnw' -### Encoding: UTF-8 ################################################### ### code chunk number 1: preliminaries diff --git a/inst/doc/pcalgDoc.pdf b/inst/doc/pcalgDoc.pdf index de05787..72409c5 100644 Binary files a/inst/doc/pcalgDoc.pdf and b/inst/doc/pcalgDoc.pdf differ diff --git a/inst/doc/vignette2018.R b/inst/doc/vignette2018.R index fa634bc..1e1ea72 100644 --- a/inst/doc/vignette2018.R +++ b/inst/doc/vignette2018.R @@ -1,5 +1,4 @@ ### R code from vignette source 'vignette2018.Rnw' -### Encoding: UTF-8 ################################################### ### code chunk number 1: preliminaries @@ -42,8 +41,7 @@ showF <- function(f, width = 50) { ################################################### ### code chunk number 4: exIntro1 ################################################### -library("pcalg") -data("gmG") ## loads data set gmG8 +data("gmG", package = "pcalg") ## loads data sets gmG and gmG8 ################################################### @@ -58,8 +56,6 @@ skel.gmG8 <- skeleton(suffStat, indepTest = gaussCItest, ################################################### ### code chunk number 6: exIntroPC ################################################### -suffStat <- list(C = cor(gmG8$x), n = nrow(gmG8$x)) -varNames <- gmG8$g@nodes pc.gmG8 <- pc(suffStat, indepTest = gaussCItest, labels = varNames, alpha = 0.01) @@ -88,7 +84,7 @@ fci.gmL <- fci(suffStat, indepTest=gaussCItest, ################################################### stopifnot(require(Rgraphviz))# needed for all our graph plots par(mfrow = c(1,2)) -plot(gmL$g) ; box(col="gray") +plot(gmL$g) ; box(col="gray") plot(fci.gmL); box(col="gray") @@ -410,7 +406,7 @@ gac(mFig1, x,y, z=c(2,4), type) ################################################### -### code chunk number 40: vignette2018.Rnw:1088-1093 +### code chunk number 40: vignette2018.Rnw:1087-1092 ################################################### mFig3a <- matrix(c(0,1,0,0, 0,0,1,1, 0,0,0,1, 0,0,1,0), 4,4) type <- "pdag" diff --git a/inst/doc/vignette2018.Rnw b/inst/doc/vignette2018.Rnw index ff34e9e..4e68969 100644 --- a/inst/doc/vignette2018.Rnw +++ b/inst/doc/vignette2018.Rnw @@ -146,8 +146,7 @@ The dataset $gmG8$ contains $n=5000$ observations of $p = 8$ continuous variables with a multivariate Gaussian distribution. <>= -library("pcalg") -data("gmG") ## loads data set gmG8 +data("gmG", package = "pcalg") ## loads data sets gmG and gmG8 @ In this example, the predefined function @@ -168,12 +167,12 @@ Finding the skeleton is also the first step in the algorithms FCI, RFCI and FCI+ The PC-algorithm is implemented in function \texttt{pc()}. The arguments follow closely the arguments of \texttt{skeleton()}, i.e., the most important arguments consist of an conditional independence test and a suitable sufficient statistic. -We continue the previous example and illustrate function \texttt{pc()} using the built-in dataset $gmG8$. The result is shown in +% vvvvvvvvvvvvvvvvvvvvvvvvvvvvv +We continue the previous example and illustrate function \texttt{pc()} using the built-in dataset $gmG8$. +The result is shown in Fig.~\ref{fig:intro1} (bidirected edges need to be interpreted as undirected edges in the resulting CPDAG). <>= -suffStat <- list(C = cor(gmG8$x), n = nrow(gmG8$x)) -varNames <- gmG8$g@nodes pc.gmG8 <- pc(suffStat, indepTest = gaussCItest, labels = varNames, alpha = 0.01) @ @@ -264,7 +263,7 @@ fci.gmL <- fci(suffStat, indepTest=gaussCItest, <>= stopifnot(require(Rgraphviz))# needed for all our graph plots par(mfrow = c(1,2)) -plot(gmL$g) ; box(col="gray") +plot(gmL$g) ; box(col="gray") plot(fci.gmL); box(col="gray") @ \caption{True causal DAG (left) and estimated PAG on the observed nodes with the labels $2$, $3$, $4$ and $5$ (right).} diff --git a/inst/doc/vignette2018.pdf b/inst/doc/vignette2018.pdf index e8a8041..4141e81 100644 Binary files a/inst/doc/vignette2018.pdf and b/inst/doc/vignette2018.pdf differ diff --git a/man/fci.Rd b/man/fci.Rd index 8dfa917..e131c32 100644 --- a/man/fci.Rd +++ b/man/fci.Rd @@ -221,7 +221,7 @@ fci(suffStat, indepTest, alpha, labels, p, M.Kalisch, M. Maechler, D. Colombo, M. H. Maathuis, P. Buehlmann (2012). Causal Inference Using Graphical Models with the R Package pcalg. \emph{Journal of Statistical Software} - \bold{47(11)} 1--26, \url{http://www.jstatsoft.org/v47/i11/}. + \bold{47(11)} 1--26, \url{https://www.jstatsoft.org/v47/i11/}. P. Spirtes (2001). An anytime algorithm for causal inference. \emph{In Proc. of the Eighth International Workshop on Artifiial Intelligence diff --git a/man/ida.Rd b/man/ida.Rd index 7708d45..cd9c650 100644 --- a/man/ida.Rd +++ b/man/ida.Rd @@ -176,7 +176,7 @@ ida(x.pos, y.pos, mcov, graphEst, method = c("local","optimal","global"), Peter Buehlmann (2012). Causal inference using graphical models with the R-package pcalg. \emph{Journal of Statistical Software} \bold{47}(11) 1--26, - \url{http://www.jstatsoft.org/v47/i11/}. + \url{https://www.jstatsoft.org/v47/i11/}. Pearl (2005). \emph{Causality. Models, reasoning and inference}. Cambridge University Press, New York. diff --git a/man/pc.Rd b/man/pc.Rd index 2f89bd0..deb8e1b 100644 --- a/man/pc.Rd +++ b/man/pc.Rd @@ -237,7 +237,7 @@ pc(suffStat, indepTest, alpha, labels, p, M. Kalisch, M. Maechler, D. Colombo, M.H. Maathuis and P. Buehlmann (2012). Causal Inference Using Graphical Models with the R Package pcalg. \emph{Journal of Statistical Software} \bold{47(11)} 1--26, - \url{http://www.jstatsoft.org/v47/i11/}. + \url{https://www.jstatsoft.org/v47/i11/}. M. Kalisch and P. Buehlmann (2007). Estimating high-dimensional directed acyclic graphs with the PC-algorithm. diff --git a/vignettes/vignette2018.Rnw b/vignettes/vignette2018.Rnw index ff34e9e..4e68969 100644 --- a/vignettes/vignette2018.Rnw +++ b/vignettes/vignette2018.Rnw @@ -146,8 +146,7 @@ The dataset $gmG8$ contains $n=5000$ observations of $p = 8$ continuous variables with a multivariate Gaussian distribution. <>= -library("pcalg") -data("gmG") ## loads data set gmG8 +data("gmG", package = "pcalg") ## loads data sets gmG and gmG8 @ In this example, the predefined function @@ -168,12 +167,12 @@ Finding the skeleton is also the first step in the algorithms FCI, RFCI and FCI+ The PC-algorithm is implemented in function \texttt{pc()}. The arguments follow closely the arguments of \texttt{skeleton()}, i.e., the most important arguments consist of an conditional independence test and a suitable sufficient statistic. -We continue the previous example and illustrate function \texttt{pc()} using the built-in dataset $gmG8$. The result is shown in +% vvvvvvvvvvvvvvvvvvvvvvvvvvvvv +We continue the previous example and illustrate function \texttt{pc()} using the built-in dataset $gmG8$. +The result is shown in Fig.~\ref{fig:intro1} (bidirected edges need to be interpreted as undirected edges in the resulting CPDAG). <>= -suffStat <- list(C = cor(gmG8$x), n = nrow(gmG8$x)) -varNames <- gmG8$g@nodes pc.gmG8 <- pc(suffStat, indepTest = gaussCItest, labels = varNames, alpha = 0.01) @ @@ -264,7 +263,7 @@ fci.gmL <- fci(suffStat, indepTest=gaussCItest, <>= stopifnot(require(Rgraphviz))# needed for all our graph plots par(mfrow = c(1,2)) -plot(gmL$g) ; box(col="gray") +plot(gmL$g) ; box(col="gray") plot(fci.gmL); box(col="gray") @ \caption{True causal DAG (left) and estimated PAG on the observed nodes with the labels $2$, $3$, $4$ and $5$ (right).}