00001 /*! \file ExamineeGrpCov.h 00002 00003 \brief 00004 This class is a descendant of Examinee which also contains information 00005 about the group the examinee belongs to (a group covariate). 00006 00007 Estimation Toolkit for Item Response Models (ETIRM) 00008 http://www.smallwaters.com/software/cpp/etirm.html 00009 00010 Author(s): Brad Hanson (http://www.b-a-h.com/) 00011 See the file LICENSE for information on usage and redistribution. 00012 00013 Author(s): 00014 Werner Wothke, maintenance (http://www.smallwaters.com) 00015 Brad Hanson (http://www.b-a-h.com/) 00016 See the file LICENSE for information on usage and redistribution. 00017 00018 Copyright (C) 2008, Werner Wothke 00019 Copyright (c) 2000-2001, Bradley A. Hanson 00020 */ 00021 00022 #ifndef ETIRM_EXAMINEEGRPCOV_H_ 00023 #define ETIRM_EXAMINEEGRPCOV_H_ 00024 00025 #ifdef ETIRM_NO_DIR_PREFIX 00026 #include "Examinee.h" 00027 #else 00028 #include "etirm/Examinee.h" 00029 #endif 00030 00031 namespace etirm 00032 { 00033 00034 /*! 00035 \brief 00036 This class is a descendant of Examinee which also contains information 00037 about the group the examinee belongs to (a group covariate). 00038 00039 \section template_args Template Parameters 00040 00041 \param P Type for storing vector of posterior probabilities 00042 \param R Type for storing vector of item responses. 00043 */ 00044 template <class R, class P> 00045 #ifndef BOOST_MSVC 00046 class ExamineeGrpCov : public Examinee<R,P> 00047 #else 00048 class ExamineeGrpCov : public Examinee<typename R, typename P> 00049 #endif 00050 { 00051 00052 public: 00053 //! Group identifier type. 00054 typedef short group_type; 00055 00056 /*! 00057 \brief 00058 Class constructor. 00059 00060 \section function_args Function Parameters 00061 00062 \param[in] nitems number of items in response string 00063 \param[in] group group number (where first group is group 1) 00064 */ 00065 ExamineeGrpCov(int nitems = 0, group_type group = 1) : 00066 mGroup(group), Examinee<R, P>(nitems) 00067 { 00068 } 00069 00070 /*! 00071 \brief 00072 Returns the group which the examinee belongs to. 00073 00074 Return value: group number (where first group is group 1). 00075 */ 00076 group_type Group() const 00077 { 00078 return mGroup; 00079 } 00080 /*! 00081 \brief 00082 Assigns the group which examinee belongs to. 00083 00084 \section function_args Function Parameters 00085 00086 \param[in] group Group number (where first group is group 1). 00087 */ 00088 void SetGroup(int group); 00089 00090 protected: 00091 00092 group_type mGroup; 00093 //!< Group which the examinee belongs to (first group is group 1). 00094 00095 }; 00096 00097 /* 00098 \brief 00099 Assigns the group which the examinee belongs to. 00100 00101 \section function_args Function Parameters 00102 00103 \param[in] group Group number (where first group is group 1). 00104 */ 00105 template <class R, class P> void ExamineeGrpCov<R, P>::SetGroup(int group) 00106 { 00107 if (group < 1) 00108 throw InvalidArgument("Invalid group number", "ExamineeGrpCov::SetGroup"); 00109 mGroup = group; 00110 } 00111 00112 } // namespace etirm 00113 00114 #endif // ETIRM_EXAMINEEGRPCOV_H_