0

I want to make a CCDF graph by reading data from a text file.

CCDF means Complementary Cumulative Distribution Function.

I have tried to search about CCDF, but I do not really understand about it.

So I don't know how to make a CCDF graph with the following data.

Here is my data "file.txt", which is the inter-arrival time(second):

2.824562000
7.914959000
15.838087000
1.013451000
2.813006000
0.424052000
0.146252000
0.166075000
2.298860000
6.393684000
5.341003000
0.005898000
0.009670000
0.453621000
0.068486000
0.039053000

How to plot this graph in Java or C# by reading data from "file.txt"? Any other programming language is also ok.

hana
  • 31
  • 1
  • 5

2 Answers2

2

You can easily calculate and plot the ccdf (complementary cumulative distribution function) with R (note: ccdf=1-cdf):

x <- c(2.824562, 7.914959, 15.838087, 1.013451, 2.813006, 0.424052, 
       0.146252, 0.166075, 2.29886, 6.393684, 5.341003, 0.005898, 0.00967, 
       0.453621, 0.068486, 0.039053) # sample data

f <- ecdf(x) # this is the cdf
plot(f)

enter image description here

plot(sort(x), 1-f(sort(x)), type="s", lwd=19) # this is the ccdf

enter image description here

Julián Urbano
  • 8,378
  • 1
  • 30
  • 52
  • I don't want to plot it in R. I want to plot it in other programming languages such as Java, C#, Perl, Ruby, Python or whatever, except R. Sorry, I forgot to mention it. And I need to read the data from file.txt. Any idea please? – hana Dec 05 '13 at 05:05
  • Then see how to compute the ecdf here http://en.wikipedia.org/wiki/Empirical_distribution_function and @Vigna's answer to plot. Any particular reason no to use R? – Julián Urbano Dec 05 '13 at 05:09
  • I don't want to use R because it is a statistical computing tool. So I want to do it in Java or other programming languages. What should I do? – hana Dec 05 '13 at 07:09
-1

Before committing this, create chart in windows.form

Toolbox --> Data --> Chart, in chart properties create series.

C#:

Namespace:

 using System.Windows.Form;
 using System.IO;
 using System.Data;
 using System.Drawing;
 using System.Windows.Forms.DataVisualization.Charting;
 using System.Drawing.Imaging;

code snippet:

 private void button1_Click(object sender, EventArgs e)
    {
   chart1.Visible = true;
      try
        {
        this.Chart1.Series["Series1"].Points.AddXY(0,2.824562000);
        this.Chart1.Series["Series1"].Points.AddXY(1,7.914959000);
        this.Chart1.Series["Series1"].Points.AddXY(2,15.838087000)
        this.Chart1.Series["Series1"].Points.AddXY(3,1.013451000);
        this.Chart1.Series["Series1"].Points.AddXY(4,2.813006000);
        this.Chart1.Series["Series1"].Points.AddXY(5,0.424052000);
        this.Chart1.Series["Series1"].Points.AddXY(6,0.146252000);
        this.Chart1.Series["Series1"].Points.AddXY(7,0.166075000);
        this.Chart1.Series["Series1"].Points.AddXY(8,2.298860000);
        this.Chart1.Series["Series1"].Points.AddXY(9,6.393684000);
        this.Chart1.Series["Series1"].Points.AddXY(10,5.341003000);
        this.Chart1.Series["Series1"].Points.AddXY(11,0.005898000);
        this.Chart1.Series["Series1"].Points.AddXY(12,0.009670000);
        this.Chart1.Series["Series1"].Points.AddXY(13,0.453621000);
        this.Chart1.Series["Series1"].Points.AddXY(14,0.068486000);
        this.Chart1.Series["Series1"].Points.AddXY(15,0.039053000);
        }
      catch
       {
       }
   }

try this, i hope this help.

Vigna
  • 113
  • 1
  • 5
  • 13
  • Thanks @Vigna. But I want to read the data from a text file because I have a file saved as file.txt. How can i read all the data from file.txt? – hana Dec 05 '13 at 05:20