nsamp: Number of Samples from an Urn

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

Description

Calculates the number of samples from an urn under different sampling scenarios.

Usage

1

Arguments

n

an integer or integer vector.

k

an integer or integer vector.

replace

logical indicating whether sampling should be done with replacement.

ordered

logical indicating whether order among samples is important.

Details

The nsamp() function will calculate the number of samples from an urn under assorted assumptions on the sampling procedure. The arguments are: n, the number of (distinguishable) objects in the urn, k, the sample size, and replace, ordered as documented in urnsamples.

nsamp() is vectorized, so that entering vectors instead of numbers for n, k, replace, and ordered results in a vector of corresponding answers.

The formulas used in the four possible combinations of replace and ordered are as follows.

Value

A number.

Author(s)

G. Jay Kerns gkerns@ysu.edu.

See Also

urnsamples

Examples

1
2
3
4
nsamp(n=3, k=2, replace = TRUE, ordered = TRUE)
nsamp(n=3, k=2, replace = TRUE, ordered = FALSE)
nsamp(n=3, k=2, replace = FALSE, ordered = FALSE)
nsamp(n=3, k=2, replace = FALSE, ordered = TRUE)

Example output

Loading required package: combinat

Attaching package:combinatThe following object is masked frompackage:utils:

    combn

Loading required package: fAsianOptions
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: fOptions

Attaching package:probThe following objects are masked frompackage:base:

    intersect, setdiff, union

[1] 9
[1] 6
[1] 3
[1] 6

prob documentation built on May 2, 2019, 12:20 p.m.