sim: Simulate Draws from a Sample Space

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Simulates the experiment of drawing from a sample space.

Usage

1
2
3
4
5
6
7
sim(x, ...)

## Default S3 method:
sim(x, ntrials, ...)

## S3 method for class 'ps'
sim(x, ntrials, ...)

Arguments

x

a probability space or a subset of one.

ntrials

number of times to repeat the experiment.

...

further arguments to be passed to or from other methods.

Details

The sim() function is a wrapper for sample(), except that it strips the probs component from the result and (if x is a data frame) renames the rownames of the data frame consecutively from 1:ntrials.

Value

A data frame if space is a data frame, or a list if space is of class ps.

Author(s)

G. Jay Kerns gkerns@ysu.edu.

See Also

empirical

Examples

1
2
3
4
5
6
S <- cards(makespace = TRUE)
sim(S, ntrials = 5)

T <- urnsamples(S, 2)
U <- probspace(T)
sim(U, ntrials = 4)

aflaherty13/prob documentation built on May 28, 2019, 4:42 p.m.