some {cna} | R Documentation |
truthTab
Randomly select configurations from a data frame or truthTab
with or without replacement.
some(x, ...) ## S3 method for class 'data.frame' some(x, n = 10, replace = TRUE, ...) ## S3 method for class 'truthTab' some(x, n = 10, replace = TRUE, ...)
x |
Data frame or |
n |
Sample size. |
replace |
Logical; if |
... |
Not used. |
The function some
randomly samples configurations from x
, which is a data frame or truthTab
. Such samples can, for instance, be used to simulate data fragmentation (limited diversity), i.e. the failure to observe/measure all configurations that are compatible with a data generating causal structure. They can also be used to simulate large-N data featuring multiple cases instantiating each configuration.
A data frame or truthTab.
The some
generic function and the method for data frames are adopted from the car package. In particular, our data.frame
-method has an additional argument replace
, which is TRUE
by default. It will by default not apply the same sampling scheme as the method in car.
Krook, Mona Lena. 2010. “Women's Representation in Parliament: A Qualitative Comparative Analysis.” Political Studies 58(5):886-908.
truthTab
, selectCases
, allCombs
, makeFuzzy
, cna
, d.women
# Randomly sample configurations from the dataset analyzed by Krook (2010). tt.women <- truthTab(d.women) some(tt.women, 20) some(tt.women, 5, replace = FALSE) some(tt.women, 5, replace = TRUE) # Simulate limited diversity in data generated by the causal structure # A=2*B=1 + C=3*D=4 <-> E=3. dat1 <- allCombs(c(3, 3, 4, 4, 3)) dat2 <- selectCases("A=2*B=1 + C=3*D=4 <-> E=3", dat1, type = "mv") (dat3 <- some(dat2, 150, replace = TRUE)) mvcna(dat3) # Simulate large-N fuzzy-set data generated by the common-cause structure # (A*b*C + B*c <-> D) * (A*B + a*C <-> E). dat1 <- selectCases("(A*b*C + B*c <-> D) * (A*B + a*C <-> E)") dat2 <- some(dat1, 250, replace = TRUE) dat3 <- makeFuzzy(tt2df(dat2), fuzzvalues = seq(0, 0.45, 0.01)) fscna(dat3, ordering = list(c("D", "E")), strict = TRUE, con = .8, cov = .8)