i want to simulate it 500 times but this function gives 187 correct values but after 187 values it give NA values

The line:

X1<-runif(188)

initializes X1 with 188 values. If you’re indexing X1[189], there is an error.

Try this:

print (X1[189])
> NA

In order to correct it, just change your runif:

X1<-runif(500)

Browse More Popular Posts

Leave a Comment