The function of R ppoints is described as:
Ordinates for Probability Plotting Description: Generates the sequence of probability points '(1:m - a)/(m + (1-a)-a)' where 'm' is either 'n', if 'length(n)==1', or 'length(n)'. Usage: ppoints(n, a = ifelse(n <= 10, 3/8, 1/2)) ...
I am trying to reproduce this function in python and I have a few doubts.
1- The first m in (1:m - a)/(m + (1-a)-a) always an integer: int(n) (i.e. an integer n ) if length(n)==1 and length(n) otherwise.
2- The second m in the same equation is NOT an integer if length(n)==1 (it takes a real value n ) and IS is an integer ( length(n) ) otherwise.
3- n in a = ifelse(n <= 10, 3/8, 1/2) is the real number n if length(n)==1 and the integer length(n) otherwise.
This is not entirely clear in this description, and I am very grateful if someone can confirm that this is so.
Add
Well, this was originally published at https://stats.stackexchange.com/ , because I was hoping to get input from extras that work with the ppoints function. Since it has been ported here, I will insert below the function I wrote for replicating ppoints in python . I tested it and both seemed to return the same results, but it would be great if someone could clarify the above points, because they are not fully understood by the function description.
def ppoints(vector): ''' Mimics R function 'ppoints'. ''' m_range = int(vector[0]) if len(vector)==1 else len(vector) n = vector[0] if len(vector)==1 else len(vector) a = 3./8. if n <= 10 else 1./2 m_value = n if len(vector)==1 else m_range pp_list = [((m+1)-a)/(m_value+(1-a)-a) for m in range(m_range)] return pp_list
source share