#include <ThetaLogLikelihood.h>
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. |
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.
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 }
Real etirm::ThetaLogLikelihood< II, RI, T >::operator() | ( | const T & | theta | ) | const [inline] |
Overloads function operator to return loglikelihood for a particular value of theta.
T | Type of latent variable. |
[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 }
void etirm::ThetaLogLikelihood< II, RI, T >::SetResponses | ( | RI | resp | ) | [inline] |
Assigns item responses to compute likelihood over.
RI | Type iterator over item responses. |
[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 }
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().
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().
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().
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().