lundi 23 août 2021

generate 9 sets of normal distribution values and obtain a matrix output

I need to fit 9 different normal distributions, and i have to randomly sample 400 values from each distribution 10000 times. As an output I need to have a matrix of 400x9 (samples x normal distribution column). Basically, I need to combine all the 9 columns into one data frame. Currently, I can only see the first column but i need the 9 columns and 400 rows as an output. I would appreciate help on this. Thanks!

set.seed(400) 
num.reps<- 10000
sample.pc<- list(mode="vector", length = num.reps)

for(i in 1:num.reps){
  sample.pc[[i]] <- rnorm(400, mean =5.537264e-17, sd = 2.49595553)
  sample.pc2 <- rnorm(400, mean = -2.429305e-16, sd = 1.35352493)
  sample.pc3 <- rnorm(400, mean=    -7.333272e-18, sd = 0.90022111)
  sample.pc4 <- rnorm(400, mean = -1.983712e-16, sd = 0.28241488)
  sample.pc5 <- rnorm(400, mean = 3.032541e-17, sd = 0.15098984)
  sample.pc6 <- rnorm(400, mean = 2.077501e-18, sd = 0.11122803)
  sample.pc7 <- rnorm(400, mean = 8.101434e-18, sd = 0.08348879)
  sample.pc8 <- rnorm(400, mean = -2.521973e-17, sd = 0.06165478)
  sample.pc9 <- rnorm(400, mean = 1.780955e-17, sd= 0.04559334)
**strong text**}



Aucun commentaire:

Enregistrer un commentaire