Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I wish to run the Kolmogorov-Smirnov test on my data to determine how well it conforms to a specific continuous distribution function I have in mind.

If my understanding is correct, the Kolmogorov-Smirnov test can be performed in R with something along the lines of:

ks.test(my_data, "pweibull", shape=2, scale=1)

where in the case above pweibull is indicating a test against the Weibull function.

The issue I am having is that the function I want to test against (the BiPareto function defined here for what it's worth) is not a standard part of R best I can tell. Is it possible to define one's own function with parameters in R that can be passed to ks.test()?

ie. so I can have a call like:

ks.test(my_data, "bipareto", alpha=a_param, beta=b_param, c=c_param, k=k_param)
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

The help on the ks.test function is explicit - you can supply a cdf as a function:

Alternatively, y can be a character string naming a continuous (cumulative) distribution function, or such a function.

The last bit is where it tells you that.

So you can make a function called bipareto (say) that computes the cdf, and use that in the call. But you don't have to put it in quotes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.