etirm::ThetaLogLikelihood< II, RI, T > Class Template Reference

Function object for computing loglikelihood for theta parameter of an IRT model. More...

#include <ThetaLogLikelihood.h>

Collaboration diagram for etirm::ThetaLogLikelihood< II, RI, T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ThetaLogLikelihood (II begini, II endi, RI beginr, bool neg=false)
 Constructor - Assigns values of data members.
Real operator() (const T &theta) const
 Overloads function operator to return loglikelihood for a particular value of theta.
void SetResponses (RI resp)
 Assigns item responses to compute likelihood over.

Private Attributes

RI mBeginResp
 Iterator pointing to first item response of each item in mBeginItems to mEndItems range.
II mBeginItems
 Iterator to pointer to first item for likelihood computation.
II mEndItems
 Iterator to pointer to one past last item for likelihood computation.
bool mNeg
 Flag: If true return the negative of the log likelihood.


Detailed Description

template<class II, class RI, class T = Real>
class etirm::ThetaLogLikelihood< II, RI, T >

Function object for computing loglikelihood for theta parameter of an IRT model.

Template Parameters

Parameters:
II Iterator to Item object pointer.
RI Type iterator over item responses.
T Type of latent variable.

Definition at line 48 of file ThetaLogLikelihood.h.


Constructor & Destructor Documentation

template<class II, class RI, class T = Real>
etirm::ThetaLogLikelihood< II, RI, T >::ThetaLogLikelihood ( II  begini,
II  endi,
RI  beginr,
bool  neg = false 
) [inline]

Constructor - Assigns values of data members.

Definition at line 54 of file ThetaLogLikelihood.h.

References etirm::ThetaLogLikelihood< II, RI, T >::mBeginItems, etirm::ThetaLogLikelihood< II, RI, T >::mBeginResp, etirm::ThetaLogLikelihood< II, RI, T >::mEndItems, and etirm::ThetaLogLikelihood< II, RI, T >::mNeg.

00055     {
00056       mBeginItems = begini;
00057       mEndItems = endi;
00058       mBeginResp = beginr;
00059       mNeg = neg;
00060     }


Member Function Documentation

template<class II, class RI, class T>
Real etirm::ThetaLogLikelihood< II, RI, T >::operator() ( const T &  theta  )  const [inline]

Overloads function operator to return loglikelihood for a particular value of theta.

Template Parameters

Parameters:
T Type of latent variable.

Function Parameters

Parameters:
[in] &theta Address of ability parameter theta.

Definition at line 115 of file ThetaLogLikelihood.h.

References etirm::ThetaLogLikelihood< II, RI, T >::mBeginItems, etirm::ThetaLogLikelihood< II, RI, T >::mBeginResp, etirm::ThetaLogLikelihood< II, RI, T >::mEndItems, and etirm::ThetaLogLikelihood< II, RI, T >::mNeg.

00116   {
00117     Real loglikelihood = 0.0;
00118 
00119     for (II ii = mBeginItems; ii != mEndItems; ++ii)
00120     {
00121       RI ir = mBeginResp + (*ii)->Index();
00122       if (*ir != (*ii)->NotPresentedResponse())
00123       {
00124         loglikelihood += std::log((*ii)->ProbResp(*ir, theta));
00125       }
00126     }
00127 
00128     // return negative of loglikelihood to allow use of
00129     // minimization routine rather than maximization routine
00130     return (mNeg ? -loglikelihood : loglikelihood);
00131   }

template<class II, class RI, class T = Real>
void etirm::ThetaLogLikelihood< II, RI, T >::SetResponses ( RI  resp  )  [inline]

Assigns item responses to compute likelihood over.

Template Parameters

Parameters:
RI Type iterator over item responses.

Function Parameters

Parameters:
[in] resp Iterator pointing to first item response of each item in mBeginItems to mEndItems range.

Definition at line 89 of file ThetaLogLikelihood.h.

References etirm::ThetaLogLikelihood< II, RI, T >::mBeginResp.

00090     {
00091       mBeginResp = resp;
00092     }


Member Data Documentation

template<class II, class RI, class T = Real>
RI etirm::ThetaLogLikelihood< II, RI, T >::mBeginResp [private]

Iterator pointing to first item response of each item in mBeginItems to mEndItems range.

Definition at line 97 of file ThetaLogLikelihood.h.

Referenced by etirm::ThetaLogLikelihood< II, RI, T >::operator()(), etirm::ThetaLogLikelihood< II, RI, T >::SetResponses(), and etirm::ThetaLogLikelihood< II, RI, T >::ThetaLogLikelihood().

template<class II, class RI, class T = Real>
II etirm::ThetaLogLikelihood< II, RI, T >::mBeginItems [private]

Iterator to pointer to first item for likelihood computation.

Definition at line 100 of file ThetaLogLikelihood.h.

Referenced by etirm::ThetaLogLikelihood< II, RI, T >::operator()(), and etirm::ThetaLogLikelihood< II, RI, T >::ThetaLogLikelihood().

template<class II, class RI, class T = Real>
II etirm::ThetaLogLikelihood< II, RI, T >::mEndItems [private]

Iterator to pointer to one past last item for likelihood computation.

Definition at line 103 of file ThetaLogLikelihood.h.

Referenced by etirm::ThetaLogLikelihood< II, RI, T >::operator()(), and etirm::ThetaLogLikelihood< II, RI, T >::ThetaLogLikelihood().

template<class II, class RI, class T = Real>
bool etirm::ThetaLogLikelihood< II, RI, T >::mNeg [private]

Flag: If true return the negative of the log likelihood.

This allows the use of minimization routines rather than maximization routines for computing maximum likelihood estimates.

Definition at line 112 of file ThetaLogLikelihood.h.

Referenced by etirm::ThetaLogLikelihood< II, RI, T >::operator()(), and etirm::ThetaLogLikelihood< II, RI, T >::ThetaLogLikelihood().


The documentation for this class was generated from the following file:
Generated on Sat Mar 1 21:42:03 2008 for ETIRM by  doxygen 1.5.4