#include <EStepDiscrete.h>
Public Types | |
typedef RealMatrix::row_iterator | ngroup_iterator |
Type of iterator over marginal group probabilities. | |
typedef D::point_iterator | point_iterator |
Type of iterator over points of latent variable distribution. | |
Public Member Functions | |
EStepDiscrete (II bitem, II eitem, D &dist) | |
Constructor. | |
~EStepDiscrete () | |
template<class EI> | |
Real | DoEStep (EI examinees_begin, EI examinees_end, II itemsNR_begin, II itemsNR_end, bool computeExamineePosterior, bool storeExamineePosterior) |
Computes the E-step of the EM algorithm for IRT models with a discrete latent variable distribution. | |
template<class EI> | |
Real | DoEStep (EI examinees_begin, EI examinees_end, bool computeExamineePosterior, bool storeExamineePosterior) |
Version of DoEStep in which the items that are used to compute the posterior distributions for examinees are also the items for which n and r are updated, i.e., itemsNR_begin == items_begin and itemsNR_end == items_end. | |
template<class PI> | |
Real | ExamineePosterior (E &examinee, PI begin_posterior, PI end_posterior) |
Computes posterior distribution of discrete latent variable for an examinee. Returns marginal likelihood of the examinee's responses. | |
void | CalcResponseProb () |
Calculates matrices of response probabilities used in DoEStep. | |
ngroup_iterator | GetNGroup (int group) |
Returns iterator to latent variable distribution for a group. | |
int | size () |
Returns number of categories in discrete latent variable distribution. | |
point_iterator | GetPoints () |
Returns Iterator to points of latent variable distribution. | |
Protected Attributes | |
RealMatrix * | nGroups |
std::vector< NMatrixVec< II > * > | mRespProb |
II | items_begin |
Iterator to first item. | |
II | items_end |
Iterator to one past last item. | |
D & | latentvar_dist |
Object containing discrete latent variable distribution. | |
RealMatrix | logLatentProb |
int | numItems |
number of items. | |
int | numLatentVarCat |
number of categories in discrete latent variable distribution. | |
int | numGroupUnique |
Number of groups with unique latent distribution points. | |
std::vector< int > * | itemIndices |
Response | notPresentedResponse |
E | Examinee type. | |
I | Item type. | |
II | Iterator over item objects. | |
D | Class for discrete latent variable distribution. |
Definition at line 147 of file EStepDiscrete.h.
typedef RealMatrix::row_iterator etirm::EStepDiscrete< E, I, II, D >::ngroup_iterator |
typedef D::point_iterator etirm::EStepDiscrete< E, I, II, D >::point_iterator |
Type of iterator over points of latent variable distribution.
Definition at line 156 of file EStepDiscrete.h.
etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete | ( | II | bitem, | |
II | eitem, | |||
D & | dist | |||
) | [inline] |
Constructor.
Class template to perform E-step calculation and store results for IRT model with a discrete latent variable distribution.
E | Examinee type. | |
I | Item type. | |
II | Iterator over item objects. | |
D | Class for discrete latent variable distribution. |
[in] | bitem | Iterator pointing to first item. |
[in] | eitem | Iterator pointing to one past last item. |
[in] | &dist | Address of latent variable distribution object. |
Definition at line 711 of file EStepDiscrete.h.
References etirm::EStepDiscrete< E, I, II, D >::itemIndices, etirm::EStepDiscrete< E, I, II, D >::items_begin, etirm::EStepDiscrete< E, I, II, D >::items_end, etirm::EStepDiscrete< E, I, II, D >::latentvar_dist, etirm::EStepDiscrete< E, I, II, D >::logLatentProb, etirm::logZero, etirm::EStepDiscrete< E, I, II, D >::mRespProb, etirm::EStepDiscrete< E, I, II, D >::nGroups, etirm::EStepDiscrete< E, I, II, D >::notPresentedResponse, etirm::EStepDiscrete< E, I, II, D >::numGroupUnique, etirm::EStepDiscrete< E, I, II, D >::numItems, and etirm::EStepDiscrete< E, I, II, D >::numLatentVarCat.
00711 : 00712 items_begin(bitem), items_end(eitem), latentvar_dist(dist), nGroups(0), 00713 logLatentProb( dist.NumGroups(), dist.size()), 00714 mRespProb(dist.NumGroupsUnique()) 00715 { 00716 int i; 00717 numItems = items_end - items_begin; 00718 numLatentVarCat = dist.size(); 00719 numGroupUnique = dist.NumGroupsUnique(); 00720 00721 notPresentedResponse = I::NotPresentedResponse(); 00722 00723 nGroups = new RealMatrix(dist.NumGroups(), numLatentVarCat); 00724 00725 for (i=0; i<numGroupUnique; ++i) 00726 { 00727 mRespProb[i] = new NMatrixVec<II>(bitem, eitem, dist.size()); 00728 } 00729 00730 /* Store indices of items in examinee response vector */ 00731 II iitem = items_begin; 00732 itemIndices = new std::vector<int>(numItems); 00733 std::vector<int>::iterator ii = itemIndices->begin(); 00734 for (i=numItems; i--; ++ii, ++iitem) 00735 { 00736 *ii = (*iitem)->Index(); 00737 } 00738 00739 /* Initialize logLatentProb to log of probabilities in latentvar_dist */ 00740 for (i = 1; i <= latentvar_dist.NumGroups(); ++i) 00741 { 00742 RealMatrix::row_iterator ip = logLatentProb.begin_row(i); 00743 typename D::weight_iterator iwt = latentvar_dist.begin_weights(i); 00744 for (int j = numLatentVarCat; j--; ++ip, ++iwt) 00745 { 00746 *ip = (*iwt != 0.0) ? std::log(*iwt) : logZero; 00747 } 00748 } 00749 }
etirm::EStepDiscrete< E, I, II, D >::~EStepDiscrete | ( | ) | [inline] |
Destructor
Definition at line 752 of file EStepDiscrete.h.
References etirm::EStepDiscrete< E, I, II, D >::itemIndices, etirm::EStepDiscrete< E, I, II, D >::mRespProb, etirm::EStepDiscrete< E, I, II, D >::nGroups, and etirm::EStepDiscrete< E, I, II, D >::numGroupUnique.
00753 { 00754 delete nGroups; 00755 00756 delete itemIndices; 00757 00758 for (int i = 0; i<numGroupUnique; ++i) 00759 delete mRespProb[i]; 00760 }
Real etirm::EStepDiscrete< E, I, II, D >::DoEStep | ( | EI | examinees_begin, | |
EI | examinees_end, | |||
II | itemsNR_begin, | |||
II | itemsNR_end, | |||
bool | computeExamineePosterior, | |||
bool | storeExamineePosterior | |||
) | [inline] |
Computes the E-step of the EM algorithm for IRT models with a discrete latent variable distribution.
Computes the E-step of the EM algorithm for IRT models with a discrete latent variable distribution.
Returns marginal loglikelihood of examinees' responses (sum over examinees of the marginal loglikelihood of an examinee's responses) plus sum of prior likelihoods over all item parameters. This is the value of the marginal posterior density that the EM algorithm is maximizing at the values of the item parameters computed in the last M-step. The log of the priors for the item parameters are added to this value for the items for which n and r are calculated.
Results of the E-step are stored in data member nGroups. The posterior distributions for examinees are stored in the examinee objects if storeExamineePosterior is true, and updated n's and r's are computed the items given by itemsNR_begin and itemsNR_end.
A duplicate of this definition is given inside the class definition for use when BOOST_MSVC6_MEMBER_TEMPLATES is defined.
D | Class for discrete latent variable distribution. | |
E | Examinee type. | |
EI | Iterator over pointers to examinee objects. | |
I | Item type. | |
II | Iterator over item objects. |
[in] | examinees_begin | Iterator to pointer to first examinee |
[in] | examinees_end | Iterator to pointer to one past last examinee |
[in] | itemsNR_begin | Iterator to first item pointer for which n and r will be updated. The items for which n and r are updated can be different from the items used to compute the posterior distribution of the latent variable for each examinee. If itemsNR_end - itemsNR_begin == 0 then n and r are not updated for any items. |
[in] | itemsNR_end | Iterator to one past last item pointer for which n and r will be updated. |
[in] | computeExamineePosterior | If TRUE posterior latent variable distribution for each examinee is computed. If FALSE previously stored posterior latent variable distribution for each examinee is used. |
[in] | storeExamineePosterior | If TRUE posterior latent variable distribution is stored for each examinee. If 'computeExamineePosterior' is FALSE the value of the argument is not used (in that case a previously stored posterior distribution for each examinee is being used in this function). |
Results of the E-step are stored in data member nGroups. The posterior distributions for examinees are stored in the examinee objects if storeExamineePosterior is true, and updated n's and r's are computed the items given by itemsNR_begin and itemsNR_end.
A duplicate of this definition is given inside the class definition for use when BOOST_MSVC6_MEMBER_TEMPLATES is defined.
D | Class for discrete latent variable distribution. | |
E | Examinee type. | |
EI | Iterator over pointers to examinee objects. | |
I | Item type. | |
II | Iterator over item objects. |
[in] | examinees_begin | Iterator to pointer to first examinee |
[in] | examinees_end | Iterator to pointer to one past last examinee |
[in] | itemsNR_begin | Iterator to first item pointer for which n and r will be updated. The items for which n and r are updated can be different from the items used to compute the posterior distribution of the latent variable for each examinee. If itemsNR_end - itemsNR_begin == 0 then n and r are not updated for any items. |
[in] | itemsNR_end | Iterator to one past last item pointer for which n and r will be updated. |
[in] | computeExamineePosterior | If TRUE posterior latent variable distribution for each examinee is computed. If FALSE previously stored posterior latent variable distribution for each examinee is used. |
[in] | storeExamineePosterior | If TRUE posterior latent variable distribution is stored for each examinee. If 'computeExamineePosterior' is FALSE the value of the argument is not used (in that case a previously stored posterior distribution for each examinee is being used in this function). |
Definition at line 964 of file EStepDiscrete.h.
References etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior(), etirm::EStepDiscrete< E, I, II, D >::latentvar_dist, etirm::EStepDiscrete< E, I, II, D >::logLatentProb, etirm::logZero, etirm::EStepDiscrete< E, I, II, D >::nGroups, etirm::EStepDiscrete< E, I, II, D >::notPresentedResponse, and etirm::EStepDiscrete< E, I, II, D >::numLatentVarCat.
Referenced by etirm::estep::compute(), and etirm::EStepDiscrete< E, I, II, D >::DoEStep().
00967 { 00968 int i, j; 00969 Real loglikelihood = 0.0; 00970 00971 RealVector posterior(numLatentVarCat); 00972 00973 *nGroups = 0.0; 00974 int numItemsNR = itemsNR_end - itemsNR_begin; 00975 II iitem = itemsNR_begin; 00976 for (i=numItemsNR; i--; ++iitem) 00977 { 00978 /* Check that n and r for each item use the same number of latent variable 00979 categories as in latent variable distribution used to compute 00980 examinee posterior distributions (does not check that points match, 00981 just that number of points match, it is assumed 00982 that points also match). 00983 */ 00984 j = (*iitem)->NumLatentVarCat(); 00985 if (j != numLatentVarCat) 00986 { 00987 throw RuntimeError("Mismatch in number of latent variable categories", 00988 "EStepDiscrete::DoEStep"); 00989 } 00990 00991 /* Initialize n and r for item to zero */ 00992 (*iitem)->InitializeNR(); 00993 } 00994 00995 if (computeExamineePosterior) 00996 { 00997 // Check that number of latent variable categories for latentvar_dist 00998 // has not changed. 00999 if (numLatentVarCat != latentvar_dist.size()) 01000 { 01001 throw RuntimeError("Number of latent variable categories has changed", 01002 "EStepDiscrete::DoEStep"); 01003 } 01004 01005 // Compute log probabilities of each response to each item using 01006 // current item parameter estimates 01007 CalcResponseProb(); 01008 01009 /* Set logLatentProb to log of current probabilities of latentvar_dist */ 01010 for (i = 1; i <= latentvar_dist.NumGroups(); ++i) 01011 { 01012 RealMatrix::row_iterator ip = logLatentProb.begin_row(i); 01013 typename D::weight_iterator iwt = latentvar_dist.begin_weights(i); 01014 for (j = numLatentVarCat; j--; ++ip, ++iwt) 01015 { 01016 *ip = (*iwt != 0.0) ? std::log(*iwt) : logZero; 01017 } 01018 } 01019 } 01020 01021 /* For each examinee compute posterior distribution and 01022 update n and r for items the examinee responded to. 01023 */ 01024 for (EI examinee_i = examinees_begin; examinee_i != examinees_end; ++examinee_i) 01025 { 01026 01027 Real marginalLikelihood; 01028 if (computeExamineePosterior) // Compute posterior distribution for examinee 01029 01030 { 01031 marginalLikelihood = ExamineePosterior(**examinee_i, posterior.begin(), posterior.end()); 01032 01033 if (storeExamineePosterior) 01034 { 01035 typename E::posterior_vector epost(numLatentVarCat); 01036 typename E::posterior_vector::iterator iep = epost.begin(); 01037 RealVector::iterator ip = posterior.begin(); 01038 for (i = numLatentVarCat; i--; ++iep, ++ip) 01039 *iep = *ip; 01040 (*examinee_i)->SetPosterior(epost); 01041 01042 (*examinee_i)->SetMarginalRespLikelihood(marginalLikelihood); 01043 } 01044 } 01045 else // use examinee posterior distribution already computed 01046 01047 { 01048 typename E::posterior_vector::iterator iep = (*examinee_i)->posterior_begin(); 01049 RealVector::iterator ip = posterior.begin(); 01050 for (i = numLatentVarCat; i--; ++iep, ++ip) 01051 *ip = *iep; 01052 01053 marginalLikelihood = (*examinee_i)->GetMarginalRespLikelihood(); 01054 } 01055 01056 /* update marginal loglikelihood */ 01057 loglikelihood += std::log(marginalLikelihood); 01058 01059 typename E::response_iterator iresp = (*examinee_i)->responses_begin(); 01060 Real casewt = (*examinee_i)->Count(); 01061 int group = (*examinee_i)->Group(); 01062 iitem = itemsNR_begin; 01063 for (i = numItemsNR; i--; ++iitem) 01064 { 01065 /* Update n and r for each item */ 01066 Response resp = iresp[(*iitem)->Index()]; 01067 if (resp != notPresentedResponse) 01068 { 01069 typename I::r_iterator ir = (*iitem)->RVector(resp, group); 01070 typename I::n_iterator in = (*iitem)->NVector(group); 01071 RealVector::iterator ipost = posterior.begin(); 01072 for (j = numLatentVarCat; j--; ++ir, ++in, ++ipost) 01073 { 01074 *ir += *ipost * casewt; 01075 *in += *ipost * casewt; 01076 } 01077 } 01078 01079 } 01080 01081 /* Update marginal distribution for group examinee belongs to */ 01082 RealVector::iterator ipost = posterior.begin(); 01083 RealMatrix::row_iterator igroup = nGroups->begin_row(group); 01084 for (j = numLatentVarCat; j--; ++ipost, ++igroup) 01085 { 01086 *igroup += *ipost * casewt; 01087 } 01088 01089 } 01090 01091 /* Add log of prior densities of item parameter estimates to loglikelihood */ 01092 for (II ii = itemsNR_begin; ii != itemsNR_end; ++ii) 01093 { 01094 PriorVector::iterator iprior = (*ii)->PriorsIterator(); 01095 RealVector::iterator iparam = (*ii)->ParametersIterator(); 01096 for (i = (*ii)->NumParameters(); i--; ++iprior, ++iparam) 01097 { 01098 if (*iprior) 01099 loglikelihood += (*iprior)->LogDensity(*iparam); 01100 } 01101 } 01102 01103 return loglikelihood; 01104 01105 }
Real etirm::EStepDiscrete< E, I, II, D >::DoEStep | ( | EI | examinees_begin, | |
EI | examinees_end, | |||
bool | computeExamineePosterior, | |||
bool | storeExamineePosterior | |||
) | [inline] |
Version of DoEStep in which the items that are used to compute the posterior distributions for examinees are also the items for which n and r are updated, i.e., itemsNR_begin == items_begin and itemsNR_end == items_end.
Version of DoEStep in which the items that are used to compute the posterior distributions for examinees are also the items for which n and r are updated, i.e., itemsNR_begin == items_begin and itemsNR_end == items_end.
A duplicate of this definition is given inside the class definition for use when BOOST_MSVC6_MEMBER_TEMPLATES is defined.
D | Class for discrete latent variable distribution. | |
E | Examinee type. | |
EI | Iterator over pointers to examinee objects. | |
I | Item type. | |
II | Iterator over item objects. |
[in] | examinees_begin | Iterator to pointer to first examinee |
[in] | examinees_end | Iterator to pointer to one past last examinee |
[in] | computeExamineePosterior | If TRUE posterior latent variable distribution for each examinee is computed. If FALSE previously stored posterior latent variable distribution for each examinee is used. |
[in] | storeExamineePosterior | If TRUE posterior latent variable distribution is stored for each examinee. If 'computeExamineePosterior' is FALSE the value of the argument is not used (in that case a previously stored posterior distribution for each examinee is being used in this function). |
D | Class for discrete latent variable distribution. | |
E | Examinee type. | |
EI | Iterator over pointers to examinee objects. | |
I | Item type. | |
II | Iterator over item objects. |
[in] | examinees_begin | Iterator to pointer to first examinee |
[in] | examinees_end | Iterator to pointer to one past last examinee |
[in] | computeExamineePosterior | If TRUE posterior latent variable distribution for each examinee is computed. If FALSE previously stored posterior latent variable distribution for each examinee is used. |
[in] | storeExamineePosterior | If TRUE posterior latent variable distribution is stored for each examinee. If 'computeExamineePosterior' is FALSE the value of the argument is not used (in that case a previously stored posterior distribution for each examinee is being used in this function). |
Definition at line 1138 of file EStepDiscrete.h.
References etirm::EStepDiscrete< E, I, II, D >::DoEStep(), etirm::EStepDiscrete< E, I, II, D >::items_begin, and etirm::EStepDiscrete< E, I, II, D >::items_end.
01141 { 01142 return DoEStep(examinees_begin, examinees_end, items_begin, items_end, 01143 computeExamineePosterior, storeExamineePosterior); 01144 }
Real etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior | ( | E & | examinee, | |
PI | begin_posterior, | |||
PI | end_posterior | |||
) | [inline] |
Computes posterior distribution of discrete latent variable for an examinee. Returns marginal likelihood of the examinee's responses.
Computes posterior distribution of discrete latent variable for an examinee. Returns marginal likelihood of the examinee's responses.
A duplicate of this definition is given inside the class definition for use when BOOST_MSVC6_MEMBER_TEMPLATES is defined.
PI | Iterator over posterior probabilities. |
[in] | examinee | Object holding information about an examinee's item responses |
[in] | begin_posterior | Iterator pointing to first element of container holding posterior probabilities. |
[in] | end_posterior | Iterator pointing to one past last element of container holding posterior probabilities. This argument is only used to make sure there is enough space in the container which will hold the posterior probabilities. |
PI | Iterator over posterior probabilities. |
[in] | examinee | Object holding information about an examinee's item responses |
[in] | begin_posterior | Iterator pointing to first element of container holding posterior probabilities. |
[in] | end_posterior | Iterator pointing to one past last element of container holding posterior probabilities. This argument is only used to make sure there is enough space in the container which will hold the posterior probabilities. |
Definition at line 826 of file EStepDiscrete.h.
References etirm::EStepDiscrete< E, I, II, D >::itemIndices, etirm::EStepDiscrete< E, I, II, D >::items_begin, etirm::EStepDiscrete< E, I, II, D >::logLatentProb, etirm::logZero, etirm::EStepDiscrete< E, I, II, D >::mRespProb, etirm::EStepDiscrete< E, I, II, D >::notPresentedResponse, etirm::EStepDiscrete< E, I, II, D >::numGroupUnique, etirm::EStepDiscrete< E, I, II, D >::numItems, and etirm::EStepDiscrete< E, I, II, D >::numLatentVarCat.
Referenced by etirm::EStepDiscrete< E, I, II, D >::DoEStep().
00828 { 00829 int i, il; 00830 00831 int group = examinee.Group(); 00832 00833 if ((end_posterior - begin_posterior) != numLatentVarCat) 00834 { 00835 throw InvalidArgument("Incorrect size of vector to hold posterior probabilities", 00836 "EStepDiscrete::ExamineePosterior"); 00837 } 00838 00839 /* Constants used for loop unrolling */ 00840 int Ndiv4 = numLatentVarCat / 4; 00841 int Nmod4 = numLatentVarCat - Ndiv4*4; 00842 00843 /* initialize posterior probabilities */ 00844 RealVector::iterator ipost = begin_posterior; 00845 RealMatrix::row_iterator iwt = logLatentProb.begin_row(group); 00846 for (i = Ndiv4; i--; ipost+=4, iwt+=4) 00847 { 00848 *ipost = *iwt; 00849 ipost[1] = iwt[1]; 00850 ipost[2] = iwt[2]; 00851 ipost[3] = iwt[3]; 00852 } 00853 for (i = Nmod4; i--; ++ipost, ++iwt) 00854 { 00855 *ipost = *iwt; 00856 } 00857 00858 typename NMatrixVec<II>::iterator item = // "typename" keyword added. ww, 1/10/2008. 00859 (numGroupUnique == 1) ? mRespProb[0]->begin() : mRespProb[group-1]->begin(); 00860 II iitem = items_begin; 00861 typename E::response_iterator presp = examinee.responses_begin(); 00862 std::vector<int>::iterator ii = itemIndices->begin(); 00863 for (i = numItems; i--; ++item, ++iitem, ++ii) 00864 { 00865 Response resp = presp[*ii]; 00866 if (resp != notPresentedResponse) 00867 { 00868 ipost = begin_posterior; 00869 int index = (*iitem)->ResponseIndex(resp); 00870 RealMatrix::row_iterator ir = (*item)->begin_row(index+1); 00871 for (il=Ndiv4; il--; ipost+=4, ir+=4) 00872 { 00873 *ipost += *ir; 00874 ipost[1] += ir[1]; 00875 ipost[2] += ir[2]; 00876 ipost[3] += ir[3]; 00877 } 00878 for (il=Nmod4; il--; ++ipost, ++ir) 00879 { 00880 *ipost += *ir; 00881 } 00882 } 00883 } 00884 00885 /* find sum in order to standardize posterior */ 00886 ipost = begin_posterior; 00887 iwt = logLatentProb.begin_row(group); 00888 Real sum = 0.0; 00889 for (i = numLatentVarCat; i--; ++ipost, ++iwt) 00890 { 00891 if (*iwt != logZero) 00892 sum += std::exp(*ipost); 00893 else 00894 *ipost = logZero; 00895 } 00896 00897 /* standardize */ 00898 ipost = begin_posterior; 00899 Real logsum = std::log(sum); 00900 for (i = numLatentVarCat; i--; ++ipost) 00901 { 00902 if (*ipost != logZero) 00903 { 00904 *ipost -= logsum; 00905 *ipost = std::exp(*ipost); 00906 } 00907 else 00908 *ipost = 0.0; 00909 } 00910 00911 return sum; 00912 }
void etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb | ( | ) | [inline] |
Calculates matrices of response probabilities used in DoEStep.
Fills NMatrixVec objects with log of probabilities of each response to each item for each level of the discrete latent variable.
E | Examinee type. | |
I | Item type. | |
II | Iterator over item objects. | |
D | Class for discrete latent variable distribution. |
Definition at line 774 of file EStepDiscrete.h.
References etirm::EStepDiscrete< E, I, II, D >::items_begin, etirm::EStepDiscrete< E, I, II, D >::items_end, etirm::EStepDiscrete< E, I, II, D >::latentvar_dist, etirm::EStepDiscrete< E, I, II, D >::mRespProb, etirm::EStepDiscrete< E, I, II, D >::numGroupUnique, and etirm::EStepDiscrete< E, I, II, D >::numLatentVarCat.
Referenced by etirm::EStepDiscrete< E, I, II, D >::DoEStep().
00775 { 00776 for (int g=0; g<numGroupUnique; ++g) 00777 { 00778 typename NMatrixVec<II>::iterator vi = mRespProb[g]->begin(); // "typename" keyword added. ww, 1/10/2008 00779 for (II iitem = items_begin; iitem != items_end; ++iitem, ++vi) // loop over items 00780 00781 { 00782 Response response; 00783 int n = (*iitem)->NumRespCat(); 00784 for (int j = 1; j <= n; ++j) // loop over responses to items 00785 00786 { 00787 typename D::point_iterator ipoint = latentvar_dist.begin_points(g+1); 00788 response = (*iitem)->IndexResponse(j-1); 00789 RealMatrix::row_iterator il = (**vi).begin_row(j); 00790 for (int k = numLatentVarCat; k--; ++il, ++ipoint) // loop over latent variable categories 00791 00792 { 00793 *il = std::log((*iitem)->ProbResp(response, *ipoint)); 00794 } 00795 } 00796 } 00797 } 00798 }
ngroup_iterator etirm::EStepDiscrete< E, I, II, D >::GetNGroup | ( | int | group | ) | [inline] |
Returns iterator to latent variable distribution for a group.
Definition at line 283 of file EStepDiscrete.h.
int etirm::EStepDiscrete< E, I, II, D >::size | ( | ) | [inline] |
Returns number of categories in discrete latent variable distribution.
Definition at line 289 of file EStepDiscrete.h.
point_iterator etirm::EStepDiscrete< E, I, II, D >::GetPoints | ( | ) | [inline] |
Returns Iterator to points of latent variable distribution.
Definition at line 295 of file EStepDiscrete.h.
RealMatrix* etirm::EStepDiscrete< E, I, II, D >::nGroups [protected] |
Row i gives the expected number of examinees at each category of the latent variable for group i computed in DoEStep.
Definition at line 304 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::DoEStep(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), and etirm::EStepDiscrete< E, I, II, D >::~EStepDiscrete().
std::vector<NMatrixVec<II> *> etirm::EStepDiscrete< E, I, II, D >::mRespProb [protected] |
Element i is a pointer to a NMatrixVec object for examinee group i. Different NMatrixVec objects are needed for different examinee groups if unique latent distribution points are used for each group. The NMatrixVec object for each examinee group holds the log of the response probabilities for each response of each item in each latent variable category as computed in CalcResponseProb. The k-th element is a pointer to a matrix containing log response probabilities for item k. Row i of the k-th matrix contains the log response probabilities for response i of item k over the latent variable categories.
Definition at line 310 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior(), and etirm::EStepDiscrete< E, I, II, D >::~EStepDiscrete().
II etirm::EStepDiscrete< E, I, II, D >::items_begin [protected] |
Iterator to first item.
Definition at line 323 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::DoEStep(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), and etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior().
II etirm::EStepDiscrete< E, I, II, D >::items_end [protected] |
Iterator to one past last item.
Definition at line 326 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::DoEStep(), and etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete().
D& etirm::EStepDiscrete< E, I, II, D >::latentvar_dist [protected] |
Object containing discrete latent variable distribution.
Definition at line 329 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::DoEStep(), and etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete().
RealMatrix etirm::EStepDiscrete< E, I, II, D >::logLatentProb [protected] |
Stores logarithms of probilities in latentvar_dist for for each examinee group for use in ExamineePosterior(). Row i contains log of latent probabilities for examinee group i.
Definition at line 332 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::DoEStep(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), and etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior().
int etirm::EStepDiscrete< E, I, II, D >::numItems [protected] |
number of items.
Definition at line 339 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), and etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior().
int etirm::EStepDiscrete< E, I, II, D >::numLatentVarCat [protected] |
number of categories in discrete latent variable distribution.
Definition at line 341 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::DoEStep(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), and etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior().
int etirm::EStepDiscrete< E, I, II, D >::numGroupUnique [protected] |
Number of groups with unique latent distribution points.
Definition at line 343 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::CalcResponseProb(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior(), and etirm::EStepDiscrete< E, I, II, D >::~EStepDiscrete().
std::vector<int>* etirm::EStepDiscrete< E, I, II, D >::itemIndices [protected] |
This vector contains zero-offset indices in the examinee response vector corresponding to the sequence of items given by items_begin and items_end.
Definition at line 346 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior(), and etirm::EStepDiscrete< E, I, II, D >::~EStepDiscrete().
Response etirm::EStepDiscrete< E, I, II, D >::notPresentedResponse [protected] |
Response indicating an item was not presented to an examinee. Assumed to be the same for all items.
Definition at line 351 of file EStepDiscrete.h.
Referenced by etirm::EStepDiscrete< E, I, II, D >::DoEStep(), etirm::EStepDiscrete< E, I, II, D >::EStepDiscrete(), and etirm::EStepDiscrete< E, I, II, D >::ExamineePosterior().