C:/programs/etirm/src/swig_etirm.cpp File Reference

Definitions of functions and classes to generate scripting language wrapper functions for ETIRM using SWIG. More...

#include "etirm/swig_etirm.h"
#include "etirm/MStepIRT.h"
#include "etirm/DiscreteNormalDist.h"
#include "etirm/ItemParamPriorBeta4.h"
#include "etirm/ItemParamPriorLogNormal.h"
#include "etirm/ItemParamPriorNormal.h"
#include "etirm/BootstrapSample.h"
#include "etirm/SimulateResponses.h"
#include "etirm/ExamineeThetaMLE.h"
#include <boost/random/uniform_int.hpp>
#include <cstdio>

Include dependency graph for swig_etirm.cpp:

Go to the source code of this file.

Namespaces

namespace  etirm

Functions

void etirm::CheckItemParam (item_type *item, int index, const char *funcname)
 Tests whether item parameter index is valid for the item.
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.
char etirm::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 etirm::set_missing_resp (char nr)
 Assigns missing response code to identify examinees who did not respond to an item.
int etirm::num_items ()
 Returns the number of items.
int etirm::num_latent_dist_points ()
 Returns number of categories of the discrete theta distribution.
int etirm::num_groups ()
 Returns number of examinee groups.
int etirm::num_examinees ()
 Returns number of examinees.
const char * etirm::item_get_model (int itemno)
 Returns the name of model used for an item.
void etirm::item_set_param (int paramno, int itemno, double paramvalue)
 Assigns a value to one item parameter of an item.
void etirm::item_set_params (int itemno, double_vector *params)
 Assigns values to all item parameters of an item.
void etirm::item_set_all_params (int itemno, double_vector *params)
 Assigns values to all fixed and estimated item parameters of an item.
double etirm::item_get_param (int paramno, int itemno)
 Returns value of one item parameter of an item.
double_vector * etirm::item_get_params (int itemno)
 Returns vector of all estimated item parameters values of an item.
double_vector * etirm::item_get_all_params (int itemno)
 Returns vector of all fixed and estimated item parameters values of an item.
int etirm::item_num_params (int itemno)
 Returns the number of parameters of an item.
int etirm::item_num_resp_cat (int itemno)
 Returns the number of response categories of an item.
void etirm::item_set_prior (int paramno, int itemno, char *priortype, double_vector *dlist)
 Assigns prior distribution parameters for one item parameter.
const char * etirm::item_get_prior_type (int paramno, int itemno)
 Returns type of prior distribution ("normal", "lognormal", "beta", "none") for one item parameter.
double_vector * etirm::item_get_prior_param (int paramno, int itemno)
 Returns vector of prior distribution parameters for one item parameter.
double_vector * etirm::item_cat_counts (int itemno, int group)
 Returns vector of response counts in each response category of an item.
double etirm::item_resp_count (int itemno, int group)
 Returns the number of examinees responding to an item.
int etirm::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 etirm::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_vector * etirm::test_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 etirm::dist_set_points (double_vector *dlist, int group)
 Assigns quadrature point values to each discrete category of the discrete latent variable distribution.
void etirm::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_vector * etirm::dist_get_points (int group)
 Returns vector of quadrature point values of the discrete latent variable distribution.
double etirm::dist_get_point (int index, int group)
 Returns the quadrature point value of one discrete category of the discrete latent variable distribution.
void etirm::dist_set_probs (double_vector *dlist, int group)
 Assigns quadrature weights to the quadrature points of the latent variable distribution.
void etirm::dist_set_prob (int index, double w, int group)
 Assigns the quadrature weight to one discrete category of the discrete latent variable distribution.
double_vector * etirm::dist_get_probs (int group)
 Returns vector of quadrature weights of the latent variable distribution for one group of examinees.
double etirm::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 etirm::dist_transform (double slope, double intercept)
 Transforms the quadrature points of latent variable distribution to a new scale.
double_vector * etirm::dist_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_vector * etirm::dist_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 etirm::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_vector * etirm::normal_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_vector * etirm::normal_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 etirm::mstep_items (bool ignore_max_iter, int_vector *itemno)
 CalculateS M-step for a set of items.
int etirm::mstep_message (int itemno)
 Returns message from M-step minimization for one item.
void etirm::mstep_max_iter (int itemno, int maxiter)
 Assigns the maximum number of iterations permitted with optimization procedure in mstep_items for one item.
double etirm::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 etirm::mstep_dist (estep *e, int group)
 Executes M-step for the latent distribution in one group.
int etirm::add_examinee (int_vector *responses, int group, double count)
 Add an examinee objec to the end of the examinee vector.
int_vector * etirm::examinee_responses (int examineeno)
 Returns pointer to an integer vector of examinee item responses to all items.
const char * etirm::examinee_response_str (int examineeno)
 Returns string containing (character) examinee responses to all items.
int etirm::examinee_get_group (int examineeno)
 Return the number of the group the examinee belongs to.
void etirm::examinee_set_group (int examineeno, int group)
 Assigns which group the examinee belongs to.
void etirm::examinee_set_count (int examineeno, double count)
 Assigns the count (or weight) of the examinee.
double etirm::examinee_get_count (int examineeno)
 Returns the count (or weight) of the examinee.
void etirm::examinee_set_posterior (int examineeno, double_vector *posterior)
 Assigns posterior distribution of an examinee.
double_vector * etirm::examinee_get_posterior (int examineeno)
 Returns pointer to vector of the posterior distribution of an examinee.
double etirm::examinee_posterior_mean (int examineeno)
 Returns means of an examinee's posterior distribution.
double etirm::examinee_theta_MLE (int examineeno, double minTheta, double maxTheta, double precision, int_vector *itemno5)
 Returns an examinee's maximum likelihood estimate of theta.
double etirm::examinees_count (int group)
 Returns total examinee count in an examinee group (1, 2, ...), or across all groups.
void etirm::bootstrap_seed (unsigned long seed)
 Assigns seed of random number generator used for bootstrap samples.
void etirm::bootstrap_sample ()
 Generate bootstrap sample of examinees.
void etirm::simulate_seed (unsigned long seed)
 Assigns seed of random number generator used for simulating item responses.
int_vector * etirm::simulate_responses (double theta, int_vector *itemno2)
 Simulates item responses (integers) for a specific value of the latent variable.
const char * etirm::simulate_response_str (double theta, int_vector *itemno2)
 Simulates item responses (characters) for a specific value of the latent variable.
int_vector * etirm::get_responses (char *line, int_vector *offset, int_vector *len)
 Reads item responses from an input record.
int_vector * etirm::get_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.

Variables

SwigEtirmRun * etirm::gEtirmRun = 0
 Global variable holding information about a run.


Detailed Description

Definitions of functions and classes to generate scripting language wrapper functions for ETIRM using SWIG.

The file swig_etirm_types.h (which is included in swig_etirm.h) must be provided which should contain typedef's for the following types:

ResponseVector Vector containing item responses. item_type Item class. examinee_type Examinee class. lvdist_type Latent variable distribution class. random_type Type of random number generator used for bootstrap.

For example:

Do not process with SWIG, SWIG cannot handle the template arguments xx_ifndef SWIG

Vector of item responses typedef std::vector<etirm::Response> ResponseVector;

Class to hold information about discrete latent variable distribution typedef etirm::DiscreteLatentDist<etirm::Real> lvdist_type;

Class to hold information about examinees typedef etirm::ExamineeGrpCov<ResponseVector, etirm::RealVector> examinee_type;

Type used for array of items. Using ItemNR allows different items to be modeled by different classes descendent from ItemNR (e.g., the 3PL model could be used for some items, and the 2PL model used for other items). typedef etirm::ItemNR<lvdist_type> item_type;

Use the Mersenne Twister (http://www.math.keio.ac.jp/matumoto/emt.html) from the Boost random number library (http://www.boost.org/libs/random/index.html) as random number generator for bootstrap samples. typedef boost::mt19937 random_type;

xx_endif // SWIG

An application using these wrapper functions should declare a subclass of SwigEtirmRun whose constructor initializes the item object pointers, and assigns them to the 'items' data member of SwigEtirmRun. An application should provide functions for creating and deleting an object that is a subclass of SwigEtirmRun which is stored in the global variable gEtirmRun defined in this file.

Definitions of the function CheckRunInit must be provided. This function is declared in swig_etirm.h, but each application must define it. It is not defined in swig_etirm.cpp.

The function CheckRunInit checks whether gEtirmRun has been initialized, and if not throws an exception. The message contained in the exception will differ for different applications.

Estimation Toolkit for Item Response Models (ETIRM) http://www.smallwaters.com/software/cpp/etirm.html

Author(s): Werner Wothke, maintenance (http://www.smallwaters.com) Brad Hanson (http://www.b-a-h.com/) See the file LICENSE for information on usage and redistribution.

Copyright (C) 2008, Werner Wothke Copyright (c) 2000-2002, Bradley A. Hanson

Definition in file swig_etirm.cpp.


Generated on Sat Mar 1 21:40:31 2008 for ETIRM by  doxygen 1.5.4