ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
rmvlogistic.cpp
Go to the documentation of this file.
00001 #include "statsLib.h"
00002 
00015 dvector rmvlogistic(const dvector& p, const double& tau2, const int& seed)
00016 {
00017   int a=p.indexmin();
00018   int A=p.indexmax();
00019   random_number_generator rng(seed);
00020   dvector epsilon(a,A);
00021   epsilon.fill_randn(rng);
00022   dvector x = log(p)+tau2*epsilon;
00023   x -= mean(x);
00024   return exp(x)/sum(exp(x));
00025 }