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 2pl specific
18
$ghk_2pl = getRK_val("ghk_2pl");
19
$iterem = getRK_val("iterem");
20
$iterqn_2pl = getRK_val("iterqn_2pl");
21
$interact = getRK_val("interact");
23
///////////////////////////////////
24
// check for selected advanced control options
27
$control[] = "iter.em=".$iterem ;
28
if($iterqn_2pl != "150")
29
$control[] = "iter.qN=".$iterqn_2pl ;
31
$control[] = "GHk=".$ghk_2pl ;
32
if($optimeth != "BFGS")
33
$control[] = "method=\"".$optimeth."\"" ;
34
if($verbose == "TRUE")
35
$control[] ="verbose=TRUE" ;
37
?>estimates.2pl <<- ltm(<? getRK("x"); ?> ~ z1<?
38
// any additional options?
39
if($interact == "TRUE") echo(" * z2");
40
if($constraint) echo(", constraint=".$constraint);
41
if($irtparam != "TRUE") echo(", IRT.param=FALSE");
42
if($startval == "random") echo(", start.val=\"random\"");
43
if($startval == "matrix") echo(", start.val=".$startval_mtx);
44
if($naaction) echo(", na.action=".$naaction);
45
// finally check if any advanced control options must be inserted
46
if($control) echo(", control=list(".join(", ", $control).")");
50
function printout () {
52
rk.header ("2PL parameter estimation")
53
rk.print (estimates.2pl)
b'\\ No newline at end of file'