View source: R/simulateCardData.R
simulateCardData | R Documentation |
This function simulates card sorting data based on user-specified parameters, such as the number of sorters, the probability of correct sorting, and the weights for different card attributes.
simulateCardData(
nSorters = 40,
pCorrect = 0.95,
attributeWeights = c(1, 1, 1, 1),
verbose = TRUE
)
nSorters |
An integer specifying the number of sorters to simulate. Default is 40. |
pCorrect |
A numeric value between 0 and 1 specifying the probability that a card is sorted correctly. Default is 0.95. |
attributeWeights |
A numeric vector of length 4 specifying the weights
for the card attributes (e.g., |
verbose |
Logical, if |
The function simulates a card sorting experiment where cards are
sorted by multiple sorters based on one of four attributes. The probability
of sorting a card correctly is determined by pCorrect
, and errors are
introduced randomly for each sorter. The attribute weights determine how many
sorters focus on each attribute, and a warning is issued if the weights do
not align with the total number of sorters.
The function returns a data frame containing simulated card sorting data for all sorters, including sorter IDs, card IDs, and assigned stacks.
A data frame with columns:
sorterID
A unique identifier for each sorter.
statement
The ID of the card being sorted.
stackID
The stack assigned to the card by the sorter.
rbinom
, sample
# Simulate data with default parameters:
set.seed(1)
myCMData <- simulateCardData()
# Simulate data with custom parameters:
set.seed(1)
myCMData <- simulateCardData(nSorters=40, pCorrect=.90, attributeWeights=c(1,1,1,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.