Why does my binomial distribution not sum to one?

6 views (last 30 days)
function [res]=Pbar_ho(phi,X0,sigma,X,r,t,o,x,l,N)
%o is number of jumps
%x is the conditioned diffusion correlation
alpha=X(1);
sigmapi=X(2);
mupi=X(3);
lambda=X(4);
nu=exp(mupi+sigmapi.^2/2)-1;
mui=log(X0)+(r-sigma.^2/2-lambda*nu+phi)*t+o.*mupi+sigma.*sqrt(alpha).*x;
sigmai=(1-alpha).*sigma.^2.*t+o.*sigmapi.^2;
p=normcdf(-mui./sigmai);
res=factorial(N)./(factorial(l).*factorial(N-l)).*(p.^l).*(1-p).^(N-l);
end
I am trying to model a conditional portfolio loss distribution for a portfolio with homogenous assets. Above we have conditioned on a browninan motion B_t=x and jump Y_t=o.
My question is, why does 'res' not sum to one for l=1:N? Is it not the binomial distribution?

Accepted Answer

John D'Errico
John D'Errico on 28 Jul 2017
I would have thought that particular sum would start at 0, thus 0:N. Just a wild guess though. :)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!