00001 /*! \file ItemParamPriorLogNormal.h 00002 00003 \brief 00004 Class derived from ItemParamPrior representing a lognormal prior distribution 00005 of item parameters for use in Bayes modal estimation. 00006 00007 \param mParameter[0] mean parameter of lognormal distribution 00008 \param mParameter[1] standard deviation parameter of lognormal distribution. 00009 00010 Note the second parameter is the standard deviation, NOT the variance. 00011 00012 Estimation Toolkit for Item Response Models (ETIRM) 00013 http://www.smallwaters.com/software/cpp/etirm.html 00014 00015 Author(s): 00016 Werner Wothke, maintenance (http://www.smallwaters.com) 00017 Brad Hanson (http://www.b-a-h.com/) 00018 See the file LICENSE for information on usage and redistribution. 00019 00020 Copyright (C) 2008, Werner Wothke 00021 Copyright (c) 2000-2001, Bradley A. Hanson 00022 */ 00023 00024 #ifndef ETIRM_ITEMPARAMPRIORLOGNORMAL_H_ 00025 #define ETIRM_ITEMPARAMPRIORLOGNORMAL_H_ 00026 00027 #ifdef ETIRM_NO_DIR_PREFIX 00028 #include "ItemParamPrior.h" 00029 #else 00030 #include "etirm/ItemParamPrior.h" 00031 #endif 00032 00033 namespace etirm 00034 { 00035 /*! 00036 \brief 00037 Class derived from ItemParamPrior representing a lognormal prior distribution 00038 of item parameters for use in Bayes modal estimation. 00039 */ 00040 class ItemParamPriorLogNormal : public ItemParamPrior 00041 { 00042 public: 00043 00044 ItemParamPriorLogNormal(); 00045 ItemParamPriorLogNormal(RealVector ¶m); 00046 ItemParamPriorLogNormal(Real mean, Real sd); 00047 00048 //! Returns number of prior logNormal distribution parameters for the IRT parameter. 00049 virtual int NumParameters() 00050 { 00051 return 2; 00052 } 00053 00054 virtual bool ZeroDensity(Real p) 00055 { 00056 return (p <= 0.0) ? true : false; 00057 } 00058 //!< Returns true if density at p is zero. 00059 00060 /*! 00061 \brief 00062 If density of x is zero (x <= 0) then this function returns a small value 00063 slightly greater than zero that has a non-zero density. 00064 */ 00065 virtual Real NearestNonZero(Real x) 00066 { 00067 return (x <= 0.0) ? 0.001 : x; 00068 } 00069 00070 virtual Real LogDensity(Real p); 00071 // Returns log of the density function. 00072 00073 virtual Real DerivLogDensity1(Real p); 00074 // Returns the first derivative of the log density 00075 00076 virtual Real DerivLogDensity2(Real p); 00077 // Returns the second derivative of the log density 00078 00079 virtual std::string DistributionName() const 00080 { 00081 return std::string("lognormal"); 00082 } 00083 //!< Returns string containing name of distribution used for prior. 00084 00085 00086 private: 00087 00088 Real variance; 00089 //!< Variance of log-Normal distribution. 00090 }; 00091 00092 } // namespace etirm 00093 00094 #endif // ETIRM_ITEMPARAMPRIORLOGNORMAL_H_