Skip to content

Commit aed2d7e

Browse files
author
compops
committed
changed to Poisson IID data
Former-commit-id: e5d8ec1
1 parent 7afd571 commit aed2d7e

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

matlab-seminar/complete/dpoisson.m

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
%
3+
% Computes the log-PDF of Poisson distribution
4+
%
5+
% Inputs:
6+
% x: Obserations
7+
% par: Parameters of the PDF (location, scale and shape)
8+
%
9+
% Outputs:
10+
% out: Logarithm of the PDF evaluated at each x.
11+
%
12+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13+
14+
function[out] = poisson(x, par)
15+
part1 = -log( factorial( x ) );
16+
part2 = x * log( par );
17+
part3 = -par;
18+
out = part1 + part2 + part3;
19+
end
20+
21+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22+
% End of file
23+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0 commit comments

Comments
 (0)