function gen_examinees($space) { global $N_EXAMINEES; $dim = $space->get_dim_by_name("Cont.1"); $ret = array(); for ($i = 0; $i < $N_EXAMINEES; $i++) { # Latent IRT ability parameter. This is a one-dimensional test. $theta = new OscatsPoint('OscatsPoint', array("space" => $space)); # Sample the ability from N(0,1) distribution $theta->set_cont($dim, Oscats::rnd_normal(1)); # Create a new examinee $e = new OscatsExaminee(); # Set the examinee's true (simulated) ability $e->set_sim_theta($theta); $ret[] = $e; } return $ret; }
$alg->register($test); $alg = new OscatsAlgEstimate(); $alg->register($test); $alg = new OscatsAlgFixedLength('OscatsAlgFixedLength', array("len" => $LEN)); $alg->register($test); } # Here we register the item selection criteria for the different tests $alg = new OscatsAlgMaxFisher('OscatsAlgMaxFisher', array("A_opt" => True, "num" => 5)); $alg->register($tests[0]); $alg = new OscatsAlgMaxFisher('OscatsAlgMaxFisher', array("num" => 5)); $alg->register($tests[1]); $alg = new OscatsAlgMaxKl('OscatsAlgMaxKl', array("num" => 5)); $alg->register($tests[2]); # In Example 1, we created OscatsExaminee objects for each examinee. # Here, we'll just use one object over again for each administration. $e = new OscatsExaminee('OscatsExaminee', array("covariates" => $covariate)); $sim_theta = new OscatsPoint('OscatsPoint', array("space" => $space)); $est_theta = new OscatsPoint('OscatsPoint', array("space" => $space)); $e->set_sim_theta($sim_theta); $e->set_est_theta($est_theta); print "Administering.\n"; for ($I = 0; $I < count($grid); $I++) { $sim_theta->set_cont($dims[0], $grid[$I]); for ($J = 0; $J < count($grid); $J++) { print sprintf("\rAt grid point (%g, %g) ...\n", $grid[$I], $grid[$J]); $sim_theta->set_cont($dims[1], $grid[$J]); for ($i = 0; $i < $N_EXAMINEES; $i++) { # "covariate" is the same OscatsCovariates object used by "e" $covariate->set_by_name($COVARIATE_NAME, Oscats::rnd_normal(1)); print sprintf("\r%d", i); flush();