[Asrr-commits] r5 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 13 05:08:36 CET 2009


Author: wincent
Date: 2009-01-13 05:08:36 +0100 (Tue, 13 Jan 2009)
New Revision: 5

Modified:
   pkg/R/QCA.R
   pkg/TODO
   pkg/man/Lipsets.rd
   pkg/man/coefchange.Rd
   pkg/man/coincid.Rd
   pkg/man/cs_truthTable.rd
   pkg/man/endog_test.Rd
   pkg/man/fs_truthTable.rd
   pkg/man/suffnec.Rd
Log:
documentation of fs_truthTable and revision of other help pages.

Modified: pkg/R/QCA.R
===================================================================
--- pkg/R/QCA.R	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/R/QCA.R	2009-01-13 04:08:36 UTC (rev 5)
@@ -316,7 +316,7 @@
 }
 
 
-fs_truthTable <- function(mydata, outcome = "", conditions = c(""),ncases_cutoff=1,consistency_cutoff=0.8,
+fs_truthTable <- function(mydata, outcome, conditions,ncases_cutoff=1,consistency_cutoff=0.8,
                           complete = FALSE,show.cases = TRUE, quiet = FALSE,cases=NULL,...)
 {
   membership_cutoff=0.5

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/TODO	2009-01-13 04:08:36 UTC (rev 5)
@@ -1,3 +1 @@
 procedure of MSDO/MDSO in p29
-
-summary.QCA when some cases are covered by multiple PIs
\ No newline at end of file

Modified: pkg/man/Lipsets.rd
===================================================================
--- pkg/man/Lipsets.rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/Lipsets.rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -1,9 +1,9 @@
 \name{Lipsets}
 %\alias{Lipsets}
 \alias{Lipset}
-\alias{Lipset_fs}
-\alias{Lipset_cs}
-\alias{Lipset_mv}
+%\alias{Lipset_fs}
+%\alias{Lipset_cs}
+%\alias{Lipset_mv}
 \docType{data}
 \title{Breakdown/survival of democracy in inter-war Europe}
 \description{

Modified: pkg/man/coefchange.Rd
===================================================================
--- pkg/man/coefchange.Rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/coefchange.Rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -3,8 +3,8 @@
 \alias{coefchange.default}
 \alias{coefchange.lm}
 \alias{coefchange.glm}
-\alias{coefchange_boot}
-\alias{print.coefchange}
+%\alias{coefchange_boot}
+%\alias{print.coefchange}
 \title{Test of coef change}
 \description{
 Test if the coef will change significantly when additional variables are

Modified: pkg/man/coincid.Rd
===================================================================
--- pkg/man/coincid.Rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/coincid.Rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -1,6 +1,6 @@
 \name{coincid}
 \alias{coincid}
-\alias{print.coincid}
+%\alias{print.coincid}
 \title{Produces a coincidence matrix}
 \description{
 Produce a coincidence matrix from a crip set or fuzzy set data.

Modified: pkg/man/cs_truthTable.rd
===================================================================
--- pkg/man/cs_truthTable.rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/cs_truthTable.rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -31,13 +31,15 @@
     each conditions.}
   \item{cutoff1}{length one numeric vector.}
   \item{cutoff0}{length one numeric vector. }
-  \item{benchmark}{Benchmark for statistical test. Must equal or greater 0.5.}
+  \item{benchmark}{Benchmark for statistical test. Must equal or greater
+    than 0.5.}
   \item{conf.level}{confident level of statistical test.}
 }
 \details{
   Symbols of the outcome. '1' is postive configuration, '0' is negative
   configuration, 'C' is contraditory configuration, and '-' is don't
-  care configuration.
+  care configuration. When show.case is TRUE and a configuration is 'C',
+  then the name of case with negative outcome is highlighted by [].
 
   'cutoff1' and 'cutoff0' are only meaningful for'deterministic'
   method. They represent cutting point of positive case and negative
@@ -77,7 +79,7 @@
   Ragin, Charles. 2000. Fuzzy-Set Social Science. Pp109-116. University Of Chicago Press.
 }
 \author{Ronggui HUANG}
-\seealso{\code{\link{fs_truthTable}}}
+\seealso{\code{\link{fs_truthTable}} \code{\link{reduce}}}
 \examples{
 ## truthTable for csQCA
 cs_truthTable(Lipset_cs,"SURVIVAL", c("GNPCAP", "URBANIZA", "LITERACY",

Modified: pkg/man/endog_test.Rd
===================================================================
--- pkg/man/endog_test.Rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/endog_test.Rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -2,7 +2,7 @@
 \alias{endog_test}
 \alias{endog_test.tsls2}
 \alias{endog_test.ivreg}
-\alias{print.endog_test}
+%\alias{print.endog_test}
 %- Also NEED an '\alias' for EACH other topic documented here.
 \title{Test of endogeneity.}
 \description{

Modified: pkg/man/fs_truthTable.rd
===================================================================
--- pkg/man/fs_truthTable.rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/fs_truthTable.rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -1,123 +1,57 @@
 \name{fs_truthTable}
 \alias{fs_truthTable}
-%- Also NEED an '\alias' for EACH other topic documented here.
 \title{Construction of truthTable from fuzzy set score}
 \description{
-  ~~ A concise (1-5 lines) description of what the function does. ~~
+  Constructing a truthTable from fuzzy set score.
 }
 \usage{
-fs_truthTable(mydata, outcome = "", conditions = c(""), ncases_cutoff = 1, consistency_cutoff = 0.8, complete = FALSE, show.cases = TRUE, quiet = FALSE, cases = NULL, ...)
+fs_truthTable(mydata, outcome, conditions, ncases_cutoff = 1,
+consistency_cutoff = 0.8, complete = FALSE, show.cases = TRUE, quiet =
+FALSE, cases = NULL, ...)
 }
-%- maybe also 'usage' for other objects documented here.
 \arguments{
-  \item{mydata}{ ~~Describe \code{mydata} here~~ }
-  \item{outcome}{ ~~Describe \code{outcome} here~~ }
-  \item{conditions}{ ~~Describe \code{conditions} here~~ }
-  \item{ncases_cutoff}{ ~~Describe \code{ncases_cutoff} here~~ }
-  \item{consistency_cutoff}{ ~~Describe \code{consistency_cutoff} here~~ }
-  \item{complete}{ ~~Describe \code{complete} here~~ }
-  \item{show.cases}{ ~~Describe \code{show.cases} here~~ }
-  \item{quiet}{ ~~Describe \code{quiet} here~~ }
-  \item{cases}{ ~~Describe \code{cases} here~~ }
-  \item{\dots}{ ~~Describe \code{\dots} here~~ }
+  \item{mydata}{ A fuzzy set score dataset. All the scores must range
+    from 0 to 1.}
+  \item{outcome}{ character, the name of the outcome variable in the dataset.}
+  \item{conditions}{ character vetor, the name of the conditions from the dataset.}
+  \item{ncases_cutoff}{When number of case is less than cutoff, it will
+    be regarded as dontcare configuration.}
+  \item{consistency_cutoff}{Cutoff point of consistenty score, cases with
+    consistency score greater than cutoff point are regarded as OUT=1. }
+  \item{complete}{prints the complete truth table, including
+    configurations without empirical cases.}
+  \item{show.cases}{show the rownames from the original dataset for each
+    combination of conditions.}
+  \item{quiet}{Not used currently.}
+  \item{cases}{ character, variable of case names. If it is NULL and
+    show.cases is TRUE, name of cases are derived from row names of
+    dataset.}
+  \item{\dots}{Not used currently.}
 }
 \details{
-  ~~ If necessary, more details than the description above ~~
+  There are serveral pillars which make it possible to construct a crip
+  truthTable summarizing the raw data. There is a correspondance between
+  vector space corners and truthTable rows. Thus, it is possible to get
+  the number of cases with strong membership in each corner (usually
+  greater then 0.5), and the consistency of the empirical evidence for
+  each corner. By specifying the frequency thresholds for fuzzy-set
+  assessments (the 'ncases_cutoff' argument), and assessing the
+  consistency of fuzzy-set subset relations (the 'consistency_cutoff'
+  argument), we can finally construct a truthTable.
 }
 \value{
-  ~Describe the value returned
-  If it is a LIST, use
-  \item{comp1 }{Description of 'comp1'}
-  \item{comp2 }{Description of 'comp2'}
-  ...
+A truthTable.
 }
-\references{ ~put references to the literature/web site here ~ }
-\author{ ~~who you are~~ }
-\note{ ~~further notes~~ 
-
- ~Make other sections like Warning with \section{Warning }{....} ~
+\references{
+  Ragin. Charles. 2009. Qualitative Comparative Analyais Using Fuzzy
+  Sets (fsQCA). In Configuraional comparative Methods: qualitative
+  comparative analysis (QCA) and related techniques. ed by Benoit
+  RiHoux and Charles Ragin. Sage. This chapter can be downloaded from
+  \url{http://www.u.arizona.edu/~cragin/fsQCA/software.shtml}.
 }
-\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ }
+\author{Ronggui HUANG}
+\seealso{\code{\link{reduce}} \code{\link{cs_truthTable}}}
 \examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==>  Define data, use random,
-##--	or do  help(data=index)  for the standard data sets.
-
-## The function is currently defined as
-function (mydata, outcome = "", conditions = c(""), ncases_cutoff = 1, 
-    consistency_cutoff = 0.8, complete = FALSE, show.cases = TRUE, 
-    quiet = FALSE, cases = NULL, ...) 
-{
-    membership_cutoff = 0.5
-    if (consistency_cutoff > 1 || consistency_cutoff < 0) 
-        stop("consistency_cutoff should be in [0,1].")
-    if (consistency_cutoff < 0.75) 
-        warning("It is suggested that consistency_cutoff be >= 0.75.")
-    if (outcome == "" || conditions == "") 
-        stop("You must specific outcome and conditions first.")
-    fulldata <- mydata[, c(outcome, conditions)]
-    if (any(fulldata < 0) || any(fulldata > 1)) 
-        stop("Fuzzy set score must in [0,1].")
-    ncases_cutoff <- ifelse(ncases_cutoff < 1, ncases_cutoff * 
-        nrow(fulldata), ncases_cutoff)
-    allExpress <- eval(parse(text = (sprintf("expand.grid(\%s)", 
-        paste(conditions, "=1:0", sep = "", collapse = ",")))))
-    conditions <- mydata[, conditions]
-    getScore <- function(index, data) {
-        Negative <- which(index == 0)
-        Positive <- which(index == 1)
-        if (length(Negative) > 0 && length(Positive) > 0) {
-            score <- pmin(apply(1 - data[, Negative, drop = FALSE], 
-                1, min), apply(data[, Positive, drop = FALSE], 
-                1, min))
-        }
-        else if (length(Negative) > 0 && length(Positive) == 
-            0) {
-            score <- apply(1 - data[, Negative, drop = FALSE], 
-                1, min)
-        }
-        else if (length(Negative) == 0 && length(Positive) > 
-            0) {
-            score <- apply(data[, Positive, drop = FALSE], 1, 
-                min)
-        }
-    }
-    score_mat <- apply(allExpress, 1, function(x) getScore(x, 
-        data = conditions))
-    allExpress$NCase <- apply(score_mat, 2, function(x) sum(x > 
-        membership_cutoff))
-    allExpress$Consistency <- apply(score_mat, 2, function(x, 
-        outcome) {
-        sum(pmin(x, outcome))/sum(x)
-    }, outcome = mydata[, outcome])
-    allExpress$OUT <- "?"
-    allExpress$OUT[allExpress$NCase >= ncases_cutoff & allExpress$Consistency > 
-        consistency_cutoff] <- "1"
-    allExpress$OUT[allExpress$NCase >= ncases_cutoff & allExpress$Consistency <= 
-        consistency_cutoff] <- "0"
-    allExpress$OUT[allExpress$NCase < ncases_cutoff & allExpress$NCase > 
-        0] <- "-"
-    allExpress$freq0 <- allExpress$freq1 <- 0
-    allExpress$freq0[allExpress$OUT == "0"] <- allExpress$NCase[allExpress$OUT == 
-        "0"]
-    allExpress$freq1[allExpress$OUT == "1"] <- allExpress$NCase[allExpress$OUT == 
-        "1"]
-    allExpress <- allExpress[, c(seq_len(length(conditions)), 
-        (length(conditions) + 3):(length(conditions) + 5), (length(conditions) + 
-            1):(length(conditions) + 2))]
-    if (show.cases) {
-        if (is.null(cases)) 
-            cases <- rownames(mydata)
-        else cases <- mydata[, cases]
-        cases <- gsub(",", "_", cases)
-        allExpress$Cases <- apply(score_mat, 2, function(x) paste(cases[which(x > 
-            membership_cutoff)], sep = "", collapse = ","))
-    }
-    if (!complete) 
-        allExpress <- allExpress[allExpress$OUT != "?", , drop = FALSE]
-    allExpress
-  }
-}
-% Add one or more standard keywords, see file 'KEYWORDS' in the
-% R documentation directory.
-%\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
+fs_truthTable(Lipset_fs,"Survived.FZ",c("Developed.FZ","Urban.FZ","Literate.FZ","Industrial.FZ",
+"Stable.FZ"),cases="Country",consistency_cutoff=0.7)   
+}
\ No newline at end of file

Modified: pkg/man/suffnec.Rd
===================================================================
--- pkg/man/suffnec.Rd	2009-01-12 17:06:23 UTC (rev 4)
+++ pkg/man/suffnec.Rd	2009-01-13 04:08:36 UTC (rev 5)
@@ -1,6 +1,6 @@
 \name{suffnec}
 \alias{suffnec}
-\alias{print.suffnec}
+%\alias{print.suffnec}
 \title{Produces a sufficiency and necessity matrix}
 \description{
 creates a matrix of the sufficiency and necessity scores for a crisp set



More information about the Asrr-commits mailing list