R: Create random samples for simulations

create_sim_samples {precrec} | R Documentation

## Create random samples for simulations

### Description

The `create_sim_samples` function generates random samples with different performance levels.

### Usage

    create_sim_samples(n_repeat, np, nn, score_names = "random")

### Arguments

`n_repeat` | The number of iterations to make samples.
`np` | The number of positives in a sample.
`nn` | The number of negatives in a sample.
`score_names` | A character vector for the names of the following performance levels. "random" Random "poor_er" Poor early retrieval "good_er" Good early retrieval "excel" Excellent "perf" Perfect "all" All of the above

### Value

The `create_sim_samples` function returns a list with the following items.

- scores: a list of numeric vectors

- labels: an integer vector

- modnames: a character vector of the model names

- dsids: a character vector of the dataset IDs

### See Also

`mmdata` for formatting input data. `evalmod` for calculation evaluation measures.

### Examples

    ##################################################
    ### Create a set of samples with 10 positives and 10 negatives
    ### for the random performance level
    ###
    samps1 <- create_sim_samples(1, 10, 10, "random")

    ## Show the list structure
    str(samps1)

    ##################################################
    ### Create two sets of samples with 10 positives and 20 negatives
    ### for the random and the poor early retrieval performance levels
    ###
    samps2 <- create_sim_samples(2, 10, 20, c("random", "poor_er"))

    ## Show the list structure
    str(samps2)

    ##################################################
    ### Create 3 sets of samples with 5 positives and 5 negatives
    ### for all 5 levels
    ###
    samps3 <- create_sim_samples(3, 5, 5, "all")

    ## Show the list structure
    str(samps3)

[Package precrec version 0.9.1 Index]