view main/statistics/inst/gamlike.m @ 2779:d05f5c23ec22 octave-forge

[for Martijn van Oosterhout] likelihood and distribution for gamma and fit
author pkienzle
date Sat, 02 Dec 2006 21:16:19 +0000
parents
children 0aed6f82a30f
line wrap: on
line source

## -*- texinfo -*-
## @deftypefn {Function File} {} X = gamlike ([@var{A} @var{B}], @var{R})
## Calculates the negative log-likelihood function for the Gamma
## distribution over vector R, with the given parameters A and B.
## @seealso{gampdf, gaminv, gamrnd, gamfit}
## @end deftypefn

## Written by Martijn van Oosterhout <kleptog@svana.org> (Nov 2006)
## This code is public domain

function res = gamlike(P,K)

a=P(1);
b=P(2);

res = -sum( log( gampdf(K, a, b) ) )