mult.rnorm {NCStats}R Documentation

Multiple Simulations from Normal Distributions

Description

Random generation from multiple normal distributions with with potentially different means and standard deviations.

Usage

mult.rnorm(n,mean,sd,exact=TRUE,grp.labels=LETTERS[1:length(n)],
           var.labels=c("measure","group"),numdigs=NULL)

Arguments

n number of observations.
mean vector of means.
sd vector of standard deviations.
exact a logical that indicates whether the resulting vector of random numbers will have the exact mean and standard deviation supplied in mean and sd.
grp.labels Labels for the levels representing the different groups.
var.labels Labels for or names for the columns of the resulting data frame.
numdigs A number of digits to which the numeric data should be rounded.

Details

All of n, mean, sd, and grp.labels must be of the same length.

If digits is non-null and exact=TRUE the resulting quantitative data will only be approximately exact (due to the rounding).

Value

A data frame with two columns is returned. The first columns is the random normal deviates and the second column are the group lavels..

Author(s)

Derek H. Ogle, dogle@northland.edu.

See Also

rnorm.

Examples

# using default names
rand.data <- mult.rnorm(n=c(10,15,20),mean=c(10,15,15),sd=c(3,4,5))
tapply(rand.data$measure,rand.data$group,FUN=Summary)
  
# using custom names
rand.data <- mult.rnorm(n=c(10,15),mean=c(10,15),sd=c(3,4),
  grp.labels=c("First","Second"),var.labels=c("Y","X"))
tapply(rand.data$Y,rand.data$X,FUN=Summary)


[Package NCStats version 0.0-12 Index]