sim.samp {Monte.Carlo.se} | R 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)}
[Package Monte.Carlo.se version 0.1.1 Index]