# User defined data input
#------------------------
dat1 <- data.frame(
A = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
B = c(1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
C = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0),
D = c(1,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0,0),
E = c(1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,0,0)
)
# Default return of the truthTab function.
truthTab(dat1)
# By means of the print function, the cases featuring each configuration can be recovered.
print(truthTab(dat1), show.cases = TRUE)
# The same truth table as before can be generated by using the frequency argument while
# listing each configuration only once.
dat1 <- data.frame(
A = c(1,1,1,1,1,1,0,0,0,0,0),
B = c(1,1,1,0,0,0,1,1,1,0,0),
C = c(1,1,1,1,1,1,1,1,1,0,0),
D = c(1,0,0,1,0,0,1,1,0,1,0),
E = c(1,1,0,1,1,0,1,0,1,1,0)
)
truthTab(dat1, frequency = c(4,3,1,3,4,1,4,1,3,3,3))
# Truth tables generated by truthTab can be input into the cna function.
dat1_tt <- truthTab(dat1, frequency = c(4,3,1,3,4,1,4,1,3,3,3))
cna(dat1_tt, con = 0.85)
# By means of the case.cutoff argument configurations with less than 2 cases can
# be excluded, which maneuver yields perfect consistency and coverage scores for dat1.
dat1_tt <- truthTab(dat1, frequency = c(4,3,1,3,4,1,4,1,3,3,3), case.cutoff = 2)
cna(dat1_tt)
# Greckhamer et al. (2008) on the causal conditions for superior business-unit performance
#-----------------------------------------------------------------------------------------
# Load dataset.
data(d.performance)
truthTab(d.performance[1:8], frequency = d.performance$frequency)
# Eliminate configurations with less than 5 cases.
truthTab(d.performance[1:8], frequency = d.performance$frequency, case.cutoff = 5)
# Switch the factor "superior performance" into the factor "inferior performance".
truthTab(d.performance[1:8], frequency = d.performance$frequency, switch = c("SP"))
# Various large-n CNAs of d.performance with varying case, consistency, and coverage
# cut-offs.
cna(truthTab(d.performance[1:8], frequency = d.performance$frequency, case.cutoff = 5),
con = 0.8, cov = 0.8)
cna(truthTab(d.performance[1:8], frequency = d.performance$frequency, case.cutoff = 5),
con = 0.75, cov = 0.75)
cna(truthTab(d.performance[1:8], frequency = d.performance$frequency, case.cutoff = 10),
con = 0.75, cov = 0.75)
print(cna(truthTab(d.performance[1:8], frequency = d.performance$frequency,
case.cutoff = 7), con = 0.65, cov = 0.75, what = "c"), nsolutions = "all")
Run the code above in your browser using DataLab