etirm Namespace Reference


Classes

class  DiscreteLatentDist
 Class approximating the latent ability distribution by numeric quadrature. More...
class  NMatrixVec
 Helper class template used by EStepDiscrete for managing a vector containing pointers to RealMatrix objects. More...
class  EStepDiscrete
 Class template to perform E-step calculation and store results for IRT model with a discrete latent variable distribution. More...
class  Examinee
 Class to store a response pattern, its frequency, the posterior distribution of the ability parameter and the marginal likelihood of the pattern. More...
class  ExamineeGrpCov
 This class is a descendant of Examinee which also contains information about the group the examinee belongs to (a group covariate). More...
class  ICC3PLFunc
 Common functions and data members used for specializations of ICCLogistic. More...
class  ICCLogistic
 Class declaration of logistic item response model; specializations supplied for NPAR = 1, 2, 3. More...
class  ICCLogistic< 3 >
 Three-parameter logistic item response model. More...
class  ICCLogistic< 2 >
 Two-parameter logistic item response model. More...
class  ICCLogistic< 1 >
 One-parameter logistic item response model. More...
class  ICRF_GPCM
 Class for the GPCM item response function. More...
class  ICRF_PCM
 Class for Masters' PCM item response function. More...
class  Item
 Class (template) containing information about an item. More...
class  ItemDichotomous
 Class representing a dichotomously scored item derived from ItemNR. More...
class  ItemNR
 Class, derived from Item, to maintain information calculated for an Item object in the E-step so that it can be used in the M-step to estimate item parameters. More...
class  ItemParamPrior
 Class representing a prior distribution used for item parameters in Bayes modal estimation. More...
class  ItemParamPriorBeta4
 Class representing a four-parameter beta prior distribution of item parameters in Bayes modal estimation. More...
class  ItemParamPriorLogNormal
 Class derived from ItemParamPrior representing a lognormal prior distribution of item parameters for use in Bayes modal estimation. More...
class  ItemParamPriorNormal
 Class derived from ItemParamPrior representing a normal prior distribution of item parameters for use in Bayes modal estimation. More...
class  ItemPolytomous
 Class representing a polytomously scored item derived from ItemNR class. More...
class  ItemRespCounts
 Class to hold counts of number of examinees who responded in each response category of an item. More...
class  SwigEtirmRun
 Class holding information used for one modeling problem. More...
class  estep
 SWIG wrapper for EStepDiscrete object. More...
class  ThetaLogLikelihood
 Function object for computing loglikelihood for theta parameter of an IRT model. More...

Typedefs

typedef ETIRM_FLOAT_TYPE Real
 Data type for floating point numbers.
typedef ETIRM_RESPONSE_TYPE Response
 Data type to hold an examinee item response.
typedef SCPPNT::Vector< RealRealVector
 Vector type containing floating point numbers. Used in numeric calculations.
typedef SCPPNT::Matrix< RealRealMatrix
 Matrix type containing floating point numbers. Used in numeric calculations.
typedef SCPPNT::LogicError LogicError
 Using SCPPNT exception types for logical errors.
typedef SCPPNT::InvalidArgument InvalidArgument
 Using SCPPNT exception types for invalid arguments.
typedef SCPPNT::RuntimeError RuntimeError
 Using SCPPNT exception types for runtime errors.
typedef SCPPNT::Exception Exception
 Using SCPPNT exception types for exception violations.
typedef std::vector
< ItemParamPrior * > 
PriorVector
 Data type to represent a vector of pointers to prior distributions.
typedef RealVector double_vector
 Vector type for double precision values.
typedef SCPPNT::Vector< int > int_vector
 Vector type for integer values.
typedef std::vector< item_type * > ItemVector
 Vector type for item pointers.
typedef EStepDiscrete
< examinee_type, item_type,
ItemVector::iterator,
lvdist_type
estep_type
 Class used in E-step calculation.
typedef std::vector< Uncmin
< RealVector, RealMatrix,
item_type > * > 
UncminVector
 Container to hold Uncmin optimization objects.
typedef std::vector
< examinee_type * > 
ExamineeVector
 Container holding examinee object pointers.
typedef std::vector
< ItemRespCounts * > 
ItemStatsVector
 Container holding pointers to objects containing item statistics for each item.

Enumerations

enum  IRTModel {
  OnePL, TwoPL, ThreePL, PCM,
  GPCM
}
 Enumeration for type of IRT model. More...

Functions

template<class URNG, class EI>
void BootstrapSample (EI examinees_begin, EI examinees_end, URNG &rand)
 Generate a bootstrap sample for a group of examinees.
template<class PI, class WI>
void DiscreteNormalDist (int nQuad, double minPoint, double maxPoint, PI ipoints, WI iweights, double mean=0.0, double sd=1.0)
 Compute points and weights for a discrete distribution that approximates a normal distribution.
template<class L>
Real ExamineeThetaMLE (Real minTheta, Real maxTheta, Real precision, L &likelihood)
 Compute latent variable estimate for an examinee using maximum likelihood. Returns the latent trait estimate for the examinee.
template<class II, class IR>
Real ExamineeThetaMLE (Real minTheta, Real maxTheta, Real precision, II items_begin, II items_end, IR responses_begin)
 Compute latent variable estimate for an examinee using maximum likelihood, create a ThetaLogLikelihood object from two item iterators and an interator to the examinee responses, and return the latent trait estimate for the examinee.
double MaxRelParamDiff (RealVector &oldParam, RealVector &newParam, Real typicalValue=1.0)
 Returns the maximum relative difference between an old and new set of item parameters.
template<class MI, class II>
int MStepItems (MI min_routines, II item_begin, II item_end, double &maxreldiff, bool ignoreMaxIter=false)
 Executes M-step for each item.
template<class II, class T, class R, class RI>
void SimulateResponses (II item_begin, II item_end, T &theta, R &rand, RI iresp, bool resp_indices=false)
 Simulate responses to a set of items for a specific latent variable value.
template<class RI, class II>
void PersonMoments (RI iresp, II iitem, RealVector &itemdiff, Response notPresentedResponse, Real *mean, Real *variance)
 Compute mean and standard deviation of logit item difficulty over items responded to by an examinee.
template<class IE, class RI>
void ItemMoments (int num_examinees, IE begin_examinee, int item, RealVector &abilities, Response notPresentedResponse, double *mean, double *variance)
 Compute mean and standard deviation of person ability over examinees who reponded to an item.
template<class EI, class RI, class II>
void PROX (int numItems, bool useAll, EI begin_examinee, EI end_examinee, II begin_item, Response notPresentedResponse, RealVector &itemdiff, RealVector &abilities)
 Compute Rasch item difficulties and examinee abilities using the Normal Approximation Estimation Algorithm (PROX).
template<class I>
void AssignItemNR (int n, RealVector::iterator itemTheta, RealVector::iterator nVec, RealVector::iterator rVec, I *item)
 Assigns individual examinee thetas into discrete latent variable categories and updates expected counts n and r for item M-step.
template<class RI, class MI, class EI, class I, class II>
int StartingValues3PL (MI begin_min, EI begin_examinee, EI end_examinee, II begin_item, II end_item, Response notPresentedResponse, bool useAll=false, int baseGroup=1, std::set< I * > *calc_items=0)
 Computes starting values for a sequence of items modeled with the three-parameter logistic model.
void CheckItemParam (item_type *item, int index, const char *funcname)
 Tests whether item parameter index is valid for the item.
ItemParamPriorCreatePrior (const std::string &pstr, const double_vector &priorparam, const char *funcname)
 Create a prior distribution object and return a pointer to it.
char Resp2Char (Response r, const item_type *item)
 Converts a response for an item into a character, where '0' represents the first response, '1' represents the second response, etc.
void set_missing_resp (char nr)
 Assigns missing response code to identify examinees who did not respond to an item.
int num_items ()
 Returns the number of items.
int num_latent_dist_points ()
 Returns number of categories of the discrete theta distribution.
int num_groups ()
 Returns number of examinee groups.
int num_examinees ()
 Returns number of examinees.
const char * item_get_model (int itemno)
 Returns the name of model used for an item.
void item_set_param (int paramno, int itemno, double paramvalue)
 Assigns a value to one item parameter of an item.
void item_set_params (int itemno, double_vector *params)
 Assigns values to all item parameters of an item.
void item_set_all_params (int itemno, double_vector *params)
 Assigns values to all fixed and estimated item parameters of an item.
double item_get_param (int paramno, int itemno)
 Returns value of one item parameter of an item.
double_vectoritem_get_params (int itemno)
 Returns vector of all estimated item parameters values of an item.
double_vectoritem_get_all_params (int itemno)
 Returns vector of all fixed and estimated item parameters values of an item.
int item_num_params (int itemno)
 Returns the number of parameters of an item.
int item_num_resp_cat (int itemno)
 Returns the number of response categories of an item.
void item_set_prior (int paramno, int itemno, char *priortype, double_vector *dlist)
 Assigns prior distribution parameters for one item parameter.
const char * item_get_prior_type (int paramno, int itemno)
 Returns type of prior distribution ("normal", "lognormal", "beta", "none") for one item parameter.
double_vectoritem_get_prior_param (int paramno, int itemno)
 Returns vector of prior distribution parameters for one item parameter.
double_vectoritem_cat_counts (int itemno, int group)
 Returns vector of response counts in each response category of an item.
double item_resp_count (int itemno, int group)
 Returns the number of examinees responding to an item.
int item_scale_params (int itemno, double slope, double intercept, bool ignorePriorError)
 Transforms the parameter estimates of an item to a different latent variable scale.
double item_prob_resp (int itemno, int response, double theta)
 Returns the probability that an examinee with a particular theta value will give a particular response to a particular item.
double_vectortest_characteristic_curve (double_vector *thetas, int_vector *ilist2)
 Returns a vector of values of the test characteristic curve, given a vector of theta values and a selection of items.
void dist_set_points (double_vector *dlist, int group)
 Assigns quadrature point values to each discrete category of the discrete latent variable distribution.
void dist_set_point (int index, double p, int group)
 Assigns a quadrature point value to one discrete category of the discrete latent variable distribution.
double_vectordist_get_points (int group)
 Returns vector of quadrature point values of the discrete latent variable distribution.
double dist_get_point (int index, int group)
 Returns the quadrature point value of one discrete category of the discrete latent variable distribution.
void dist_set_probs (double_vector *dlist, int group)
 Assigns quadrature weights to the quadrature points of the latent variable distribution.
void dist_set_prob (int index, double w, int group)
 Assigns the quadrature weight to one discrete category of the discrete latent variable distribution.
double_vectordist_get_probs (int group)
 Returns vector of quadrature weights of the latent variable distribution for one group of examinees.
double dist_get_prob (int index, int group)
 Returns the quadrature weight of one discrete category of the latent variable distribution for one group of examinees.
void dist_transform (double slope, double intercept)
 Transforms the quadrature points of latent variable distribution to a new scale.
double_vectordist_scale (double mean, double sd, int group)
 Scales to the quadrature points of latent variable distribution to yield a specfic mean and standard deviation in one group.
double_vectordist_mean_sd (int group)
 Returns a vector with the mean and standard deviation of the latent variable distribution for a selected group of examinees.
int dist_unique_points ()
 Returns 1 if unique sets of quadrature points are used for two or more groups of examinees, or returns 0 otherwise.
double_vectornormal_dist_prob (int npoints, double minPoint, double maxPoint, double mean, double sd)
 Returns a vector of probabilities for a discrete distribution to approximate a normal distribution over a set of equally spaced points.
double_vectornormal_dist_points (int npoints, double minPoint, double maxPoint, double mean, double sd)
 Returns a vector of quadrature points for a discrete distribution over a set of equally-spaced points.
int mstep_items (bool ignore_max_iter, int_vector *itemno)
 CalculateS M-step for a set of items.
int mstep_message (int itemno)
 Returns message from M-step minimization for one item.
void mstep_max_iter (int itemno, int maxiter)
 Assigns the maximum number of iterations permitted with optimization procedure in mstep_items for one item.
double mstep_max_diff ()
 Returns the maximum relative difference between parameter estimates in two successive EM iterations, as computed in last call to mstep_items.
double mstep_dist (estep *e, int group)
 Executes M-step for the latent distribution in one group.
int add_examinee (int_vector *responses, int group, double count)
 Add an examinee objec to the end of the examinee vector.
int_vectorexaminee_responses (int examineeno)
 Returns pointer to an integer vector of examinee item responses to all items.
const char * examinee_response_str (int examineeno)
 Returns string containing (character) examinee responses to all items.
int examinee_get_group (int examineeno)
 Return the number of the group the examinee belongs to.
void examinee_set_group (int examineeno, int group)
 Assigns which group the examinee belongs to.
void examinee_set_count (int examineeno, double count)
 Assigns the count (or weight) of the examinee.
double examinee_get_count (int examineeno)
 Returns the count (or weight) of the examinee.
void examinee_set_posterior (int examineeno, double_vector *posterior)
 Assigns posterior distribution of an examinee.
double_vectorexaminee_get_posterior (int examineeno)
 Returns pointer to vector of the posterior distribution of an examinee.
double examinee_posterior_mean (int examineeno)
 Returns means of an examinee's posterior distribution.
double examinee_theta_MLE (int examineeno, double minTheta, double maxTheta, double precision, int_vector *itemno5)
 Returns an examinee's maximum likelihood estimate of theta.
double examinees_count (int group)
 Returns total examinee count in an examinee group (1, 2, ...), or across all groups.
void bootstrap_seed (unsigned long seed)
 Assigns seed of random number generator used for bootstrap samples.
void bootstrap_sample ()
 Generate bootstrap sample of examinees.
void simulate_seed (unsigned long seed)
 Assigns seed of random number generator used for simulating item responses.
int_vectorsimulate_responses (double theta, int_vector *itemno2)
 Simulates item responses (integers) for a specific value of the latent variable.
const char * simulate_response_str (double theta, int_vector *itemno2)
 Simulates item responses (characters) for a specific value of the latent variable.
int_vectorget_responses (char *line, int_vector *offset, int_vector *len)
 Reads item responses from an input record.
int_vectorget_responses_missing (char *line, int_vector *offset, int_vector *len, int_vector *items)
 Read item responses from a string where responses to only some items are present. The responses to the remaining items are assumed to be missing.
void CheckRunInit ()
 Check that new_etirm has been called.
template<class V>
ItemSubset (int_vector *itemnums, V &all, const char *funcname)
 Creates a container holding the elements corresponding to a subset of items.

Variables

const double logZero = -1021.0
 Value used to represent the log of zero probabilities.
const Real invalidLogit = 10000.0
 value to indicate invalid logit (e.g., logit(1))
SwigEtirmRungEtirmRun = 0
 Global variable holding information about a run.


Typedef Documentation

typedef RealVector etirm::double_vector

Vector type for double precision values.

Definition at line 52 of file swig_etirm.h.

typedef EStepDiscrete<examinee_type, item_type, ItemVector::iterator, lvdist_type> etirm::estep_type

Class used in E-step calculation.

Definition at line 61 of file swig_etirm.h.

typedef std::vector<examinee_type *> etirm::ExamineeVector

Container holding examinee object pointers.

Definition at line 67 of file swig_etirm.h.

typedef SCPPNT::Exception etirm::Exception

Using SCPPNT exception types for exception violations.

Definition at line 112 of file etirmtypes.h.

typedef SCPPNT::Vector<int> etirm::int_vector

Vector type for integer values.

Definition at line 55 of file swig_etirm.h.

typedef SCPPNT::InvalidArgument etirm::InvalidArgument

Using SCPPNT exception types for invalid arguments.

Definition at line 106 of file etirmtypes.h.

typedef std::vector<ItemRespCounts *> etirm::ItemStatsVector

Container holding pointers to objects containing item statistics for each item.

Definition at line 155 of file swig_etirm.h.

typedef std::vector<item_type *> etirm::ItemVector

Vector type for item pointers.

Definition at line 58 of file swig_etirm.h.

typedef SCPPNT::LogicError etirm::LogicError

Using SCPPNT exception types for logical errors.

Definition at line 103 of file etirmtypes.h.

typedef std::vector<ItemParamPrior *> etirm::PriorVector

Data type to represent a vector of pointers to prior distributions.

Definition at line 126 of file ItemParamPrior.h.

typedef ETIRM_FLOAT_TYPE etirm::Real

Data type for floating point numbers.

This type is defined globally rather than being a template parameter in individual classes because it seemed unlikely that one would want different floating point types used for different ETIRM classes.

Definition at line 84 of file etirmtypes.h.

typedef SCPPNT::Matrix<Real> etirm::RealMatrix

Matrix type containing floating point numbers. Used in numeric calculations.

Definition at line 100 of file etirmtypes.h.

typedef SCPPNT::Vector<Real> etirm::RealVector

Vector type containing floating point numbers. Used in numeric calculations.

Definition at line 93 of file etirmtypes.h.

typedef ETIRM_RESPONSE_TYPE etirm::Response

Data type to hold an examinee item response.

Definition at line 87 of file etirmtypes.h.

typedef SCPPNT::RuntimeError etirm::RuntimeError

Using SCPPNT exception types for runtime errors.

Definition at line 109 of file etirmtypes.h.

typedef std::vector<Uncmin<RealVector, RealMatrix, item_type> *> etirm::UncminVector

Container to hold Uncmin optimization objects.

Definition at line 64 of file swig_etirm.h.


Enumeration Type Documentation

enum etirm::IRTModel

Enumeration for type of IRT model.

Enumerator:
OnePL  One-parameter logistic for dichotomous items.
TwoPL  Two-parameter logistic for dichotomous items.
ThreePL  Three-parameter logistic for dichotomous items.
PCM  Partial credit model for polytomous items.
GPCM  Generalized partial credit model for polytomous items.

Definition at line 115 of file etirmtypes.h.

00116   {
00117     //! One-parameter logistic for dichotomous items.
00118     OnePL,
00119     //! Two-parameter logistic for dichotomous items.
00120     TwoPL,
00121     //! Three-parameter logistic for dichotomous items.
00122     ThreePL,
00123     //! Partial credit model for polytomous items
00124     PCM,
00125     //! Generalized partial credit model for polytomous items
00126     GPCM
00127   };


Function Documentation

int etirm::add_examinee ( int_vector *  responses,
int  group,
double  count 
)

Add an examinee objec to the end of the examinee vector.

Returns the examinee number corresponding to this examinee.

Function Parameters

Parameters:
[in] *responses Pointer to vector of integer-formatted item responses. A negative integer indicates the examinee did not respond to the item. The integers representing responses are zero-offset (A response in the first response category is represented as zero).
[in] group Integer from 1 to maximum number of examinee groups giving the group the examinee belongs to.
[in] count Frequency given to response pattern (usually, count = 1).

Definition at line 1514 of file swig_etirm.cpp.

References etirm::SwigEtirmRun::CheckGroup(), CheckRunInit(), etirm::SwigEtirmRun::examineeCounts, etirm::SwigEtirmRun::examinees, gEtirmRun, etirm::SwigEtirmRun::items, etirm::SwigEtirmRun::itemStats, etirm::SwigEtirmRun::numItems, etirm::Examinee< R, P >::SetCount(), and etirm::Examinee< R, P >::SetResponses().

01515   {
01516     const char *fname = "add_examinee";
01517     CheckRunInit();
01518     gEtirmRun->CheckGroup(group, fname);
01519 
01520     int len = responses->size();
01521 
01522     if (len != gEtirmRun->numItems)
01523     {
01524       throw RuntimeError("Invalid number of item responses", fname);
01525     }
01526 
01527     examinee_type *e = new examinee_type(len, group);
01528 
01529     ResponseVector r(len);
01530     ItemVector::iterator iitem = (gEtirmRun->items).begin();
01531     int_vector::iterator iir = responses->begin();
01532     ResponseVector::iterator ir = r.begin();
01533     ItemStatsVector::iterator is = (gEtirmRun->itemStats).begin();
01534     Response np = Item<Real>::NotPresentedResponse();
01535     for (; len--; ++iitem, ++iir, ++ir, ++is)
01536     {
01537       if (*iir < 0)
01538         *ir = np;
01539       else
01540       {
01541         *ir = (*iitem)->IndexResponse(*iir);
01542         if (!((*iitem)->ValidResponse(*ir)))
01543         {
01544           throw RuntimeError("Invalid item response", fname);
01545         }
01546         (*is)->AddResponse(*iir+1, count, group);
01547       }
01548     }
01549 
01550     e->SetResponses(r);
01551     e->SetCount(count);
01552 
01553     (gEtirmRun->examinees).push_back(e);
01554 
01555     (gEtirmRun->examineeCounts)[0] += count; // total count
01556     (gEtirmRun->examineeCounts)[group] += count; // group count
01557 
01558     return (gEtirmRun->examinees).size();
01559   }

Here is the call graph for this function:

template<class I>
void etirm::AssignItemNR ( int  n,
RealVector::iterator  itemTheta,
RealVector::iterator  nVec,
RealVector::iterator  rVec,
I *  item 
) [inline]

Assigns individual examinee thetas into discrete latent variable categories and updates expected counts n and r for item M-step.

Given category values of the discrete latent variable as c_1, c_2, ..., c_ncat, classifies individual thetas into categories using ncat-1 cutpoints (c_1+c_2)/2, (c_2+c_3)/2,..., where the examinee is classified into the first category if the theta value is less than (c_1+c_2)/2, into the second category if their theta value is greater than or equal to (c_1+c_2)/2 and less than (c_2+c_3)/2, etc.

Template Parameters

Parameters:
I Item type.

Function Parameters

Parameters:
[in,out] n Number of examinees who respond to the item on input, 0 on output.
[in] itemTheta Vector of thetas for examinees who reponded to an item.
[in,out] nVec Iterator to vector of expected item response counts for each theta value?
[in,out] rVec Iterator to vector of expected number correct counts for each theta value?.
[in,out] *item Pointer to item object.

Definition at line 376 of file Start3PL.h.

00378   {
00379     int i;
00380 
00381     int ncat = item->NumLatentVarCat();
00382 
00383     if (ncat == 0)
00384       throw RuntimeError("Values of discrete latent variable categories are missing for an item",
00385           "AssignItemNR");
00386 
00387     /* Compute cutpoints for categorizing individual latent variable values */
00388     RealVector cutpoints(ncat-1);
00389     RealVector::iterator ic = cutpoints.begin();
00390     typename I::point_iterator ip = item->GetLatentVarPoints(1); // use points for first group
00391     for (i=ncat-1; i--; ++ic, ++ip)
00392     {
00393       *ic = (ip[0] + ip[1]) / 2.0;
00394     }
00395 
00396     item->InitializeNR();
00397     typename I::n_iterator in = item->NVector();
00398     typename I::r_iterator ir = item->RVector(item->CorrectResponse());
00399     for (; n--; ++itemTheta, ++nVec, ++rVec)
00400     {
00401       /* find category for theta using inefficient linear search */
00402       ic = cutpoints.begin();
00403       for (i=0; i<ncat-1; ++i, ++ic)
00404       {
00405         if (*itemTheta < *ic)
00406           break;
00407       }
00408 
00409       in[i] += *nVec;
00410       ir[i] += *rVec;
00411     }
00412   }

void etirm::bootstrap_sample (  ) 

Generate bootstrap sample of examinees.

Definition at line 1944 of file swig_etirm.cpp.

References BootstrapSample(), etirm::SwigEtirmRun::CheckExaminees(), CheckRunInit(), etirm::SwigEtirmRun::examineeCounts, etirm::SwigEtirmRun::examinees, gEtirmRun, and etirm::SwigEtirmRun::rand_boot.

01945   {
01946     CheckRunInit();
01947     gEtirmRun->CheckExaminees("bootstrap_sample");
01948 
01949     if (!gEtirmRun->rand_boot)
01950       gEtirmRun->rand_boot = new random_type();
01951 
01952     boost::uniform_int<random_type> urand(*(gEtirmRun->rand_boot), 1, (gEtirmRun->examinees).size());
01953 
01954     BootstrapSample((gEtirmRun->examinees).begin(), (gEtirmRun->examinees).end(), urand);
01955 
01956     // Set vector of examinee counts
01957     gEtirmRun->examineeCounts = 0.0; // initialize to zero
01958     ExamineeVector::iterator ie = (gEtirmRun->examinees).begin();
01959     for (int i = (gEtirmRun->examinees).size(); i--; ++ie)
01960     {
01961       double count = (*ie)->Count();
01962       (gEtirmRun->examineeCounts)[0] += count; // total count
01963       int group = (*ie)->Group();
01964       (gEtirmRun->examineeCounts)[group] += count; // group count
01965     }
01966   }

Here is the call graph for this function:

void etirm::bootstrap_seed ( unsigned long  seed  ) 

Assigns seed of random number generator used for bootstrap samples.

Function Parameters

Parameters:
[in] seed Seed value, 0 <= seed <= 4,294,967,295.

Definition at line 1923 of file swig_etirm.cpp.

References CheckRunInit(), gEtirmRun, and etirm::SwigEtirmRun::rand_boot.

01924   {
01925     CheckRunInit();
01926 
01927     // convert to type used for seed in boost random number library
01928     boost::uint32_t boost_seed = seed;
01929 
01930     if (gEtirmRun->rand_boot)
01931     {
01932       gEtirmRun->rand_boot->seed(boost_seed);
01933     }
01934     else
01935     {
01936       gEtirmRun->rand_boot = new random_type(boost_seed);
01937     }
01938   }

Here is the call graph for this function:

template<class URNG, class EI>
void etirm::BootstrapSample ( EI  examinees_begin,
EI  examinees_end,
URNG &  rand 
) [inline]

Generate a bootstrap sample for a group of examinees.

Template parameters

Parameters:
URNG Type of function object returning uniform random numbers over the integers 1 to the number of examines. An example of a type that meets the requirements for this function is the uniform_int class from the boost library (http://www.boost.org).
EI Type of iterator over pointers to examinee objects.
Arguments

Parameters:
examinees_begin Iterator to pointer to first examinee.
examinees_end - Iterator to one past pointer to last examinee.

Definition at line 48 of file BootstrapSample.h.

Referenced by bootstrap_sample().

00050   {
00051     // Number of examinees
00052     std::iterator_traits<EI>::difference_type n = std::distance(examinees_begin, examinees_end);
00053 
00054     if (rand.min() != 1 || rand.max() != n)
00055     {
00056       throw InvalidArgument("Invalid range for random number generator",
00057           "SCPPNT::BootstrapSample");
00058     }
00059 
00060     // Create vector to hold counts for each examinee from bootstrap sample - initially zero
00061     std::vector<int> counts(n, 0);
00062 
00063     // generate bootstrap counts
00064     for (int i=0; i<n; ++i)
00065     {
00066       ++counts[rand()-1];
00067     }
00068 
00069     // Assign counts to examinees
00070     for (std::vector<int>::iterator ic = counts.begin(); examinees_begin != examinees_end; ++ic,
00071         ++examinees_begin)
00072     {
00073       (*examinees_begin)->SetCount(*ic);
00074     }
00075   }

Here is the caller graph for this function:

void etirm::CheckItemParam ( item_type item,
int  index,
const char *  funcname 
)

Tests whether item parameter index is valid for the item.

Function Parameters

Parameters:
[in] *item Pointer to item object for which index is checked.
[in] index Zero-offset index of item parameter.
[in] *funcname pointer to name of calling function (used in error message).

Function Parameters

Parameters:
[in] *item Pointer to item object for which index is checked.
[in] index Zero-offset index of item parameter.
[in] *funcname pointer to name of calling function (used in error message).

Definition at line 284 of file swig_etirm.cpp.

References gEtirmRun, etirm::Item< L >::Index(), etirm::Item< L >::NumParameters(), and etirm::SwigEtirmRun::returnString.

Referenced by item_get_param(), item_get_prior_param(), item_get_prior_type(), item_set_param(), and item_set_prior().

00285   {
00286     if (item->NumParameters() <= index || index < 0)
00287     {
00288       char errstr[100];
00289       std::sprintf(errstr, "Invalid item parameter index for item %d: %d", item->Index()+1, index);
00290       gEtirmRun->returnString = errstr;
00291       throw RuntimeError((gEtirmRun->returnString).c_str(), funcname);
00292     }
00293   }

Here is the call graph for this function:

Here is the caller graph for this function:

void etirm::CheckRunInit (  ) 

Check that new_etirm has been called.

Note: This function is not defined in swig_etirm.cpp, it must be defined somewhere in the application.

Referenced by add_examinee(), bootstrap_sample(), bootstrap_seed(), etirm::estep::compute(), dist_get_point(), dist_get_points(), dist_get_prob(), dist_get_probs(), dist_mean_sd(), dist_scale(), dist_set_point(), dist_set_points(), dist_set_prob(), dist_set_probs(), dist_transform(), dist_unique_points(), etirm::estep::estep(), examinee_get_count(), examinee_get_group(), examinee_get_posterior(), examinee_posterior_mean(), examinee_response_str(), examinee_responses(), examinee_set_count(), examinee_set_group(), examinee_set_posterior(), examinee_theta_MLE(), examinees_count(), get_responses(), get_responses_missing(), item_cat_counts(), item_get_all_params(), item_get_model(), item_get_param(), item_get_params(), item_get_prior_param(), item_get_prior_type(), item_num_params(), item_num_resp_cat(), item_prob_resp(), item_resp_count(), item_scale_params(), item_set_all_params(), item_set_param(), item_set_params(), item_set_prior(), mstep_dist(), mstep_items(), mstep_max_diff(), mstep_max_iter(), mstep_message(), num_examinees(), num_groups(), num_items(), num_latent_dist_points(), simulate_response_str(), simulate_responses(), simulate_seed(), and test_characteristic_curve().

ItemParamPrior * etirm::CreatePrior ( const std::string &  pstr,
const double_vector &  priorparam,
const char *  funcname 
)

Create a prior distribution object and return a pointer to it.

Function Parameters

Parameters:
[in] pstr Type of prior distribution, valued as ("none", "normal", "lognormal", "beta").
[in] priorparam Parameters of prior distribution.
[in] funcname Name of calling function (used in error messages)

Definition at line 305 of file swig_etirm.cpp.

Referenced by item_set_prior().

00307   {
00308     const char *err_message = "Invalid number of prior parameters";
00309 
00310     if (pstr.compare("none") == 0)
00311     {
00312       return 0;
00313     }
00314     else if (pstr.compare("normal") == 0)
00315     {
00316       if (priorparam.size() != 2)
00317         throw RuntimeError(err_message, funcname);
00318       return new ItemParamPriorNormal(priorparam[0], priorparam[1]);
00319     }
00320     else if (pstr.compare("lognormal") == 0)
00321     {
00322       if (priorparam.size() != 2)
00323         throw