2
function preprocess () {
3
// we'll need the ltm package, so in case it's not loaded...
8
function calculate () {
9
// let's read all values into php variables for the sake of readable code
10
$constraint = getRK_val("constraint");
11
$startval = getRK_val("startval");
12
$startval_mtx = getRK_val("startval_mtx");
13
$naaction = getRK_val("naaction");
14
$irtparam = getRK_val("irtparam");
15
$optimeth = getRK_val("optimeth");
16
$verbose = getRK_val("verbose");
17
// these are 3pl specific
18
$ghk_3pl = getRK_val("ghk_3pl");
19
$iterqn_3pl = getRK_val("iterqn_3pl");
20
$type = getRK_val("type");
21
$maxguess = getRK_val("maxguess");
22
$optimizer = getRK_val("optimizer");
23
$epshess = getRK_val("epshess");
24
// $parscale = getRK_val("parscale"); not implemented yet...
26
///////////////////////////////////
27
// check for selected advanced control options
29
if($optimizer != "optim")
30
$control[] = "optimizer=\"nlminb\"" ;
31
if($iterqn_3pl != "1000")
32
$control[] = "iter.qN=".$iterqn_3pl ;
34
$control[] = "GHk=".$ghk_3pl ;
35
if($optimizer == "optim" && $optimeth != "BFGS")
36
$control[] = "method=\"".$optimeth."\"" ;
37
if($verbose == "TRUE")
38
$control[] = "verbose=TRUE" ;
39
if($epshess != "1e-03")
40
$control[] = "eps.hessian=".$epshess ;
42
?>estimates.3pl <<- tpm(<? getRK("x");
43
// any additional options?
44
if($type == "rasch") echo(", type=\"rasch\"");
45
if($constraint) echo(", constraint=".$constraint);
46
if($maxguess != "1") echo(", max.guessing=".$maxguess);
47
if($irtparam != "TRUE") echo(", IRT.param=FALSE");
48
if($startval == "random") echo(", start.val=\"random\"");
49
if($startval == "matrix") echo(", start.val=".$startval_mtx);
50
if($naaction) echo(", na.action=".$naaction);
51
// finally check if any advanced control options must be inserted
52
if($control) echo(", control=list(".join(", ", $control).")");
56
function printout () {
58
rk.header ("3PL parameter estimation")
59
rk.print (estimates.3pl)
b'\\ No newline at end of file'