00001 /*! \file ItemParamPriorBeta4.h 00002 00003 \brief 00004 Class representing a four-parameter beta prior distribution of 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_ITEMPARAMPRIORBETA4_H_ 00020 #define ETIRM_ITEMPARAMPRIORBETA4_H_ 00021 00022 #ifdef ETIRM_NO_DIR_PREFIX 00023 #include "ItemParamPrior.h" 00024 #else 00025 #include "etirm/ItemParamPrior.h" 00026 #endif 00027 00028 namespace etirm 00029 { 00030 /*! 00031 \brief 00032 Class representing a four-parameter beta prior distribution of item parameters 00033 in Bayes modal estimation. 00034 */ 00035 class ItemParamPriorBeta4 : public ItemParamPrior 00036 { 00037 public: 00038 00039 ItemParamPriorBeta4(); 00040 ItemParamPriorBeta4(RealVector ¶m); 00041 ItemParamPriorBeta4(Real a, Real b, Real l, Real u); 00042 00043 //! Returns number of prior beta distribution parameters for the IRT parameter. 00044 virtual int NumParameters() 00045 { 00046 return 4; 00047 } 00048 00049 00050 virtual bool ZeroDensity(Real p) 00051 { 00052 return (p <= mParameters[2] || p >= mParameters[3]); 00053 } 00054 //!< Returns true if density at p is zero 00055 00056 virtual Real NearestNonZero(Real x); 00057 //!< If density of x is zero, then this function will return the value closest to x that has a non-zero density. 00058 00059 virtual Real LogDensity(Real p); 00060 // Returns log of the density function. 00061 00062 virtual Real DerivLogDensity1(Real p); 00063 // Returns the first derivative of the log density. 00064 00065 virtual Real DerivLogDensity2(Real p); 00066 // Returns the second derivative of the log density. 00067 00068 virtual std::string DistributionName() const 00069 { 00070 return std::string("beta"); 00071 } 00072 //!< Returns string containing name of distribution used for prior. 00073 00074 00075 }; 00076 00077 } // namespace etirm 00078 00079 #endif // ETIRM_ITEMPARAMPRIORBETA4_H_