sim.samp: Code for Generating Random Samples

View source: R/sim.samp.R

sim.sampR Documentation

Code for Generating Random Samples

Description

sim.samp — generates N samples of size n from distribution DIST

Usage

sim.samp(nrep, n, DIST, ...)

Arguments

nrep

= number of random data sets

n

= sample size of each data set

DIST

= distribution to generate from, e.g., runif, rnorm, additional parameters in ...

...

Additional arguments to be passed

Value

N by n matrix, each row is a data set of size n

Author(s)

Dennis Boos, Kevin Matthew, Jason Osborne

Examples

N<-100
 set.seed(346)            # sets the random number seed
 sim.samp(N,15,rnorm)->z  # 100 N(0,1) samples of size n=15
 sim.samp(N,40,rnorm,mean=10,sd=5)->z  # 100 N(10,25) samples of size n=40

# Function Code

sim.samp <- function(nrep,n,DIST,...){
 data <- matrix(DIST(n * nrep, ...), ncol = n, nrow = nrep)}


Monte.Carlo.se documentation built on April 6, 2023, 5:22 p.m.