Question

Using R programming, create a 5 by 3 matrix containing 15 random numbers generated from a normal distribution with mean = 5 and standard deviation = 2 using the rnorm function, entered into the matrix by row. Calculate the mean and standard deviation for:

a. The entire matrix.

b. Each column.

c. Each row.

EXPERT ANSWER

#Generate a set of 15 numbers with mean=5 and sd=2 using rnorm

mat<-rnorm(15,5,2)

data.a <-c(mat)

#assign the generated