[R] simulation

Christopher Kelvin chris_kelvin2001 at yahoo.com
Fri Apr 6 04:57:08 CEST 2012


Hello,
i need to simulate 100 times, n=40 , 
the distribution has 90% from X~N(0,1) + 10% from X~N(20,10)
Is my loop below correct?
Thank you

n=40
for(i in 1:100){
x<-rnorm(40,0,1)  # 90% of n

z<-rnorm(40,20,10)  # 10% of n
}
x+z




More information about the R-help mailing list