00001 /* 00002 * $Id$ 00003 * 00004 * Author: David Fournier 00005 * Copyright (c) 2008-2012 Regents of the University of California 00006 */ 00011 #include <fvar.hpp> 00012 00017 double randnegbinomial(double mu,double tau, 00018 const random_number_generator& rng) 00019 { 00020 if (tau<=1.0) 00021 { 00022 cerr << "Error in randnegbinomial overdispersion must be >=1" << endl; 00023 ad_exit(1); 00024 } 00025 double r=mu/(tau-1); 00026 double c=r/mu; 00027 double z=sgamma(r,rng); 00028 double lambda=z/c; 00029 return randpoisson(lambda,rng); 00030 }
Generated on Tue Mar 8 2016 19:51:35 for ADMB Documentation by 1.8.0 |