sim.samp | R Documentation |
sim.samp
— generates N samples of size n from distribution DIST
sim.samp(nrep, n, DIST, ...)
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 |
N by n matrix, each row is a data set of size n
Dennis Boos, Kevin Matthew, Jason Osborne
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)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.