Esempio n. 1
0
File: mvn.cpp Progetto: cran/Boom
 double dmvn_zero_mean(const Vector &y, const SpdMatrix &Siginv, double ldsi,
                       bool logscale) {
   const double log2pi = 1.83787706641;
   double n = y.size();
   double ans = 0.5 * (ldsi - Siginv.Mdist(y) - n * log2pi);
   return logscale ? ans : std::exp(ans);
 }
Esempio n. 2
0
  //======================================================================
  double dmvt(const Vector &x,  const Vector &mu, const SpdMatrix &Siginv, double nu,
	      double ldsi, bool logscale){
    long dim = mu.size();
    double nc = lgamma( (nu + dim)/2.0 ) + .5 * ldsi
        - lgamma(nu/2.0) - (.5*dim) * (log(nu) + Constants::log_pi);
    double delta = Siginv.Mdist(x, mu);
    double ans = nc - .5*(nu + dim)*(::log1p(delta/nu));
    return logscale ? ans : exp(ans);
  }
Esempio n. 3
0
 double NeRegSuf::SSE()const{
   SpdMatrix ivar = xtx().inv();
   return yty() - ivar.Mdist(xty()); }