Description Usage Arguments Details Value Author(s) See Also Examples
Calculates the number of samples from an urn under different sampling scenarios.
1 |
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. |
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.
When replace = TRUE
and ordered = TRUE
, the value is n^k.
When replace = FALSE
and ordered = TRUE
, the value is
n!/(n-k)!.
When replace = FALSE
and ordered = FALSE
, the value is
n!/[k!(n-k)!].
When replace = TRUE
and ordered = FALSE
, the value is
(n-1+k)!/[(n-1)!k!].
A number.
G. Jay Kerns gkerns@ysu.edu.
1 2 3 4 |
Loading required package: combinat
Attaching package: ‘combinat’
The following object is masked from ‘package:utils’:
combn
Loading required package: fAsianOptions
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: fOptions
Attaching package: ‘prob’
The following objects are masked from ‘package:base’:
intersect, setdiff, union
[1] 9
[1] 6
[1] 3
[1] 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.