Desktop productivity for business analysts and programmers

Cumulative Distribution Function

Reply
Contributor
Posts: 20

Cumulative Distribution Function

Dear all, 

I am doing 1000 bootstrap simulations delivering 1000 series of returns. 
Afterwards I need to plot these series on one a cumulative distribution function graph but I need to aggregate these 1000 series in only one cumulative distribution (the mean of all the simulations) and then compare it with the cumulative distribution of the actual series of returns.

 

Do you have any idea for me? Knowing that I have a first column with the actual returns and then 1000 columns with the series of return from the 1000 bootstrap simulations. 

Thanks a lot in advance for your precious help Smiley Happy

Super User
Posts: 13,941

Re: Cumulative Distribution Function

What does your data look like?

What specific aggregate do you want?

Do all of these simulations have the same x axis values (since you want to plot them)?

 

If the x values are the same in each simulation then 1) combine the data sets and 2: summarize using the x value as a class variable.

Something like

 

proc summary data=have;

   class x;

   var simulatiedvariable;

   output out=agg max= min= mean= = /autoname;

run;

 

I would include the min, max and possibly confidence limits as well as additional bits to show in the plot for comparisons.

In a data step to the accumulation to have values of the cumulative values.

 

Similar data set of the "actual series of returns" whatever that may be.

Combine the aggregate data with the other data adding a variable to indicate the source.

Plot with source variable a group variable with a step, series or scatter plot using Proc SGplot.

Contributor
Posts: 20

Re: Cumulative Distribution Function

Hi, 

First, thank you very much for your answer! 

I have the actual return series that I can plot on a CDF and I would like to compare this curve with a mean CDF of the 1000 series of return from my bootstrap simulations. 

So my excel file will be composed of 1001 columns of 3110 returns (1000 bootstrap simulations and the actual one). 

At the end I would like to have one graph with two CDFs, one illustrating the series of actual return and one illustrating a mean of the 1000 others. 

I attached an example of subsample of my excel file so that it is probably easier for you to help...

Again, thanks a lot! Smiley Happy

Super User
Posts: 13,941

Re: Cumulative Distribution Function


@Max05 wrote:

Hi, 

First, thank you very much for your answer! 

I have the actual return series that I can plot on a CDF and I would like to compare this curve with a mean CDF of the 1000 series of return from my bootstrap simulations. 

So my excel file will be composed of 1001 columns of 3110 returns (1000 bootstrap simulations and the actual one). 

At the end I would like to have one graph with two CDFs, one illustrating the series of actual return and one illustrating a mean of the 1000 others. 

I attached an example of subsample of my excel file so that it is probably easier for you to help...

Again, thanks a lot! Smiley Happy


Why Excel?

You have the data in SAS, plot it in SAS. Do you intend to export 1000 runs and combine them in Excel? Then summarize in Excel?

 

If you want to "aggregate" then there should be some common value to aggregate with.

 

 

Also it appears that you may be thinking of generating 1000 separate columns of data, one for each simulation. That is generally a poor way to approach this. SAS works differently than Excel and attempting to force SAS to work like Excel is just extra work.

 

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Ask a Question
Discussion stats
  • 3 replies
  • 150 views
  • 1 like
  • 2 in conversation