tristanz / OpenIRT (http://people.fas.harvard.edu/~tzajonc/openirt.html)

Bayesian and Maximum Likelihood Estimation of Item Response Theory (IRT) Models

Clone this repository (size: 589.9 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/tristanz/openirt
commit 36: 4e35255dd116
parent 35: 74f012aa90fc
branch: default
Added truncated priors to increase stability.
Tristan Zajonc / tristanz
7 months ago

Changed (Δ476 bytes):

raw changeset »

src/mcmc.h (2 lines added, 0 lines removed)

src/openirt.cpp (4 lines added, 2 lines removed)

src/openirt.h (7 lines added, 0 lines removed)

Up to file-list src/mcmc.h:

@@ -1047,6 +1047,7 @@ public:
1047
1047
	  // Find the log density at the initial point.
1048
1048
    double x0 = parameter_.Value();
1049
1049
    double gx0 = parameter_.LogDensity(x0);
1050
	 	//cout << parameter_.Label() << " : " << x0 << " = " << gx0 << endl;
1050
1051
1051
1052
    // Determine slice level, in log terms
1052
1053
    double logy = gx0 - myrng.rexp(1);
@@ -1183,6 +1184,7 @@ public:
1183
1184
	     for(int iter = 0; iter < number_of_iterations; ++iter) {
1184
1185
	       cout << "Iteration " << iter << endl;
1185
1186
				 for(int i = 0; i < steps_.size(); ++i) {
1187
					 //cout << "Step " << i << endl;
1186
1188
	         steps_[i].DoStep();
1187
1189
	       }
1188
1190
	       //++show_progress;

Up to file-list src/openirt.cpp:

@@ -62,10 +62,12 @@ int main(int argc, char* argv[]) {
62
62
				B2PLParameter b(true, "b"+to_string<int>(items.id(j)), j);
63
63
				sampler.AddStep(new SliceStep<B2PLParameter>(b, 1, -dInf, dInf));
64
64
			} else if (items.type(j) == TYPE_3PL) {
65
				// cout << items.id(j) << endl;
66
				// Temporarily put some limits on these.  Discrete priors.
65
67
				A3PLParameter a(true, "a"+to_string<int>(items.id(j)), j);
66
				sampler.AddStep(new SliceStep<A3PLParameter>(a, 1, 0, dInf));
68
				sampler.AddStep(new SliceStep<A3PLParameter>(a, 1, 0, 10));
67
69
				B3PLParameter b(true, "b"+to_string<int>(items.id(j)), j);
68
				sampler.AddStep(new SliceStep<B3PLParameter>(b, 1, -dInf, dInf));
70
				sampler.AddStep(new SliceStep<B3PLParameter>(b, 1, -10, 10));
69
71
				C3PLParameter c(true, "c"+to_string<int>(items.id(j)), j);
70
72
				sampler.AddStep(new SliceStep<C3PLParameter>(c, 1, 0, 1));
71
73
			}

Up to file-list src/openirt.h:

@@ -101,6 +101,13 @@ void StartUp(int argc, char* argv[]) {
101
101
  responses.num_groups = max(responses.group);
102
102
  cout << "Responses added: " << responses.num_responses << endl;
103
103
  std::cout << "Max int limit: " << std::numeric_limits<int>::max() << std::endl;
104
105
	//   cout << "Items ID:" << endl << items.id << endl;
106
	//   cout << "Items Type:" << endl << items.type << endl;
107
	//   cout << "Items a:" << endl << items.a << endl;
108
	//   cout << "Items b:" << endl << items.b << endl;
109
	// cout << "Items c:" << endl << items.c << endl;
110
104
111
}
105
112
106
113
/// 2PL Item Response Functions