[R] Vectors, Loops, Rnorm and KS-Testing

Nicoletta Sabov nicoletta.sabov at hotmail.de
Mon May 23 11:30:33 CEST 2016


Hi there,

I need a function, that calculates the mean of a desired amount of normally distributed numbers and repeats this process for a desired number of repetitions. The function should return only a single vector consisting solely of the calculated means. Also the user of this function must be able to specify the parameters of the normal distribution used while calculating the means. I need this function for the Kolmogorov Smirnov Test.
I am a total beginner, so far I only have come to this point:

kolmo <- function(x, mean, sd, rep){
  
  for(i in rep){
    cat(mean(rnorm(x, mean, sd)))
    
}}
This returns a simple number, but I do need a vector to be returned.
Thanks a lot in advance!



	[[alternative HTML version deleted]]



More information about the R-help mailing list