mat.samps: Generate a matrix of samples from a chosen distribution.

Description Usage Arguments Value Examples

Description

Draws random data and formats them into a matrix, where each row contains a sample. By default, the random data are drawn form a normal distribution, but the user can supply an alternative.

Usage

1
mat.samps(n, nsim = 10000, rx = rnorm, ...)

Arguments

n

The number of independent observations to include in each sample (i.e. each row of the output matrix).

nsim

The number of samples to generate (i.e. the number of rows in the output matrix).

rx

A function generating random data (rnorm by default).

...

Additional arguments to rx.

Value

A matrix of independent random numbers with nsim rows and n columns.

Examples

1
2
3
4
mat.samps(3, 5) #data from standard normal
mat.samps(3, 5, mean = 10, sd = 2) #normal with expectation 10 and sd 2.
mat.samps(3, 5, rx = rexp, .1) #exponential with rate .1
mat.samps(3, 5, rx = rnorm.contam, contam.p = .2) #standard normal contaminated with 20% outliers

mdedge/stfspack documentation built on May 9, 2019, 8:17 a.m.