I'am new with R. If you could help me that would be great. My problem is as follows. I have this code:
N <- 1000 # number of simulations
n <- 30
prob <- 0.001
Y2 <- rep(0, times=N)
for(i in 1:N) {
X <- rbinom(n, size=1, prob)
#binomial experiment
Y2[i] <- sum(X)
}
table(Y2)
library(dgof)
ks.test(Y2, "pnorm", mean=prob*n, sd=sqrt(n*prob*(1-prob)))
I want to generete this code 10 times, so I'll get 10 different p-values and D. Also the parameter n will be not fixed, but it will be a vector of values (50,100,500,1000,5000). So I want a matrix of ks.test like on a picture. Thx.enter image description here
Aucun commentaire:
Enregistrer un commentaire