STK++ 1.0
STK::AICCriterion Class Reference

Derived class of Criterion for computing the AIC Criterion The AIC criteria is a penalization of the likelihood given by the formula

\[ -2 \cdot \ln{p(x|k)} \approx \mathrm{AIC} = {-2 \cdot \ln{L} +2 D } \]

where $ L $ represents the likelihood of the observations and $ D $ the number of free parameter of the model. More...

#include <STK_AICCriterion.h>

Inheritance diagram for STK::AICCriterion:
Collaboration diagram for STK::AICCriterion:

List of all members.

Public Member Functions

 AICCriterion (IModel const &model)
 Constructor.
virtual ~AICCriterion ()
 virtual destructor.
virtual bool run ()
 implementation of the virtual method run

Detailed Description

Derived class of Criterion for computing the AIC Criterion The AIC criteria is a penalization of the likelihood given by the formula

\[ -2 \cdot \ln{p(x|k)} \approx \mathrm{AIC} = {-2 \cdot \ln{L} +2 D } \]

where $ L $ represents the likelihood of the observations and $ D $ the number of free parameter of the model.

Definition at line 53 of file STK_AICCriterion.h.


Constructor & Destructor Documentation

STK::AICCriterion::AICCriterion ( IModel const &  model)

Constructor.

Parameters:
modelthe model to evaluate the criterion

Definition at line 43 of file STK_AICCriterion.cpp.

STK::AICCriterion::~AICCriterion ( ) [virtual]

virtual destructor.

Definition at line 50 of file STK_AICCriterion.cpp.

{}

Member Function Documentation

bool STK::AICCriterion::run ( ) [virtual]

implementation of the virtual method run

Implements STK::IRunnerBase.

Definition at line 53 of file STK_AICCriterion.cpp.

References STK::Exception::error(), STK::IModel::logLikelihood(), STK::IRunnerBase::msg_error_, STK::IModel::nbFreeParameter(), STK::ICriterion::p_model_, and STK::ICriterion::value_.

{
  try
  {
    Real loglikelihood    = p_model_->logLikelihood();
    Integer freeParameter = p_model_->nbFreeParameter();
    // AIC criteria
    value_  = 2.*(-loglikelihood+freeParameter);
  }
  catch(const Exception& e)
  {
    msg_error_ = e.error();
    return false;
  }
  return true;
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: