You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes you don't need the exact ranks of elements in a vector but what quantile each value is in. For quintiles you would return an integer from 1 to 5 corresponding to each element. Such partial ranking ought to be faster than full ranking, especially when the number of groups is small compared to the size of the vector. The interface could be
pure function quantile(x,ngroups) result(igroup)
real, intent(in) :: x(:) ! data to be grouped
integer, intent(in) :: ngroups ! # of groups
integer :: igroup(size(x)) ! returned values will be between 1 and ngroups, inclusive
end function quantile
In finance, researchers commonly group stocks into quintiles or deciles based on some characteristic, such as price/earnings ratio, and then study future performance by quintile. The exact ranks of stocks are not needed for such studies.
The text was updated successfully, but these errors were encountered:
I often use the histogram function in NumPy and matplotlib, and this seems somewhat related. The difference is that this function would return the index of the bin that each elements belongs in, whereas histogram returns the number of elements in each bin. Though I haven't had use for this myself, it sounds useful.
Sometimes you don't need the exact ranks of elements in a vector but what quantile each value is in. For quintiles you would return an integer from 1 to 5 corresponding to each element. Such partial ranking ought to be faster than full ranking, especially when the number of groups is small compared to the size of the vector. The interface could be
There was a Stack Overflow thread Efficient algorithm of partial sorting into N unsorted groups
In finance, researchers commonly group stocks into quintiles or deciles based on some characteristic, such as price/earnings ratio, and then study future performance by quintile. The exact ranks of stocks are not needed for such studies.
The text was updated successfully, but these errors were encountered: