Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4619980
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:29:53+00:00 2026-05-22T02:29:53+00:00

I have 500,000 values for a variable derived from financial markets. Specifically, this variable

  • 0

I have 500,000 values for a variable derived from financial markets. Specifically, this variable represents distance from the mean (in standard deviations). This variable has a arbitrary distribution. I need a formula that will allow me to select a range around any value of this variable such that an equal (or close to it) amount of data points fall within that range.

This will allow me to then analyze all of the data points within a specific range and to treat them as “similar situations to the input.”

From what I understand, this means that I need to convert it from arbitrary distribution to uniform distribution. I have read (but barely understood) that what I am looking for is called “probability integral transform.”

Can anyone assist me with some code (Matlab preferred, but it doesn’t really matter) to help me accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:29:54+00:00Added an answer on May 22, 2026 at 2:29 am

    Here’s something I put together quickly. It’s not polished and not perfect, but it does what you want to do.

    clear
    randList=[randn(1e4,1);2*randn(1e4,1)+5];
    [xCdf,xList]=ksdensity(randList,'npoints',5e3,'function','cdf');
    xRange=getInterval(5,xList,xCdf,0.1); 
    

    and the function getInterval is

    function out=getInterval(yPoint,xList,xCdf,areaFraction)
        yCdf=interp1(xList,xCdf,yPoint);
        yCdfRange=[-areaFraction/2, areaFraction/2]+yCdf;
    
        out=interp1(xCdf,xList,yCdfRange);
    

    Explanation:

    The CDF of the random distribution is shown below by the line in blue. You provide a point (here 5 in the input to getInterval) about which you want a range that gives you 10% of the area (input 0.1 to getInterval). The chosen point is marked by the red cross and the
    interval is marked by the lines in green. You can get the corresponding points from the original list that lie within this interval as

    newList=randList(randList>=xRange(1) & randList<=xRange(2));
    

    You’ll find that on an average, the number of points in this example is ~2000, which is 10% of numel(randList)

    numel(newList)
    
    ans =
    
            2045
    

    enter image description here

    NOTE:

    • Please note that this was done quickly and I haven’t made any checks to see if the chosen point is outside the range or if yCdfRange falls outside [0 1], in which case interp1 will return a NaN. This is fairly straightforward to implement, and I’ll leave that to you.
    • Also, ksdensity is very CPU intensive. I wouldn’t recommend increasing npoints to more than 1e4. I assume you’re only working with a fixed list (i.e., you have a list of 5e5 points that you’ve obtained somehow and now you’re just running tests/analyzing it). In that case, you can run ksdensity once and save the result.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a series of NSNumber objects with values between 0 and 500,000.
I have a directory with 500,000 files in it. I would like to access
Greetings. 1 - Let's say I have about 500 folders of variable size with
I have a 2D bitmap-like array of let's say 500*500 values. I'm trying to
I have a list of upwards 3,000 decimal values and for each one I
Suposse I have the next MySQL database with 500.000 rows : users { id
I have a sorted array of about 500,000 ints. Currently I am selecting the
I have a about 500.000 rows in database and they are look like: :hello:hi:
I have a dataframe with approximately 500,000 rows and four columns. The dataframe contains
I have a huge mbox file, with maybe 500 emails in it. It looks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.