0

The following is my code:

phi=0.5

a1<-0 
a2<-c()

set.seed(1)
for(u in 1:100){ 
  a<-rgamma(1,shape = 1/phi, scale = phi) 
  a1<-a1+a 
  a2<-c(a2,a) 
  }


a1-sum(a2)
# [1] 1.421085e-14

Which is correct?

rawr
  • 20,481
  • 4
  • 44
  • 78
Kanna
  • 1
  • 2

0 Answers0