Statistics
| Revision:

root / branches / pthreads-737 / contrib / statslib / rmvlogistic.cpp @ 765

History | View | Annotate | Download (582 Bytes)

1
#include "statsLib.h"
2

    
3
/**
4
* @file rmvlogistic.cpp
5
* @brief Random multivariate logistic negative log likelihood
6
* 
7
* This file contains the Random multivariate logistic negative log likelihood functions
8
* \ingroup STATLIB
9
* @author Chris Grandin, Steve Martell
10
* 
11
* @date 12/13/2011
12
* @remarks
13
*/
14

    
15
dvector rmvlogistic(const dvector& p, const double& tau2, const int& seed)
16
{
17
        int a=p.indexmin();
18
        int A=p.indexmax();
19
        random_number_generator rng(seed);
20
        dvector epsilon(a,A);
21
        epsilon.fill_randn(rng);
22
        dvector x = log(p)+tau2*epsilon;
23
        x -= mean(x);
24
        return exp(x)/sum(exp(x));
25
}