What is different between these two codes and when can we use them

I use K-S test code in R to check normaliity for data that is generated from N(1,6) of size 5

#the first code is



#the second code is 
ks.test(x,"pnorm",mean(x),sd(x)) ```
  • 2
    $\begingroup$ The difference is 1,6 using the theoretical moments of the distribution versus mean(x),sd(x) using the empirical moments of the sample. $\endgroup$
    – Xi'an
    Oct 17, 2021 at 13:33
  • 1
    $\begingroup$ The most obvious thing to do* is run the code whence you would see that mean(x) is not 1 and sd(x) is not 6. $\:\:$ *(certainly it would be something you should do before posting, since it would count under the required "search and research" that is mentioned in the help here) $\endgroup$
    – Glen_b
    Oct 18, 2021 at 1:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.