[Qca-commits] r72 - in pkg: . R inst man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 29 03:43:45 CET 2020


Author: dusadrian
Date: 2020-11-29 03:43:41 +0100 (Sun, 29 Nov 2020)
New Revision: 72

Modified:
   pkg/DESCRIPTION
   pkg/R/causalChain.R
   pkg/R/minimize.R
   pkg/inst/ChangeLog
   pkg/man/causalChain.Rd
   pkg/man/minimize.Rd
   pkg/src/find_consistent_models.c
Log:
moved arguments from minimize() to causalChain()

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/DESCRIPTION	2020-11-29 02:43:41 UTC (rev 72)
@@ -1,5 +1,5 @@
 Package: QCA
-Version: 3.10.1
+Version: 3.10.2
 Date: 2020-11-29
 Title: Qualitative Comparative Analysis
 Authors at R: c(person(given = "Adrian", family = "Dusa",
@@ -25,7 +25,7 @@
                     comment = "raphael-paragraph.js library"),
              person("Alrik", "Thiem", role = "aut",
                     comment = "from version 1.0-0 up to version 1.1-3"))
-Depends: R (>= 4.0.0), admisc (>= 0.10)
+Depends: R (>= 3.5.0), admisc (>= 0.10)
 LazyData: yes
 Imports: methods, shiny, venn
 Description: An extensive set of functions to perform Qualitative Comparative Analysis:
@@ -36,7 +36,7 @@
              minimal causal combination that explains a given phenomenon.
 License: GPL (>= 3)
 NeedsCompilation: yes
-Packaged: 2020-11-29 02:00:26 UTC; dusadrian
+Packaged: 2020-11-29 02:36:56 UTC; dusadrian
 Author: Adrian Dusa [aut, cre, cph] (<https://orcid.org/0000-0002-3525-9253>),
   Ciprian Paduraru [ctb] (<https://orcid.org/0000-0002-4518-374X>),
   jQuery Foundation [cph] (jQuery library and jQuery UI library),

Modified: pkg/R/causalChain.R
===================================================================
--- pkg/R/causalChain.R	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/R/causalChain.R	2020-11-29 02:43:41 UTC (rev 72)
@@ -24,7 +24,8 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 `causalChain` <-
-function(data, ordering = NULL, strict = FALSE, ...) {
+function(data, ordering = NULL, strict = FALSE, pi.cons = 0, pi.depth = 0,
+        sol.cons = 0, sol.cov = 1, sol.depth = 0, ...) {
     metacall <- match.call(expand.dots = TRUE)
     allargs <- as.list(metacall)[-1]
     allargs <- allargs[-which(is.element(c("data", "ordering", "strict"), names(allargs)))]

Modified: pkg/R/minimize.R
===================================================================
--- pkg/R/minimize.R	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/R/minimize.R	2020-11-29 02:43:41 UTC (rev 72)
@@ -25,7 +25,6 @@
 
 `minimize` <-
 function(input, include = "", dir.exp = NULL, details = FALSE, all.sol = FALSE,
-        pi.cons = 0, pi.depth = 0, sol.cons = 0, sol.cov = 1, sol.depth = 0,
         row.dom = FALSE, min.pin = FALSE, max.comb = 0, first.min = FALSE,
         method = "CCubes", ...) {
     metacall <- match.call()
@@ -91,6 +90,11 @@
     inf.test    <- if (is.element("inf.test",    names(dots))) dots$inf.test     else ""
     relation    <- if (is.element("relation",    names(dots))) dots$relation     else "sufficiency"
     neg.out     <- if (is.element("neg.out",     names(dots))) dots$neg.out      else FALSE
+    pi.cons     <- if (is.element("pi.cons",     names(dots))) dots$pi.cons      else 0
+    pi.depth    <- if (is.element("pi.depth",    names(dots))) dots$pi.depth     else 0
+    sol.cons    <- if (is.element("sol.cons",    names(dots))) dots$sol.cons     else 0
+    sol.cov     <- if (is.element("sol.cov",     names(dots))) dots$sol.cov      else 1
+    sol.depth   <- if (is.element("sol.depth",   names(dots))) dots$sol.depth    else 0
     exclude     <- if (is.element("exclude",     names(dots))) dots$exclude      else NULL
     keep.trying <- if (is.element("keep.trying", names(dots))) dots$keep.trying  else FALSE
     if (is.null(exclude)) {
@@ -314,7 +318,7 @@
                 extended.data <- rbind(extended.data, cbind(excl.matrix, 0))
             }
             if (sol.cons > 0 & all.sol & sol.depth == 0) {
-                sol.depth <- 5
+                sol.depth <- 7
             }
             expressions <- .Call("C_Cubes", list(
                             tt = cbind(rbind(pos.matrix, neg.matrix) - 1, rep(c(1, 0), c(nrow(pos.matrix), nrow(neg.matrix)))),

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/inst/ChangeLog	2020-11-29 02:43:41 UTC (rev 72)
@@ -2,6 +2,8 @@
     o Improved: error trapping in function pof()
     o Fixed: occasional (but non-disruptive) R level error messages, likely
       related to the C communication (thanks to Ian Greener for the report)
+    o Arguments "pi.cons", "pi.depth", "sol.cons", "sol.cov", and "sol.depth"
+      moved from function minimize() to function causalChain()
       
 Version 3.10
     o Major rewrite of the core C code, to prevent any possible memory leaks

Modified: pkg/man/causalChain.Rd
===================================================================
--- pkg/man/causalChain.Rd	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/man/causalChain.Rd	2020-11-29 02:43:41 UTC (rev 72)
@@ -10,7 +10,8 @@
 }
 
 \usage{
-causalChain(data, ordering, strict = FALSE, ...)
+causalChain(data, ordering = NULL, strict = FALSE, pi.cons = 0, pi.depth = 0,
+      sol.cons = 0, sol.cov = 1, sol.depth = 0, ...)
 }
 
 \arguments{
@@ -19,6 +20,16 @@
         the causal ordering of the causal conditions.}
   \item{strict}{Logical, prevents causal conditions on the same temporal level to
         act as outcomes for each other.}
+  \item{pi.cons}{Numerical fuzzy value between 0 and 1, minimal consistency
+        threshold for a prime implicant to be declared as sufficient.}
+  \item{pi.depth}{Integer, a maximum number of causal conditions to be used
+        when searching for conjunctive prime implicants.}
+  \item{sol.cons}{Numerical fuzzy value between 0 and 1, minimal consistency 
+        threshold for a model to be declared as sufficient.}
+  \item{sol.cov}{Numerical fuzzy value between 0 and 1, minimal coverage 
+        threshold for a model to be declared as necessary.}
+  \item{sol.depth}{Integer, a maximum number of prime implicants to be used when
+        searching for disjunctive models.}
   \item{...}{Other arguments to be passed to functions \code{\link{minimize}()}
         and \code{\link{truthTable}()}.}
 }
@@ -75,8 +86,8 @@
 Although the two functions reach the same results, they follow different methods. The input
 for the minimization behind the function \bold{\code{cna()}} is a coincidence list,
 while in package \pkg{QCA} the input for the minimization procedure is a truth table. The
-difference is subtle but important, with the most important difference that package \pkg{cna}
-is not exhaustive.
+difference is subtle but important, with the most important difference that package
+\pkg{cna} is not exhaustive.
 
 To find a set of solutions in a reasonable time, the formal choice in package \pkg{cna} is
 to deliberately stop the search at certain (default) depths of complexity. Users are free
@@ -85,16 +96,29 @@
 
 On the other hand, the function \bold{\code{causalChain()}} and generally all related
 functions from package \pkg{QCA} are spending more time to make sure the search is
-exhaustive. Depths can be set via the arguments \bold{\code{pi.depth}} and \bold{\code{sol.depth}}
-from the arguments in function \bold{\code{\link{minimize}()}}, but unlike package \pkg{cna}
-these are not mandatory.
+exhaustive. Depths can be set via the arguments \bold{\code{pi.depth}} and
+\bold{\code{sol.depth}}, but unlike package \pkg{cna} these are not mandatory.
 
-Exhaustiveness is guaranteed in package \pkg{QCA} precisely because it uses a truth table as
-an input for the minimization procedure. The only exception is the option of finding solutions
-based on their consistency, with the argument \bold{\code{sol.cons}}: for large PI charts,
-time can quickly increase to infinity. If not otherwise specified in the argument
-\bold{\code{sol.depth}} the function \bold{\code{causalChain()}} silently sets a complexity
-level of 5 prime implicants per solution.
+The argument \bold{\code{sol.cons}} introduces another method of solving the PI chart.
+Normally, once the solution models are found among all possible combinations of
+\bold{\code{k}} prime implicants, consistencies and coverages are subsequently
+calculated. When \bold{\code{sol.cons}} is lower than 1, then models are searched
+based on their consistencies, which should be at least equal to this threshold.
+
+Exhaustiveness is guaranteed in package \pkg{QCA} precisely because it uses a truth table
+as an input for the minimization procedure. The only exception is the option of finding
+solutions based on their consistency, with the argument \bold{\code{sol.cons}}: for large
+PI charts, time can quickly increase to infinity, to identify all possible irredundant
+(disjunctions that are not subsets of previously found) disjunctive models. In such a
+situation, the number of combinations of all possible numbers of prime implicants is
+potentially too large to be solved in a polynomial time and if not otherwise specified in
+the argument \bold{\code{sol.depth}} the function \bold{\code{causalChain()}} silently
+sets a complexity level of 7 prime implicants per model.
+
+When minimizing a dataset instead of a truth table, unless otherwise specified, the 
+argument \bold{\code{incl.cut}} is automatically set to the minimum value between
+\bold{\code{pi.cons}} and \bold{\code{sol.cons}}, then passed to the function
+\bold{\code{truthTable()}}.
 }
 
 \value{

Modified: pkg/man/minimize.Rd
===================================================================
--- pkg/man/minimize.Rd	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/man/minimize.Rd	2020-11-29 02:43:41 UTC (rev 72)
@@ -19,7 +19,6 @@
 
 \usage{
 minimize(input, include = "", dir.exp = NULL, details = FALSE, all.sol = FALSE,
-        pi.cons = 0, pi.depth = 0, sol.cons = 0, sol.cov = 1, sol.depth = 0,
         row.dom = FALSE, min.pin = FALSE, max.comb = 0, first.min = FALSE,
         method = "CCubes", ...)
 }
@@ -33,16 +32,6 @@
         intermediate solution.}
   \item{details}{Logical, print more details about the solution.}
   \item{all.sol}{Logical, search for all possible models, including the non-minimal.}
-  \item{pi.cons}{Numerical fuzzy value between 0 and 1, minimal consistency
-        threshold for a prime implicant to be declared as sufficient.}
-  \item{pi.depth}{Integer, a maximum number of causal conditions to be used
-        when searching for conjunctive prime implicants.}
-  \item{sol.cons}{Numerical fuzzy value between 0 and 1, minimal consistency 
-        threshold for a model to be declared as sufficient.}
-  \item{sol.cov}{Numerical fuzzy value between 0 and 1, minimal coverage 
-        threshold for a model to be declared as necessary.}
-  \item{sol.depth}{Integer, a maximum number of prime implicants to be used when
-        searching for disjunctive models.}
   \item{row.dom}{Logical, perform row dominance in the prime implicants' chart to
         eliminate redundant prime implicants.}
   \item{min.pin}{Logical, terminate the search at the depth where newly found
@@ -144,24 +133,6 @@
 configurations as another prime implicant B and in the same time covers
 other configurations which B does not cover, then B is irrelevant and eliminated.
 
-Depending on the complexity of the PI chart, it sometimes may take a very long time
-to identify all possible irredundant (disjunctions that are not subsets of
-previously found) disjunctive models. In such a situation, the number of
-combinations of all possible numbers of prime implicants is potentially too large to be
-solved in a polynomial time and if not otherwise specified, the depth for the disjunctive
-models is automatically bounded to 5 prime implicants.
-
-If minimizing a dataset instead of a truth table, unless otherwise specified the 
-argument \bold{\code{incl.cut}} is automatically set to the minimum value between
-\bold{\code{pi.cons}} and \bold{\code{sol.cons}}, then passed to the function
-\bold{\code{truthTable()}}.
-
-The argument \bold{\code{sol.cons}} introduces another method of solving the PI chart.
-Normally, once the solution models are found among all possible combinations of
-\bold{\code{k}} prime implicants, consistencies and coverages are subsequently
-calculated. When \bold{\code{sol.cons}} is lower than 1, then models are searched
-based on their consistencies, which should be at least equal to this threshold.
-
 A large number of causal conditions (i.e. over 15), combined with a large number of cases
 (i.e. hundreds) usually produce a very large number of prime implicants, resulting in a huge
 and extremely complex PI chart with sometimes thousands of rows and hundreds of columns.

Modified: pkg/src/find_consistent_models.c
===================================================================
--- pkg/src/find_consistent_models.c	2020-11-29 02:03:52 UTC (rev 71)
+++ pkg/src/find_consistent_models.c	2020-11-29 02:43:41 UTC (rev 72)
@@ -50,7 +50,7 @@
     int **solutions,
     int *nr,
     int *nc) {
-    int estimsol = 100;
+    int estimsol = 1000;
     int maxk = posrows;
     if (foundPI < maxk) {
         maxk = foundPI;



More information about the Qca-commits mailing list