def administer(self, examinee, item): model = item.get_model(0) if (examinee.num_items() < self.num): if (self.high): resp = 1 else: resp = 0 else: if (oscats.oscats_rnd_uniform() < model.P( 1, examinee.get_sim_theta(), nullCovariates)): resp = 1 else: resp = 0 examinee.add_item(item, resp) return resp
def administer(self, examinee, item): model = item.get_model(0) if examinee.num_items() < self.num: if self.high: resp = 1 else: resp = 0 else: if oscats.oscats_rnd_uniform() < model.P(1, examinee.get_sim_theta(), nullCovariates): resp = 1 else: resp = 0 examinee.add_item(item, resp) return resp
dim = contSpace.get_dim_by_name("Cont.1") out.write("%s\t%g\t" % (e.get_property("id"), tmp.get_cont(dim))) tmp = e.get_theta_by_name("trueAlpha") dim = binSpace.get_dim_by_name("Bin.1") for k in range(N_ATTR) : if tmp.get_bin(dim) : out.write("1") else : out.write("0") dim += 1 # Choose initial theta and alpha for this examinee # We'll use the same initial abilities for all four tests dim = contSpace.get_dim_by_name("Cont.1") initTheta.set_cont(dim, oscats.oscats_rnd_normal(sqrt(0.05))-0.37) dim = binSpace.get_dim_by_name("Bin.1") for k in range(N_ATTR) : initAlpha.set_bin(dim, oscats.oscats_rnd_uniform() < 0.5) ; dim += 1 # Initialize ability estimates for this examinee e.set_theta_by_name("estTheta", oscats.Point(space=contSpace)) e.set_theta_by_name("estAlpha", oscats.Point(space=binSpace)) for test in tests : # Reset initial latent ability for this test e.get_theta_by_name("estTheta").copy(initTheta) e.get_theta_by_name("estAlpha").copy(initAlpha) # Do the administration! test.administer(e) # Output the resulting theta.hat and alpha.hat tmp = e.get_theta_by_name("estTheta")
out.write("%s\t%g\t" % (e.get_property("id"), tmp.get_cont(dim))) tmp = e.get_theta_by_name("trueAlpha") dim = binSpace.get_dim_by_name("Bin.1") for k in range(N_ATTR): if tmp.get_bin(dim): out.write("1") else: out.write("0") dim += 1 # Choose initial theta and alpha for this examinee # We'll use the same initial abilities for all four tests dim = contSpace.get_dim_by_name("Cont.1") initTheta.set_cont(dim, oscats.oscats_rnd_normal(sqrt(0.05)) - 0.37) dim = binSpace.get_dim_by_name("Bin.1") for k in range(N_ATTR): initAlpha.set_bin(dim, oscats.oscats_rnd_uniform() < 0.5) dim += 1 # Initialize ability estimates for this examinee e.set_theta_by_name("estTheta", oscats.Point(space=contSpace)) e.set_theta_by_name("estAlpha", oscats.Point(space=binSpace)) for test in tests: # Reset initial latent ability for this test e.get_theta_by_name("estTheta").copy(initTheta) e.get_theta_by_name("estAlpha").copy(initAlpha) # Do the administration! test.administer(e) # Output the resulting theta.hat and alpha.hat