full.tt {cna}R Documentation

Generate all logically possible value configurations of a given set of factors

Description

full.tt generates a truthTab with all logically possible value configurations of the factors defined in the input x. It is more flexible than allCombs. x can be a truthTab, a data frame, an integer, a list specifying the factors' value ranges, or a character vector featuring all admissible factor values.

Usage

full.tt(x, ...)

## Default S3 method:
full.tt(x, type = c("cs", "mv", "fs"), ...)
## S3 method for class 'truthTab'
full.tt(x, ...)
## S3 method for class 'tti'
full.tt(x, ...)

Arguments

x

A truthTab, a data frame, an integer, a list specifying the factors' value ranges, or a character vector featuring all admissible factor values (see the details and examples below).

type

Character vector specifying the type of x: "cs" (crisp-set), "mv" (multi-value), or "fs" (fuzzy-set); passed to truthTab; only required if x is a data frame or matrix.

...

Further arguments passed to methods.

Details

full.tt generates all logically possible value configurations of the factors defined in x, which can either be a character vector or an integer or a list or a data frame or a matrix.

In combination with selectCases, full.tt is useful for simulating data, which are needed for inverse search trials benchmarking the output of cna. While full.tt generates the space of all logically possible configurations of the factors in an analyzed factor set, selectCases selects those configurations from this space that are compatible with a given data-generating causal structure (i.e. the ground truth), that is, it selects the empirically possible configurations.

The method for class "tti" is for internal use only.

Value

A truthTab of type "cs" or "mv" with the full enumeration of combinations of the factor values.

See Also

truthTab, selectCases, allCombs

Examples

# x is a character vector.
full.tt("A + B*c")
full.tt("A=1*C=3 + B=2*C=1 + A=3*B=1") 
full.tt(c("A + b*C", "a*D"))
full.tt("!A*-(B + c) + F")

# x is a data frame.
full.tt(d.educate)
full.tt(d.jobsecurity, type = "fs")
full.tt(d.pban, type = "mv")

# x is a truthTab.
full.tt(cstt(d.educate))
full.tt(fstt(d.jobsecurity))
full.tt(mvtt(d.pban))

# x is an integer.
full.tt(6)

# x is a list.
full.tt(list(A = 0:1, B = 0:1, C = 0:1))  # cs
full.tt(list(A = 1:2, B = 0:1, C = 1:4))  # mv

# Simulating crisp-set data.
groundTruth.1 <- "(A*b + C*d <-> E)*(E*H + I*k <-> F)"
fullData <- full.tt(groundTruth.1)
idealData <- selectCases(groundTruth.1, fullData) 
# Introduce 20% data fragmentation.
fragData <- idealData[-sample(1:nrow(idealData), nrow(idealData)*0.2), ] 
# Introduce 10% random noise.
realData <- rbind(tt2df(fullData[sample(1:nrow(fullData), nrow(fragData)*0.1), ]), fragData)

# Simulating multi-value data.
groundTruth.2 <- "(JO=3 + TS=1*PE=3 <-> ES=1)*(ES=1*HI=4 + IQ=2*KT=5 <-> FA=1)"
fullData <- full.tt(list(JO=1:3, TS=1:2, PE=1:3, ES=1:2, HI=1:4, IQ=1:5, KT=1:5, FA=1:2))
idealData <- selectCases(groundTruth.2, fullData) 
# Introduce 20% data fragmentation.
fragData <- idealData[-sample(1:nrow(idealData), nrow(idealData)*0.2), ] 
# Introduce 10% random noise.
realData <- rbind(tt2df(fullData[sample(1:nrow(fullData), nrow(fragData)*0.1), ]), fragData)


[Package cna version 2.2.0 Index]