]> Creatis software - CreaPhase.git/blob - octave_packages/statistics-1.1.3/gamlike.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / statistics-1.1.3 / gamlike.m
1 ## Author: Martijn van Oosterhout <kleptog@svana.org>
2 ## This program is granted to the public domain.
3
4 ## -*- texinfo -*-
5 ## @deftypefn {Function File} {@var{X} =} gamlike ([@var{A} @var{B}], @var{R})
6 ## Calculates the negative log-likelihood function for the Gamma
7 ## distribution over vector @var{R}, with the given parameters @var{A} and @var{B}.
8 ## @seealso{gampdf, gaminv, gamrnd, gamfit}
9 ## @end deftypefn
10
11 function res = gamlike(P,K)
12
13   if (nargin != 2)
14     print_usage;
15   endif
16
17   a=P(1);
18   b=P(2);
19
20   res = -sum( log( gampdf(K, a, b) ) );
21 endfunction