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

OpenersNotesSection(Spacer1)Details

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

(RefLink[BinomialProcess, paclet:ref/BinomialProcess]) at time n is the number of events in the interval 0 to n.

The number of events in the interval 0 to n follows (RefLink[BinomialDistribution, paclet:ref/BinomialDistribution])[n,p].

The times between events are independent and follow (RefLink[GeometricDistribution, paclet:ref/GeometricDistribution])[p].

(RefLink[BinomialProcess, paclet:ref/BinomialProcess]) 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  (24)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Simulate a binomial process:

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

ListPlot[data,Filling->Axis]

Mean and variance functions:

Mean[BinomialProcess[p][t]]

Variance[BinomialProcess[p][t]]

Covariance function:

CovarianceFunction[BinomialProcess[p],s,t]

DiscretePlot3D[CovarianceFunction[BinomialProcess[.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[BinomialProcess[0.4],{0,50},4]

ListPlot[data,Filling->Axis]

Compare paths for different values of process parameter:

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

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

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

Process parameter estimation:

sample=RandomFunction[BinomialProcess[.3],{1,10^3}];

Estimate the distribution parameter from sample data:

edist=EstimatedProcess[sample, BinomialProcess[p]]

Correlation function:

CorrelationFunction[BinomialProcess[p],s,t]

Absolute correlation function:

AbsoluteCorrelationFunction[BinomialProcess[p],s,t]

OpenersExampleSubsection1(Spacer1)Process Slice Properties  (6)

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

DiscretePlot[Evaluate@Table[PDF[BinomialProcess[.8][t],x],{t,times={5,7,12}}],{x,0,15},PlotStyle->PointSize[Medium],PlotLegends->(StringJoin["t = ",ToString[#]]&/@times)]

SliceDistribution[BinomialProcess[p],t]

Univariate probability density:

PDF[BinomialProcess[p][t],x]

Compare to the probability density of (RefLink[BinomialDistribution, paclet:ref/BinomialDistribution]):

PDF[BinomialDistribution[t,p],x]

%-%%

Multi-time slice distribution:

SliceDistribution[BinomialProcess[p],{1,3,7}]//Mean

High-order probability density function:

PDF[BinomialProcess[.3][{1,3,7}],{x,y,z}]

Compute the expectation of an expression:

Expectation[x[t]^2+x[t],x\[Distributed]BinomialProcess[p]]//PiecewiseExpand

Calculate the probability of an event:

Probability[x[t]>8,x\[Distributed]BinomialProcess[p]]

Skewness:

DiscretePlot[Evaluate@Table[Skewness[BinomialProcess[p][t]],{p,pars={.1,.3,.5,.7}}],{t,1,8},PlotLegends->(StringJoin["p = ",ToString[#]]&/@pars)]

Skewness[BinomialProcess[p][t]]

The limiting values:

Limit[Skewness[BinomialProcess[p][t]],t->∞,Assumptions->1>p>0]

Limit[Skewness[BinomialProcess[p][t]],t->0,Assumptions->1>p>0,Direction->"FromAbove"]

Find for what values of the parameter (RefLink[BinomialProcess, paclet:ref/BinomialProcess]) is symmetric:

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

Kurtosis:

DiscretePlot[Evaluate@Table[Kurtosis[BinomialProcess[p][t]],{p,pars={.1,.2,.5,.7}}],{t,1,8},PlotLegends->(StringJoin["p = ",ToString[#]]&/@pars)]

Kurtosis[BinomialProcess[p][t]]

The limiting values:

Limit[Kurtosis[BinomialProcess[p][t]],t->∞,Assumptions->1>p>0]

Limit[Kurtosis[BinomialProcess[p][t]],t->0,Assumptions->1>p>0,Direction->"FromAbove"]

Find for what values of the parameter (RefLink[BinomialProcess, paclet:ref/BinomialProcess]) is mesokurtic:

Solve[Kurtosis[BinomialProcess[p][t]]==3,p]

N[%]

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

Moment[BinomialProcess[p][t],4]

Generating functions:

CharacteristicFunction[BinomialProcess[p][t],w]

MomentGeneratingFunction[BinomialProcess[p][t],w]

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

CentralMoment[BinomialProcess[p][t],3]

CentralMomentGeneratingFunction[BinomialProcess[p][t],w]

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

FactorialMoment[BinomialProcess[p][t],r]

FactorialMomentGeneratingFunction[BinomialProcess[p][t],w]

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

Cumulant[BinomialProcess[p][t],7]

CumulantGeneratingFunction[BinomialProcess[p][t],w]

OpenersExampleSection3(Spacer1)Applications  (4)

A quality assurance inspector randomly selects a series of 10 parts from a manufacturing process that is known to produce 20% bad parts. Find the probability that the inspector gets at most one bad part:

selectionProcess=BinomialProcess[0.2];

The probability of selecting at most one bad part:

NProbability[x[10]≤1,x\[Distributed]selectionProcess]

It is known that, on average, 50% of the residents in a city like a certain TV program. Find the probability that at least 55% of residents will report that they like a program, in a survey of 804 people from the city:

programPopularity=BinomialProcess[0.5];

The probability that at least 55% of the residents in the sample will like the program:

n=804;
Probability[x[n]/n≥0.55,x\[Distributed]programPopularity]

A packet consisting of a string of n symbols is transmitted over a noisy channel. Each symbol has a probability 0.0001 of being transmitted in error. Find the largest n for which the probability of incorrect transmission (at least one symbol in error) is less than 0.001:

transmissionProcess=BinomialProcess[1/10000];

The probability of an error in the transmission:

prob[n_]=Probability[x>0,x\[Distributed]transmissionProcess[n]]

Plot probability of a transmission error together with error limit:

errlimit=1/1000;
ListLogPlot[Transpose@Table[{prob[n],errlimit},{n,0,15}],Joined->True,PlotLegends->{"probability","error limit"}]

Find the largest n for which the probability of incorrect transmission is less than (10^(-3)):

Maximize[{n,prob[n]≤errlimit&&n∈Integers&&5≤n≤15},n]

Find the price of a European call option after the third period in a multi-period binomial model, given that the initial price of the underlying is $100, strike price is $102, interest rate is 1% per period, and the stock moves up by 7% or down by a factor of 1/1.07:

s0=100;
strike=102;
rate=1.01;
up=1.07;
down=1/1.07;
T=3;

Model the process:

price=BinomialProcess[(rate-down)/(up-down)];

Price of the call option:

Expectation[1/rate^T Max[s0 up^proc[T] down^(T-proc[T])-strike,0],proc\[Distributed]price]

OpenersExampleSection4(Spacer1)Properties & Relations  (5)

Binomial process is weakly stationary only for p equal to 0:

WeakStationarity[BinomialProcess[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 binomial process:

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"}]

The time between events in a binomial process follows a (RefLink[PascalDistribution, paclet:ref/PascalDistribution]):

binomial=RandomFunction[BinomialProcess[1/3],{10^4}];

Calculate times between changes:

times=Length/@Split[binomial["Values"]];

h=Histogram[times,{Min[times]-0.5,Max[times]+0.5,1},"PDF"]

Fit a Pascal distribution:

edist=EstimatedDistribution[times,PascalDistribution[1,p]]

Compare the data histogram to the estimated probability density function:

Show[h,DiscretePlot[PDF[edist,x],{x,0,Max[times]},PlotStyle->PointSize[Medium]]]

Check goodness of fit:

DistributionFitTest[times,edist,"TestConclusion"]

Transition probability between two states:

Table[DiscretePlot[Probability[(x[12]==(Subscript[x, 2]))\[Conditioned](x[7]==(Subscript[x, 1])),x\[Distributed]BinomialProcess[.6]],{(Subscript[x, 2]),0,13},ExtentSize->1/2,PlotLabel->StringJoin["(Subscript[x, 1]) = ",ToString[(Subscript[x, 1])]]],{(Subscript[x, 1]),{1,3,5,7}}]

Probability[(x[(Subscript[t, 2])]==(Subscript[x, 2]))\[Conditioned](x[(Subscript[t, 1])]==(Subscript[x, 1])),x\[Distributed]BinomialProcess[p],Assumptions->0<(Subscript[t, 1])<(Subscript[t, 2])&&0≤(Subscript[x, 1])≤(Subscript[t, 1])&&0≤(Subscript[x, 2])≤(Subscript[t, 2])]//Simplify

(RefLink[BinomialProcess, paclet:ref/BinomialProcess]) is a special case of (RefLink[CompoundRenewalProcess, paclet:ref/CompoundRenewalProcess]):

proc=CompoundRenewalProcess[PascalDistribution[1,p],BernoulliDistribution[1]];

The mean functions agree:

proc[t]//Mean

Mean[BinomialProcess[p][t]]

Create empirical covariance functions:

sample1=RandomFunction[proc/.p->.3,{30},10^3];

cov1[s_,t_]:=Covariance[sample1["SliceData",s],sample1["SliceData",t]]

sample2=RandomFunction[BinomialProcess[.3],{0,30},10^3];

cov2[s_,t_]:=Covariance[sample2["SliceData",s],sample2["SliceData",t]]

Compare the covariance functions:

DiscretePlot3D[#[s,t],{s,1,15},{t,1,15},ExtentSize->1/2,ColorFunction->"Rainbow",PlotRange->{0,4}]&/@{cov1,cov2}

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Simulate 500 paths from a binomial process:

data=RandomFunction[BinomialProcess[.7],{50},500];

Take a slice at 50 and visualize its distribution:

sd=data["SliceData",50];

cf=ColorData["Rainbow"];
sliced=BarChart[Last[#],Axes->False,BarOrigin->Left,AspectRatio->4,ChartStyle->(cf/@Rescale[MovingAverage[First[#],2],{Min[sd],Max[sd]},{0,1}]),ImageSize->30]&[HistogramList[sd,{Range[Min[sd],Max[sd],(Max[sd]-Min[sd])/15]}]];

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

ListLinePlot[data,ImageSize->400,PlotRange->All,
AspectRatio->3/4,Epilog->Inset[sliced,{50.5,Mean[sd]},{0,7.5}],PlotStyle->(cf/@Rescale[sd]),BaseStyle->Directive[Thin,Opacity[0.5]],PlotRangePadding->{{0,20},{.5,7}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[PoissonProcess, paclet:ref/PoissonProcess])  ▪  (RefLink[BernoulliProcess, paclet:ref/BernoulliProcess])  ▪  (RefLink[BinomialDistribution, paclet:ref/BinomialDistribution])  ▪  (RefLink[GeometricDistribution, paclet:ref/GeometricDistribution])}})}})

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