ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
cinvcumdt.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <admodel.h>
00012 
00017 double inv_cumd_t(double n,double u,double eps)
00018 {
00019   double v,sgn;
00020   if (u<0.5)
00021   {
00022     v=2.0*u;
00023     sgn=-1.0;
00024   }
00025   else
00026   {
00027     v=2.0*(1.0-u);
00028     sgn=1.0;
00029   }
00030   double w=inv_cumd_beta_stable(0.5*n,0.5,v,eps);
00031   return sgn*sqrt(n*(1.0/w-1.0));
00032 }