X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fstatistics-1.1.3%2Fgamlike.m;fp=octave_packages%2Fstatistics-1.1.3%2Fgamlike.m;h=708589667e0bf484c562cebeedecd03768f08b4c;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/statistics-1.1.3/gamlike.m b/octave_packages/statistics-1.1.3/gamlike.m new file mode 100644 index 0000000..7085896 --- /dev/null +++ b/octave_packages/statistics-1.1.3/gamlike.m @@ -0,0 +1,21 @@ +## Author: Martijn van Oosterhout +## This program is granted to the public domain. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{X} =} gamlike ([@var{A} @var{B}], @var{R}) +## Calculates the negative log-likelihood function for the Gamma +## distribution over vector @var{R}, with the given parameters @var{A} and @var{B}. +## @seealso{gampdf, gaminv, gamrnd, gamfit} +## @end deftypefn + +function res = gamlike(P,K) + + if (nargin != 2) + print_usage; + endif + + a=P(1); + b=P(2); + + res = -sum( log( gampdf(K, a, b) ) ); +endfunction