Learn R Programming

prefmod (version 0.8-36)

simPC: Utility function to simulate paired comparison or rankings data

Description

The function generates a random paired comparison data matrix (two response categories, no undecided) or a rankings data matrix optionally based on user specified worth parameters.

Usage

simPC(nobj, nobs, worth = NULL, seed = NULL, pr = FALSE)
simR(nobj, nobs, worth = NULL, seed = NULL, pr = FALSE)

Value

The random data matrix as a data frame.

Arguments

nobj

Number of objects.

nobs

Number of cases.

worth

If NULL, values are drawn from uniform distribution (interval from 0 to 1), otherwise the user may specify arbitrary values. In both cases, the values are transformed into [0, 1] and scaled to sum up to 1.

seed

Starting value for the random number generator.

pr

If TRUE, the used worth parameters are printed.

Author

Reinhold Hatzinger

Examples

Run this code
data <- simPC(4, 10, worth = 1:4, seed = 123456)
data

Run the code above in your browser using DataLab