# Generating the cumulative distribution function (CDF) of a tuple made by RandomFunction

I use the RandomFunction to generate a continuous random function (trying to model a rough surface):

r = RandomFunction[WienerProcess[0, 1], {0, 10, 0.01}];
ListLinePlot[r, Filling -> Axis, AxesOrigin -> {0, 0}]


I'm able to plot the histogram by:

Histogram[r, 0.2]


But when I try to make a CDF of the data it is empty:

s = CDF[r, x];
Plot[s, {x, -10, 10}, Filling -> Axis]


I would appreciate if you could help me know what is the problem and how I can solve it.

• Maybe s = CDF[EmpiricalDistribution[r], x]; ? – b.gatessucks Mar 13 '18 at 10:13
• @kglr It seems EmpiricalDistribution immediately deals with the TemporalData in a sensible fashion. – gwr Mar 13 '18 at 10:19
• @b.gatessucks this actually worked fine – Foad Mar 13 '18 at 10:24
• @gwr, right. But, in version 9, you need to use EmpiricalDistribution[r["States][[1]]] – kglr Mar 13 '18 at 10:33

If what you want is a cumulative distribution function then you will have to make your run data a distribution. You may use EmpiricalDistribution or SmoothKernelDistribution:

SeedRandom = ["March 13, 2018"];
r = RandomFunction[WienerProcess[0, 1], {0, 10, 0.01}];

dist = EmpiricalDistribution @ r;
Plot[ Evaluate@CDF[ dist, x], {x, -10, 10},
Filling -> Axis,
PlotRange -> All, PlotPoints -> 1000
]


• I get this error Syntax::sntxf: "SeedRandom=" cannot be followed by "[March 13, 2018]". ! – Foad Mar 13 '18 at 10:20
• I think I did :) I will try again. – Foad Mar 13 '18 at 10:22
• If I may ask a side question? How can I integrate over dist now? e.g. f(x)=int[dist,{u,-5,x}] – Foad Mar 13 '18 at 10:39
• @Foad But, that should be exactly what CDF[ dist, x ] will do. Manually you could integrate using PDF[ dist, x] or you could use Probability. – gwr Mar 13 '18 at 10:56