({{, (RefLink[RandomFunction, paclet:ref/RandomFunction])[proc,{(Subscript[t, min]),(Subscript[t, max])}] 
generates a pseudorandom function from the process proc from (Subscript[t, min]) to (Subscript[t, max]). }, {, (RefLink[RandomFunction, paclet:ref/RandomFunction])[proc,{(Subscript[t, min]),(Subscript[t, max]),dt}]
generates a pseudorandom function from (Subscript[t, min]) to (Subscript[t, max]) in steps of dt.}, {, (RefLink[RandomFunction, paclet:ref/RandomFunction])[proc,…, n]
generates an ensemble of n pseudorandom functions. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[RandomFunction, paclet:ref/RandomFunction]) returns a (RefLink[TemporalData, paclet:ref/TemporalData]) object that can be used to extract several properties including the paths consisting of time-value pairs {{(Subscript[t, 1]),x[(Subscript[t, 1])]},…}.

For discrete-time processes such as (RefLink[BinomialProcess, paclet:ref/BinomialProcess]) or (RefLink[ARMAProcess, paclet:ref/ARMAProcess]), the step dt is taken to be 1.

For continuous-time processes with jumps, such as (RefLink[PoissonProcess, paclet:ref/PoissonProcess]) and (RefLink[QueueingProcess, paclet:ref/QueueingProcess]), the step dt is random and given by the process itself.

For continuous-time processes without jumps, such as (RefLink[WienerProcess, paclet:ref/WienerProcess]) and (RefLink[ItoProcess, paclet:ref/ItoProcess]), an explicit dt needs to be given.

(RefLink[RandomFunction, paclet:ref/RandomFunction]) gives a different random function whenever you run the Wolfram Language. You can start with a particular seed, using (RefLink[SeedRandom, paclet:ref/SeedRandom]).

The following options can be given:

With the setting (RefLink[WorkingPrecision, paclet:ref/WorkingPrecision])->p, random numbers of precision p will be generated.

Special settings for (RefLink[Method, paclet:ref/Method]) are documented under the individual random process reference pages.

OpenersPrimaryExamplesSection(Spacer1)Examples  (38)

OpenersExampleSection0(Spacer1)Basic Examples  (5)

Simulate a discrete-time and discrete-state process:

RandomFunction[BinomialProcess[1/3],{0,50}]

ListPlot[%,Filling->Axis]

Simulate a continuous-time and discrete-state process:

RandomFunction[PoissonProcess[1],{0,10}]

ListStepPlot[%,Filling->Axis]

Simulate a discrete-time and continuous-state process:

RandomFunction[ARProcess[{0.7},1],{0,50}]

ListPlot[%,Filling->Axis,AxesOrigin->{0,0}]

Simulate a continuous-time and continuous-state process:

RandomFunction[WienerProcess[],{0,10,0.1}]

ListLinePlot[%,Filling->Axis,AxesOrigin->{0,0}]

Simulate an ensemble of 10 paths:

RandomFunction[WienerProcess[],{0,10,0.1},10]

ListLinePlot[%]

OpenersExampleSection1(Spacer1)Scope  (21)

OpenersExampleSubsection0(Spacer1)Basic Uses  (6)

(RefLink[RandomFunction, paclet:ref/RandomFunction]) returns a (RefLink[TemporalData, paclet:ref/TemporalData]) object:

sample=RandomFunction[PoissonProcess[3.4],{0,7}]

Obtain the random path:

sample["Path"]

Simulate a vector-valued process:

proc=ARProcess[{1,2},{{{.3,.2},{.1,-.3}}},{{.3,0},{0,.2}}];
path=RandomFunction[proc,{40}]

Path up to time 10:

data=TimeSeries[path,ResamplingMethod->Automatic];
data["Part",1,{0,10}]["Path"]

Visualize the path on the plane:

g[t_]=data["PathFunction"][t]

ParametricPlot[g[t],{t,0,40},AxesOrigin->{0,0},ColorFunction->Function[{x,y,t},(ColorData["AvocadoColors"][t])]]

Estimate the parameters for a random process using a sample path:

data=RandomFunction[RandomWalkProcess[.3],{0,10^3}];

FindProcessParameters[data,RandomWalkProcess[p]]

Use a simulation to find the expected path:

data=RandomFunction[OrnsteinUhlenbeckProcess[0,.3,.3,2],{0,10,.5},10^2];

sim=ListLinePlot[data,Joined->True]

Calculate the mean for each time stamp:

mean=TimeSeriesThread[Mean,data];

Show[sim,ListLinePlot[mean,Joined->True,PlotStyle->Directive[Thick,Black]]]

Use a simulation to find confidence bands for a random path:

data=RandomFunction[RenewalProcess[GammaDistribution[2,3]],{0,50},10^2];

sim=ListLinePlot[data,Joined->True]

Calculate the standard error bands for each time stamp:

sd1=TimeSeriesThread[Mean[#]-StandardDeviation[#]&,data];
sd2=TimeSeriesThread[Mean[#]+StandardDeviation[#]&,data];

Show[sim,ListLinePlot[{sd1,sd2},Joined->True,PlotStyle->Directive[Dashed,Black]]]

Simulate an ensemble of 1000 paths:

data=RandomFunction[WienerProcess[1,1/2],{0,10,0.1},10^3];

Compute data slices from paths and plot their distribution shapes:

DistributionChart[Table[data["SliceData",t],{t,1,10}]]

Compute slice distributions at the same time stamps and plot their distribution shapes:

DistributionChart[Table[RandomVariate[WienerProcess[1,1/2][t],10^3],{t,1,10}]]

OpenersExampleSubsection1(Spacer1)Parametric Processes  (3)

Simulate a Bernoulli process:

data=RandomFunction[BernoulliProcess[3/4],{0,30}]

ListPlot[data,Filling->Axis]

Simulate a Wiener process:

data=RandomFunction[WienerProcess[.2,.7],{0,1,0.01}]

ListLinePlot[%,Filling->Axis]

Simulate a compound Poisson process with an exponential jump size distribution:

𝒫=CompoundPoissonProcess[.7,ExponentialDistribution[2.1]];

data=RandomFunction[𝒫,{0,20}];

ListStepPlot[data,Filling->Axis]

OpenersExampleSubsection2(Spacer1)Queueing Processes  (2)

Simulate an M/M/1 queue with different arrival and service rates:

RandomFunction[QueueingProcess[3,5],{0,15}]

ListStepPlot[%,Filling->Axis]

Simulate a closed queueing network:

𝒬=QueueingNetworkProcess[(({{0}, {0}, {0}})),(({{0, 0.3, 0.7}, {1, 0, 0}, {1, 0, 0}})),(({{1}, {0.5}, {1.25}})),(({{1}, {1}, {1}})),10];

RandomFunction[𝒬,{0,50}]

ListStepPlot[%,Filling->Axis]

OpenersExampleSubsection3(Spacer1)Finite Markov Processes  (1)

Simulate a discrete-time finite Markov process:

𝒫=DiscreteMarkovProcess[{1,0,0},(({{0, 1/2, 1/2}, {1/2, 0, 1/2}, {1/2, 1/2, 0}}))];

data=RandomFunction[𝒫,{0,30}]

ListPlot[data,Filling->Axis,Ticks->{Automatic,{1,2,3}}]

Simulate a discrete-time hidden Markov process:

proc=HiddenMarkovProcess[{0.3,0.7},{{0.95,0.05},{0.1,0.9}},{NormalDistribution[-1.1,0.3],NormalDistribution[2.4,0.5]}];

data=RandomFunction[proc,{0,100},100]

Histogram[data,Automatic,"PDF"]

OpenersExampleSubsection4(Spacer1)Time Series Processes  (5)

Simulate a moving-average process:

RandomFunction[MAProcess[{.3},.1],{1,10}]["Path"]

Simulate an autoregressive process:

sample=RandomFunction[ARProcess[{-.2,.3},.1],{1,100}];

ListPlot[sample,Filling->Axis]

Simulate an autoregressive moving-average process with given precision:

RandomFunction[ARMAProcess[{1/10},{-3/10},2/10],{1,6},WorkingPrecision->9]["Path"]

Simulate a few integrated autoregressive moving-average processes:

sample=RandomFunction[ARIMAProcess[{.2,.3},1,{.2,-.1},.1],{1,100},3];

ListPlot[sample,Filling->Axis]

Simulate a vector-valued SARIMA time series:

A={{.4,.3},{-.3,.4}};
B={{.2,.5},{-.2,.3}};
Σ={{1,0},{0,.3}};
SeedRandom[4];sample=RandomFunction[SARIMAProcess[{},1,{B},{12,{A},1,{}},Σ],{1,10^2}];
data=TimeSeries[sample,ResamplingMethod->Automatic];

Create a 3D sample path function with time:

f=data["PathFunction"];
g[t_?NumericQ]:=Join[{t},f[t]]

The color function depends on time:

ParametricPlot3D[g[t],{t,1,100},ColorFunction->Function[{t,x,y},(ColorData["BlueGreenYellow"][t])],PlotStyle->Thick,BoxRatios->1,AspectRatio->1/2]

OpenersExampleSubsection5(Spacer1)Stochastic Differential Equation Processes   (2)

Simulate an Ito process:

𝒫=ItoProcess[\[DifferentialD]x[t]==-x[t]\[DifferentialD]t+\[DifferentialD]w[t],x[t],{x,0},{t,0},w\[Distributed]WienerProcess[]];

RandomFunction[𝒫,{0.,5.,0.01}]

ListLinePlot[%,Filling->Axis]

Simulate a Stratonovich process:

𝒫=StratonovichProcess[\[DifferentialD]x[t]==-x[t]\[DifferentialD]t+(Sqrt[1+x[t]^2])\[DifferentialD]w[t],x[t],{x,1},t,w\[Distributed]WienerProcess[]];

RandomFunction[𝒫,{0.,5.,0.01}]

ListLinePlot[%,Filling->Axis]

OpenersExampleSubsection6(Spacer1)Transformations of Random Processes  (2)

Square of a Poisson process:

𝒫=TransformedProcess[p[t]^2,p\[Distributed]PoissonProcess[1],t];

Simulate the process:

data=RandomFunction[𝒫,{0,30,0.1},3];

ListStepPlot[data]

Sum of a Wiener process and a geometric Brownian motion process:

𝒫=TransformedProcess[w[t]+g[t],{w\[Distributed]WienerProcess[],g\[Distributed]GeometricBrownianMotionProcess[0,1,2]},t];

Simulate the process:

data=RandomFunction[𝒫,{0,10,0.1},3];

ListLinePlot[data,PlotRange->All]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection7(Spacer1)WorkingPrecision  (1)

Generate a sample path with default machine precision:

RandomFunction[PoissonProcess[3],{6}]["Path"]

Use (RefLink[WorkingPrecision, paclet:ref/WorkingPrecision]) to generate a sample path with higher precision:

RandomFunction[PoissonProcess[3],{6},WorkingPrecision->20]["Path"]

OpenersExampleSection3(Spacer1)Applications  (4)

Visualize a transformed process:

Bessel2=TransformedProcess[(Sqrt[((x[t])^2)+((y[t])^2)]),{x\[Distributed]WienerProcess[],y\[Distributed]WienerProcess[]},t];

Simulate the process:

data=RandomFunction[Bessel2,{0,10,0.01},3];

ListLinePlot[data,PlotRange->All]

Simulate solutions of the stochastic differential equation dP=μ P dt+σ P dW:

P[t_,w_]:=p (E^(σ w+(μ-((σ^2)/2)) t))

Define the values of the parameters:

μ=1.2;σ=1/Sqrt[50];p=1;

Simulate the Wiener process paths:

W:=RandomFunction[WienerProcess[],{0,3,0.001}]["Path"];

The solution as function of a path:

noisysol:=Map[{#[[1]],P[#[[1]],#[[2]]]}&, W];

ListLinePlot[Table[noisysol,{4}]]

Estimate unknown slice distribution of a random process:

proc=ARCHProcess[.3,{.5}];

Probability density function of slice distribution is not known in closed form:

PDF[proc[5],x]

Generate a random sample of paths:

data=RandomFunction[proc,{1,5},10^4];

Extract values from all paths at time t==5:

sample=data["SliceData",5];

Visualize its probability density function:

Histogram[sample,Automatic,"PDF"]

Test if it fits a standard normal distribution:

DistributionFitTest[sample,NormalDistribution[0,1],"TestConclusion"]

Approximate an (RefLink[ARIMAProcess, paclet:ref/ARIMAProcess]) with fixed initial conditions by an (RefLink[ARMAProcess, paclet:ref/ARMAProcess]):

proc=ARIMAProcess[{.2,-.3,-.2},1,{.8,-.2,.7},1.,{}];
aproc=ARMAProcess[proc,{2,3}]

Use sample paths to assess the approximation:

SeedRandom[13];sample=RandomFunction[proc,{100}];
SeedRandom[13];asample=RandomFunction[aproc,{100}];
ListLinePlot[{sample,asample}]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

(RefLink[RandomFunction, paclet:ref/RandomFunction]) generates a path for a random process:

𝒫=WienerProcess[3.4,4];

ListLinePlot[RandomFunction[𝒫,{0,20,0.7}]]

Use (RefLink[RandomVariate, paclet:ref/RandomVariate]) to generate a sample for a time slice of the process:

data=RandomVariate[𝒫[3],10^5];

Use (RefLink[Histogram, paclet:ref/Histogram]) to estimate probability density:

Histogram[data,20,"PDF"]

OpenersExampleSection5(Spacer1)Possible Issues  (3)

The length of a step must be smaller than the domain length:

RandomFunction[WienerProcess[],{0,1,2.4}]

Use a step length less than 1 to get a sample path:

RandomFunction[WienerProcess[],{0,1,0.4}]["Path"]

Continuous-time processes require a step to be specified:

RandomFunction[WienerProcess[],{0,1}]

Specify a step:

RandomFunction[WienerProcess[],{0,1,.1}]

%["Path"]

Discrete-time processes do not accept a step specification:

RandomFunction[ARProcess[{.3},1],{0,3,.1}]

Step is 1 by default:

RandomFunction[ARProcess[{.3},1],{0,3}]

%["Path"]

OpenersExampleSection6(Spacer1)Neat Examples  (3)

Simulate a (RefLink[WienerProcess, paclet:ref/WienerProcess]) in two dimensions:

SeedRandom[103];sample=RandomFunction[WienerProcess[],{0,1,.001},2]["ValueList"];

ListLinePlot[Transpose@sample,ColorFunction->"Rainbow"]

Simulate a symmetric random walk in 2D:

SeedRandom[1234];data2d=RandomFunction[RandomWalkProcess[0.5],{0,10^3},2];

Graphics[Line[Transpose@data2d["ValueList"]],AspectRatio->Automatic]

In 3D:

data3d=RandomFunction[RandomWalkProcess[0.5],{0,10^3},3];

Graphics3D[Line[Transpose@data3d["ValueList"]],BoxRatios->Automatic]

Simulate a weakly stationary three-dimensional (RefLink[ARMAProcess, paclet:ref/ARMAProcess]):

A={{.2,.1,.1},{0,-.2,.3},{.2,-.1,.3}};
B={{.1,.2,-.1},{-.1,.3,.1},{.1,.1,0}};
S={{.8,.1,-.2},{.1,.5,.1},{-.2,.1,.3}};
proc1=ARMAProcess[{A},{B},S];
data1=RandomFunction[proc1,{100}]["Values"];

Graphics3D[{Hue[RandomReal[]],Tube@Line@data1}]

Non-weakly stationary process, starting at the origin:

a={{.9,.2,.8},{-.2,.8,-.3},{.2,.2,.4}};
proc2=ARMAProcess[{a},{B},S,{}];
data2=RandomFunction[proc2,{100}]["Values"];

Graphics3D[{Hue[RandomReal[]],Tube@Line@data2}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[RandomVariate, paclet:ref/RandomVariate])  ▪  (RefLink[SliceDistribution, paclet:ref/SliceDistribution])  ▪  (RefLink[StationaryDistribution, paclet:ref/StationaryDistribution])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Random Processes, paclet:guide/RandomProcesses])}, {▪(RefLinkPlain[Stochastic Differential Equation Processes, paclet:guide/StochasticDifferentialEquationProcesses])}, {▪(RefLinkPlain[Time Series Processes, paclet:guide/TimeSeriesProcesses])}, {▪(RefLinkPlain[Probability & Statistics, paclet:guide/ProbabilityAndStatistics])}, {▪(RefLinkPlain[Queueing Processes, paclet:guide/QueueingProcesses])}, {▪(RefLinkPlain[Finite Markov Processes, paclet:guide/MarkovProcesses])}, {▪(RefLinkPlain[Time Series Processing, paclet:guide/TimeSeries])}, {▪(RefLinkPlain[Actuarial Computation, paclet:guide/ActuarialComputation])}, {▪(RefLinkPlain[Scientific Models, paclet:guide/ScientificModels])}})}})