Exemplo n.º 1
0
  void LogitEMC::find_posterior_mode(){
    if(!pri_){
      ostringstream err;
      err << "Logit_EMC cannot find posterior mode.  "
	  << "No prior is set." << endl;
      throw_exception<std::runtime_error>(err.str());
    }

    d2LoglikeTF loglike(this);
    d2LogPostTF logpost(loglike, pri_);
    Vec b = this->beta();
    uint dim = b.size();
    Vec g(dim);
    Mat h(dim,dim);
    b = max_nd2(b, g, h, Target(logpost), dTarget(logpost),
                d2Target(logpost), 1e-5);
    this->set_beta(b);
  }
Exemplo n.º 2
0
  void LogitEMC::find_posterior_mode(){
    if(!pri_){
      ostringstream err;
      err << "Logit_EMC cannot find posterior mode.  "
	  << "No prior is set." << endl;
      report_error(err.str());
    }

    d2LoglikeTF loglike(this);
    d2LogPostTF logpost(loglike, pri_);
    Vector b = this->Beta();
    uint dim = b.size();
    Vector g(dim);
    Matrix h(dim,dim);
    b = max_nd2(b, g, h, Target(logpost), dTarget(logpost),
                d2Target(logpost), 1e-5);
    this->set_Beta(b);
  }