00001 /*! \file ItemParamPrior.h 00002 00003 \brief 00004 Class representing a prior distribution used for item parameters 00005 in Bayes modal estimation. 00006 00007 Estimation Toolkit for Item Response Models (ETIRM) 00008 http://www.smallwaters.com/software/cpp/etirm.html 00009 00010 Author(s): 00011 Werner Wothke, maintenance (http://www.smallwaters.com) 00012 Brad Hanson (http://www.b-a-h.com/) 00013 See the file LICENSE for information on usage and redistribution. 00014 00015 Copyright (C) 2008, Werner Wothke 00016 Copyright (c) 2000-2001, Bradley A. Hanson 00017 */ 00018 00019 #ifndef ETIRM_ITEMPARAMPRIOR_H_ 00020 #define ETIRM_ITEMPARAMPRIOR_H_ 00021 00022 #ifdef ETIRM_NO_DIR_PREFIX 00023 #include "etirmtypes.h" 00024 #else 00025 #include "etirm/etirmtypes.h" 00026 #endif 00027 00028 #include <vector> // needed for declaration of PriorVector 00029 #include <string> 00030 00031 namespace etirm 00032 { 00033 00034 /*! 00035 \brief 00036 Class representing a prior distribution used for item parameters 00037 in Bayes modal estimation. 00038 */ 00039 class ItemParamPrior 00040 { 00041 public: 00042 00043 /*! 00044 \brief 00045 Constructor assigning values of prior parameters from a vector. 00046 00047 \param[in] ¶m Address of parameter vector for this item. 00048 */ 00049 ItemParamPrior(RealVector ¶m); 00050 00051 /*! 00052 \brief 00053 Constructor setting the number of prior parameters, but not values of the parameters. 00054 00055 \param[in] numparam Number of parameter for this item. 00056 */ 00057 explicit ItemParamPrior(int numparam); 00058 00059 virtual ~ItemParamPrior(); 00060 //!< Virtual destructor used here so that the correct destructor gets called in derived classes. 00061 00062 /*! 00063 \brief 00064 Assigns item parameter from vector. 00065 00066 \param[in] ¶m Address of parameter vector for this item. 00067 */ 00068 void SetParameters(RealVector ¶m); 00069 00070 /*! 00071 \brief 00072 Returns parameter vector for this item. 00073 */ 00074 RealVector GetParameters(); 00075 00076 /*! 00077 \brief 00078 Returns number of prior distribution parameters for the IRT parameter. 00079 00080 Defined in derived class to return number of parameters in prior density. 00081 */ 00082 virtual int NumParameters() = 0; 00083 00084 virtual bool ZeroDensity(Real /* p */) 00085 { 00086 return false; 00087 } 00088 //!< Returns true if density at p is zero. By default the density is non-zero at all points. 00089 00090 /*! 00091 \brief 00092 If x has density zero, this function returns the value 00093 closest to x that has a non-zero density. 00094 00095 The Default is to assume all values of x have a non-zero density. 00096 00097 \param[in] x Quadrature point. 00098 */ 00099 virtual Real NearestNonZero(Real x) 00100 { 00101 return x; 00102 } 00103 00104 virtual Real LogDensity(Real p) = 0; 00105 //!< Returns the log of the density function. 00106 00107 virtual Real DerivLogDensity1(Real p) = 0; 00108 //!< Returns the first derivative of the log density. 00109 00110 virtual Real DerivLogDensity2(Real p) = 0; 00111 //!< Returns the second derivative of the log density. 00112 00113 virtual std::string DistributionName() const = 0; 00114 //!< Returns the string containing name of distribution used for prior. 00115 00116 protected: 00117 00118 RealVector mParameters; 00119 //!< Parameters of prior distribution 00120 }; 00121 00122 /*! 00123 \brief 00124 Data type to represent a vector of pointers to prior distributions. 00125 */ 00126 typedef std::vector<ItemParamPrior *> PriorVector; 00127 00128 } // namespace etirm 00129 00130 #endif // ETIRM_ITEMPARAMPRIOR_H_