some {cna} | R Documentation

## Randomly select configurations from a data frame or `truthTab`

### Description

Randomly select configurations from a data frame or `truthTab` with or without replacement.

### Usage

    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, ...)

### Arguments

`x` | Data frame or `truthTab`.
`n` | Sample size.
`replace` | Logical; if `TRUE`, configurations are sampled with replacement.
`...` | Not used.

### Details

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.

### Value

A data frame or truthTab.

### Note

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.

### References

Krook, Mona Lena. 2010. “Women's Representation in Parliament: A Qualitative Comparative Analysis.” Political Studies 58(5):886-908.

### See Also

`truthTab`, `selectCases`, `allCombs`, `makeFuzzy`, `cna`, `d.women`

### Examples

    # 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)

[Package cna version 2.2.0 Index]