2
function preprocess () {
3
// we'll need the eRm package, so in case it's not loaded...
8
function calculate () {
11
function printout () {
21
function doPrintout ($final) {
22
// this function takes care of generating the code for the printout() section. If $final is set to true,
23
// it generates the full code, including headers. If $final is set to false, only the essentials will
26
// let's read all values into php variables for the sake of readable code
27
$inp_items = getRK_val("inp_items");
28
$spin_abilfrom = getRK_val("spin_abilfrom");
29
$spin_abilto = getRK_val("spin_abilto");
30
$spin_probfrom = getRK_val("spin_probfrom");
31
$spin_probto = getRK_val("spin_probto");
32
$annotation = getRK_val("annotation");
33
$chk_ask = getRK_val("chk_ask");
34
$chk_mplot = getRK_val("chk_mplot");
36
// in case there are generic plot options defined:
37
$plot_options = getRK_val("plotoptions.code.printout");
38
$plot_ops_main = getRK_val("plotoptions.main");
39
$plot_ops_type = getRK_val("plotoptions.pointtype");
40
$plot_ops_xlab = getRK_val("plotoptions.xlab");
41
$plot_ops_ylab = getRK_val("plotoptions.ylab");
43
///////////////////////////////////
44
// check for selected options
48
// for user convenience, we replace "-", ";" and space, split all input into an array
49
// and join it again, separated by commas:
50
$inp_items = str_replace("-",":",$inp_items);
51
$arr_items = split('[ ;]', $inp_items);
52
$options[] = "item.subset=c(".join(",", $arr_items).")"; }
53
if($chk_mplot == "mplot")
54
$options[] = "mplot=TRUE" ;
56
$options[] = "ask=FALSE" ;
58
// more advanced options
59
// user defined ranges? we'll round it to two digits
60
if(($spin_abilfrom != "-4" || $spin_abilto != "4") && $spin_abilfrom < $spin_abilto)
61
$options[] = "xlim=c(".round($spin_abilfrom,2).",".round($spin_abilto,2).")" ;
62
if(($spin_probfrom != "0" || $spin_probto != "1") && $spin_probfrom < $spin_probto)
63
$options[] = "ylim=c(".round($spin_probfrom,2).",".round($spin_probto,2).")" ;
64
// annotate lines and show legend?
65
if($annotation == "plain")
66
$options[] = "legpos=FALSE" ;
69
rk.header("Partial credit model plot")
73
// only the following section will be generated for $final==false
76
try(plotICC(<? getRK("x");
77
if($options) echo(", ".join(", ", $options));
78
if($plot_options) echo($plot_options);
b'\\ No newline at end of file'