etirm::ItemParamPriorLogNormal Class Reference

Class derived from ItemParamPrior representing a lognormal prior distribution of item parameters for use in Bayes modal estimation. More...

#include <ItemParamPriorLogNormal.h>

Inheritance diagram for etirm::ItemParamPriorLogNormal:

Inheritance graph
[legend]
Collaboration diagram for etirm::ItemParamPriorLogNormal:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ItemParamPriorLogNormal ()
 Default constructor - assigns uniform distribution.
 ItemParamPriorLogNormal (RealVector &param)
 Constructor taking vector of parameters.
 ItemParamPriorLogNormal (Real mean, Real sd)
 Constructor taking prior mean and standard deviation as arguments.
virtual int NumParameters ()
 Returns number of prior logNormal distribution parameters for the IRT parameter.
virtual bool ZeroDensity (Real p)
 Returns true if density at p is zero.
virtual Real NearestNonZero (Real x)
 If density of x is zero (x <= 0) then this function returns a small value slightly greater than zero that has a non-zero density.
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 log-Normal distribution.


Detailed Description

Class derived from ItemParamPrior representing a lognormal prior distribution of item parameters for use in Bayes modal estimation.

Definition at line 40 of file ItemParamPriorLogNormal.h.


Constructor & Destructor Documentation

etirm::ItemParamPriorLogNormal::ItemParamPriorLogNormal (  ) 

Default constructor - assigns uniform distribution.

Definition at line 80 of file ItemParamPriorLogNormal.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::ItemParamPriorLogNormal::ItemParamPriorLogNormal ( RealVector param  ) 

Constructor taking vector of parameters.

Parameters:
[in] &param Parameter vector describing log-Normal prior: param[0] - prior mean, param[1] - prior standard deviation.
Note: The second element of param is the standard deviation, NOT the variance.

Definition at line 48 of file ItemParamPriorLogNormal.cpp.

References variance.

00048                                                                     :
00049     ItemParamPrior(param)
00050   {
00051     variance = param(2) * param(2);
00052   }

etirm::ItemParamPriorLogNormal::ItemParamPriorLogNormal ( Real  mean,
Real  sd 
)

Constructor taking prior mean and standard deviation as arguments.

Parameters:
[in] mean Prior mean
[in] sd Prior standard deviation
Note: The second parameter is the standard deviation, NOT the variance.

Definition at line 63 of file ItemParamPriorLogNormal.cpp.

References etirm::ItemParamPrior::mParameters, and variance.

00063                                                                      :
00064     ItemParamPrior(2)
00065   {
00066     if (sd <= 0.0)
00067       throw RuntimeError("Invalid s.d. for lognormal prior",
00068           "ItemParamPriorLogNormal::ItemParamPriorLogNormal");
00069 
00070     mParameters[0] = mean;
00071     mParameters[1] = sd;
00072 
00073     variance = sd * sd;
00074   }


Member Function Documentation

virtual int etirm::ItemParamPriorLogNormal::NumParameters (  )  [inline, virtual]

Returns number of prior logNormal distribution parameters for the IRT parameter.

Implements etirm::ItemParamPrior.

Definition at line 49 of file ItemParamPriorLogNormal.h.

00050     {
00051       return 2;
00052     }

virtual bool etirm::ItemParamPriorLogNormal::ZeroDensity ( Real  p  )  [inline, virtual]

Returns true if density at p is zero.

Reimplemented from etirm::ItemParamPrior.

Definition at line 54 of file ItemParamPriorLogNormal.h.

Referenced by DerivLogDensity1(), DerivLogDensity2(), and LogDensity().

Here is the caller graph for this function:

virtual Real etirm::ItemParamPriorLogNormal::NearestNonZero ( Real  x  )  [inline, virtual]

If density of x is zero (x <= 0) then this function returns a small value slightly greater than zero that has a non-zero density.

Reimplemented from etirm::ItemParamPrior.

Definition at line 65 of file ItemParamPriorLogNormal.h.

00066     {
00067       return (x <= 0.0) ? 0.001 : x;
00068     }

Real etirm::ItemParamPriorLogNormal::LogDensity ( Real  p  )  [virtual]

Returns log-density of p.

Parameters:
[in] p Argument of log density function (an item parameter value).
Note: Returns only the part of the log of the density that depends on the parameter.

Implements etirm::ItemParamPrior.

Definition at line 97 of file ItemParamPriorLogNormal.cpp.

References etirm::ItemParamPrior::mParameters, variance, and ZeroDensity().

00098   {
00099     /* Check for value outside limits of distribution */
00100     if (ItemParamPriorLogNormal::ZeroDensity(p))
00101     {
00102       return std::log(0.0);
00103     }
00104 
00105     Real value = std::log(p) - mParameters[0];
00106     value *= value;
00107     value /= -2.0 * variance;
00108     value -= std::log(p);
00109 
00110     return value;
00111   }

Here is the call graph for this function:

Real etirm::ItemParamPriorLogNormal::DerivLogDensity1 ( Real  p  )  [virtual]

Returns first derivative of log density.

Parameters:
[in] p Argument of log density function (an item parameter value).
Note: Returns only the part of the log of the density that depends on the parameter.

Implements etirm::ItemParamPrior.

Definition at line 121 of file ItemParamPriorLogNormal.cpp.

References etirm::ItemParamPrior::mParameters, variance, and ZeroDensity().

00122   {
00123     /* Outside limits of distribution density does not change,
00124      so derivative is zero */
00125     if (ItemParamPriorLogNormal::ZeroDensity(p))
00126       return 0.0;
00127 
00128     Real value = std::log(p) - mParameters[0] + variance;
00129     value /= variance * p;
00130 
00131     return -value;
00132   }

Here is the call graph for this function:

Real etirm::ItemParamPriorLogNormal::DerivLogDensity2 ( Real  p  )  [virtual]

Returns second derivative of log density.

Parameters:
[in] p Argument of log density function (an item parameter value).
Note: Returns 0nly the part of the log of the density that depends on the parameter.

Implements etirm::ItemParamPrior.

Definition at line 142 of file ItemParamPriorLogNormal.cpp.

References etirm::ItemParamPrior::mParameters, variance, and ZeroDensity().

00143   {
00144     /* Outside limits of distribution density does not change,
00145      so derivative is zero */
00146     if (ItemParamPriorLogNormal::ZeroDensity(p))
00147       return 0.0;
00148 
00149     Real value = std::log(p) - mParameters[0] + variance - 1.0;
00150     value /= p * p * variance;
00151 
00152     return value;
00153   }

Here is the call graph for this function:

virtual std::string etirm::ItemParamPriorLogNormal::DistributionName (  )  const [inline, virtual]

Returns string containing name of distribution used for prior.

Implements etirm::ItemParamPrior.

Definition at line 79 of file ItemParamPriorLogNormal.h.


Member Data Documentation

Real etirm::ItemParamPriorLogNormal::variance [private]

Variance of log-Normal distribution.

Definition at line 89 of file ItemParamPriorLogNormal.h.

Referenced by DerivLogDensity1(), DerivLogDensity2(), ItemParamPriorLogNormal(), and LogDensity().


The documentation for this class was generated from the following files:
Generated on Sat Mar 1 21:41:54 2008 for ETIRM by  doxygen 1.5.4