Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.kstest needs to match ks.test (modulo the sign) #44

Open
tetomonti opened this issue May 16, 2022 · 0 comments
Open

.kstest needs to match ks.test (modulo the sign) #44

tetomonti opened this issue May 16, 2022 · 0 comments

Comments

@tetomonti
Copy link
Collaborator

I realized that .kstest, as it is now implemented, does not match ks.test's behavior when alternative != "two.sided". In particular, the score in ks.test is defined as follows:

STATISTIC <- switch(alternative, two.sided = max(abs(z)), 
        greater = max(z), less = -min(z))

Thus, in .kstest, score should be computed as follows:

score <- if (absolute) max(z)-min(z) else switch(alternative, 
         two.sided = z[which.max(abs(z))],
         greater = max(z), 
         less = min(z))

Also, the command

results <- suppressWarnings(ks.test(1:n.x, y, alternative="less"))

should be replaced by

results <- suppressWarnings(ks.test(y, 1:n.x, alternative="greater"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant