({{, (RefLink[BernoulliProcess, paclet:ref/BernoulliProcess])[p] 
represents a Bernoulli process with event probability p.}})

OpenersNotesSection(Spacer1)Details

(RefLink[BernoulliProcess, paclet:ref/BernoulliProcess]) is a discrete-time and discrete-state process.

(RefLink[BernoulliProcess, paclet:ref/BernoulliProcess]) at a fixed instant of time is a Bernoulli random variate with parameter p.

(RefLink[BernoulliProcess, paclet:ref/BernoulliProcess]) can be used with such functions as (RefLink[Mean, paclet:ref/Mean]),  (RefLink[PDF, paclet:ref/PDF]), (RefLink[Probability, paclet:ref/Probability]), and (RefLink[RandomFunction, paclet:ref/RandomFunction]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (21)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Simulate a Bernoulli process:

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

ListPlot[data,Filling->Axis]

Mean and variance functions:

Mean[BernoulliProcess[p][t]]

Variance[BernoulliProcess[p][t]]

Covariance function:

CovarianceFunction[BernoulliProcess[p],s,t]

DiscretePlot3D[CovarianceFunction[BernoulliProcess[.3],s,t],{s,1,10},{t,1,10},ExtentSize->1/2,ColorFunction->"Rainbow"]

OpenersExampleSection1(Spacer1)Scope  (11)

OpenersExampleSubsection0(Spacer1)Basic Uses  (5)

Simulate an ensemble of paths:

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

ListPlot[data,Filling->Axis,PlotStyle->PointSize[Medium]]

Compare paths for different values of the process parameter:

sample[p_]:=(SeedRandom[3];RandomFunction[BernoulliProcess[p],{0,30}])

pars={.1,.4,.7};

ListPlot[sample[#],Filling->Axis,PlotLabel->StringJoin["p = ",ToString[#]]]&/@pars

Process parameter estimation:

sample=RandomFunction[BernoulliProcess[.3],{0,10^3}];

Estimate the distribution parameter from sample data:

edist=EstimatedProcess[sample, BernoulliProcess[p]]

Correlation function:

CorrelationFunction[BernoulliProcess[p],s,t]

Absolute correlation function:

AbsoluteCorrelationFunction[BernoulliProcess[p],s,t]

OpenersExampleSubsection1(Spacer1)Process Slice Properties  (6)

Univariate (RefLink[SliceDistribution, paclet:ref/SliceDistribution]):

SliceDistribution[BernoulliProcess[p],t]

Univariate slice probability density:

PDF[BernoulliProcess[p][t],x]

Multi-time slice distribution:

SliceDistribution[BernoulliProcess[p],{1,3,7}]

Higher-order (RefLink[PDF, paclet:ref/PDF]):

PDF[BernoulliProcess[p][{1,3,7}],{x,y,z}]

Compute the expectation of an expression:

Expectation[x[t]+x[t]^2,x\[Distributed]BernoulliProcess[p]]

Calculate the probability of an event:

Probability[3x[t]^2+2x[t]<3,x\[Distributed]BernoulliProcess[p]]

Skewness does not depend on time:

Plot[Skewness[BernoulliProcess[p][t]],{p,0,1}]

Skewness[BernoulliProcess[p][t]]

The limiting values:

Limit[Skewness[BernoulliProcess[p][t]],p->0]

Limit[Skewness[BernoulliProcess[p][t]],p->1,Direction->1]

(RefLink[BernoulliProcess, paclet:ref/BernoulliProcess]) is symmetric for p=1/2:

Solve[Skewness[BernoulliProcess[p][t]]==0,p]

Kurtosis does not depend on time:

Plot[Kurtosis[BernoulliProcess[p][t]],{p,0,1}]

Kurtosis[BernoulliProcess[p][t]]

The limiting values:

Limit[Kurtosis[BernoulliProcess[p][t]],p->0]

Limit[Kurtosis[BernoulliProcess[p][t]],p->1,Direction->1]

The minimum value of kurtosis:

FindMinimum[Kurtosis[BernoulliProcess[p][t]]&&0<p<1,{p,1/3}]

Moment of order r:

Moment[BernoulliProcess[p][t],r]

Generating functions:

CharacteristicFunction[BernoulliProcess[p][t],w]

MomentGeneratingFunction[BernoulliProcess[p][t],w]

(RefLink[CentralMoment, paclet:ref/CentralMoment]) and its generating function:

CentralMoment[BernoulliProcess[p][t],r]

CentralMomentGeneratingFunction[BernoulliProcess[p][t],w]

(RefLink[FactorialMoment, paclet:ref/FactorialMoment]) has no closed form for symbolic order:

FactorialMoment[BernoulliProcess[p][t],3]

FactorialMomentGeneratingFunction[BernoulliProcess[p][t],w]

(RefLink[Cumulant, paclet:ref/Cumulant]) and its generating function:

Cumulant[BernoulliProcess[p][t],r]

CumulantGeneratingFunction[BernoulliProcess[p][t],w]

OpenersExampleSection3(Spacer1)Applications  (1)

Generate a sequence of fair coin tosses:

RandomFunction[BernoulliProcess[1/2],{0,20}]["Path"]/.{{x_,0}:>{x,H},{x_,1}:>{x,T}}

OpenersExampleSection4(Spacer1)Properties & Relations  (5)

Bernoulli process is weakly stationary:

WeakStationarity[BernoulliProcess[p]]

Bernoulli process has a well-defined (RefLink[StationaryDistribution, paclet:ref/StationaryDistribution]):

StationaryDistribution[BernoulliProcess[p]]

Transition probability does not depend on the current state:

Probability[(x[t2]==x2)\[Conditioned](x[t1]==x1),x\[Distributed]BernoulliProcess[p]]

A (RefLink[BinomialProcess, paclet:ref/BinomialProcess]) y(k) is the sum of a (RefLink[BernoulliProcess, paclet:ref/BernoulliProcess]) x(k) with y(k)==(∑_(i=0)^k)x(i):

SeedRandom[3];bernoulli=RandomFunction[BernoulliProcess[p=17/32],{20}];

ListPlot[bernoulli,Filling->Axis]

Accumulate the sample:

accumulated=Accumulate[bernoulli]

ListPlot[accumulated,Filling->Axis]

Compare to the (RefLink[BinomialProcess, paclet:ref/BinomialProcess]):

SeedRandom[3];
sample=RandomFunction[BinomialProcess[p],{1,21}];

Align time stamps:

binomial=TimeSeriesShift[sample,-1];

ListPlot[{binomial,accumulated},Filling->Axis,PlotStyle->{PointSize[.05],PointSize[0.02]},PlotLegends->{"binomial","accumulated Bernoulli"}]

Bernoulli process satisfies the law of large numbers:

proc=BernoulliProcess[1/3];

The mean function is constant:

m=Mean[proc[t]]

Find sample mean:

sample=Mean[RandomFunction[proc,{10^7}]["Values"]]

m-%//N

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Simulate paths from a Bernoulli process:

data=RandomFunction[BernoulliProcess[.7],{20},500];

Take a slice at 20 and visualize its distribution:

sd=data["SliceData",20];

cf=ColorData["DarkBands"];
sliced=BarChart[Last[#],Axes->False,BarOrigin->Left,AspectRatio->4,ChartStyle->(cf/@First[#]),ImageSize->40]&[HistogramList[sd,{-0.5,1.5,1}]];

Plot paths and histogram distribution of the slice distribution at 20:

ListStepPlot[data,ImageSize->400,PlotRange->All,
AspectRatio->3/4,Epilog->Inset[sliced,{20.5,.5},{0,1.5}],PlotStyle->(cf/@sd),BaseStyle->Directive[Thin,Opacity[0.5]],PlotRangePadding->{{0,10},{.5,1}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BinomialProcess, paclet:ref/BinomialProcess])  ▪  (RefLink[BernoulliDistribution, paclet:ref/BernoulliDistribution])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Parametric Random Processes, paclet:guide/ParametricRandomProcesses])}})}})