#include <ItemParamPriorNormal.h>
Public Member Functions | |
ItemParamPriorNormal () | |
Default constructor - assigns uniform distribution. | |
ItemParamPriorNormal (RealVector ¶m) | |
Constructor taking vector of parameters. | |
ItemParamPriorNormal (Real mean, Real sd) | |
Constructor taking mean and standard deviation as arguments. | |
virtual int | NumParameters () |
Returns number of prior Normal distribution parameters for the IRT item. | |
virtual Real | LogDensity (Real p) |
Returns log-density of p. | |
virtual Real | DerivLogDensity1 (Real p) |
Returns first derivative of log density. | |
virtual Real | DerivLogDensity2 (Real p) |
Returns second derivative of log density. | |
virtual std::string | DistributionName () const |
Returns string containing name of distribution used for prior. | |
Private Attributes | |
Real | variance |
Variance of Normal distribution. |
Definition at line 40 of file ItemParamPriorNormal.h.
etirm::ItemParamPriorNormal::ItemParamPriorNormal | ( | ) |
Default constructor - assigns uniform distribution.
Definition at line 80 of file ItemParamPriorNormal.cpp.
References etirm::ItemParamPrior::mParameters, and variance.
00080 : 00081 ItemParamPrior(2) 00082 { 00083 mParameters[0] = 0.0; 00084 mParameters[1] = 1.0; 00085 00086 variance = 1.0; 00087 }
etirm::ItemParamPriorNormal::ItemParamPriorNormal | ( | RealVector & | param | ) |
Constructor taking vector of parameters.
[in] | ¶m | Parameter vector of length 2: param[0] = Normal prior mean, param[1] = Normal prior standard deviation. |
Definition at line 49 of file ItemParamPriorNormal.cpp.
References variance.
00049 : 00050 ItemParamPrior(param) 00051 { 00052 variance = param(2) * param(2); 00053 }
Constructor taking mean and standard deviation as arguments.
[in] | mean | Normal prior mean. |
[in] | sd | Normal prior standard deviation. |
Definition at line 64 of file ItemParamPriorNormal.cpp.
References etirm::ItemParamPrior::mParameters, and variance.
00064 : 00065 ItemParamPrior(2) 00066 { 00067 if (sd <= 0.0) 00068 throw RuntimeError("Invalid s.d. for normal prior", 00069 "ItemParamPriorNormal::ItemParamPriorNormal"); 00070 00071 mParameters[0] = mean; 00072 mParameters[1] = sd; 00073 00074 variance = sd * sd; 00075 }
virtual int etirm::ItemParamPriorNormal::NumParameters | ( | ) | [inline, virtual] |
Returns number of prior Normal distribution parameters for the IRT item.
Implements etirm::ItemParamPrior.
Definition at line 49 of file ItemParamPriorNormal.h.
Returns log-density of p.
[in] | p | Argument of log density function (an item parameter value). |
Implements etirm::ItemParamPrior.
Definition at line 97 of file ItemParamPriorNormal.cpp.
References etirm::ItemParamPrior::mParameters, and variance.
00098 { 00099 Real value = p - mParameters[0]; 00100 value *= value; 00101 value /= -2.0 * variance; 00102 00103 return value; 00104 }
Returns first derivative of log density.
[in] | p | Argument of log density function (an item parameter value). |
Implements etirm::ItemParamPrior.
Definition at line 114 of file ItemParamPriorNormal.cpp.
References etirm::ItemParamPrior::mParameters, and variance.
00115 { 00116 return -(p - mParameters[0])/variance; 00117 }
Returns second derivative of log density.
[in] | p | Argument of log density function (an item parameter value). |
Implements etirm::ItemParamPrior.
Definition at line 127 of file ItemParamPriorNormal.cpp.
References variance.
00128 { 00129 return -1.0/variance; 00130 }
virtual std::string etirm::ItemParamPriorNormal::DistributionName | ( | ) | const [inline, virtual] |
Returns string containing name of distribution used for prior.
Implements etirm::ItemParamPrior.
Definition at line 63 of file ItemParamPriorNormal.h.
Real etirm::ItemParamPriorNormal::variance [private] |
Variance of Normal distribution.
Definition at line 73 of file ItemParamPriorNormal.h.
Referenced by DerivLogDensity1(), DerivLogDensity2(), ItemParamPriorNormal(), and LogDensity().