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
$rad_splitcr = getRK_val("rad_splitcr");
28
$splitvector = getRK_val("splitvector");
29
$inp_items = getRK_val("inp_items");
30
$chk_se = getRK_val("chk_se");
31
$chk_confint = getRK_val("chk_confint");
32
$spin_confint = getRK_val("spin_confint");
33
$chk_ctrline = getRK_val("chk_ctrline");
34
$spin_ctrline = getRK_val("spin_ctrline");
35
$spin_abilfrom = getRK_val("spin_abilfrom");
36
$spin_abilto = getRK_val("spin_abilto");
37
$annotation = getRK_val("annotation");
39
// in case there are generic plot options defined:
40
$plot_options = getRK_val("plotoptions.code.printout");
41
$plot_ops_main = getRK_val("plotoptions.main");
42
$plot_ops_type = getRK_val("plotoptions.pointtype");
43
$plot_ops_xlab = getRK_val("plotoptions.xlab");
44
$plot_ops_ylab = getRK_val("plotoptions.ylab");
46
///////////////////////////////////
47
// check for selected options
48
// these two arrays will contain the options for the two functions that will be called:
49
$options_lrtest = array() ;
50
$options_plotgof = array() ;
53
// for user convenience, we replace "-", ";" and space, split all input into an array
54
// and join it again, separated by commas:
55
$inp_items = str_replace("-",":",$inp_items);
56
$arr_items = split('[ ;]', $inp_items);
57
$options_plotgof[] = "beta.subset=c(".join(",", $arr_items).")"; }
58
if($rad_splitcr == "mean" || $rad_splitcr == "all.r")
59
$options_lrtest[] = "splitcr=\"$rad_splitcr\"";
60
if($rad_splitcr == "vector")
61
$options_lrtest[] = "splitcr=$splitvector";
63
$options_lrtest[] = "se=TRUE";
64
if($chk_confint == "conf") {
65
if($spin_confint != "0.95")
66
$options_plotgof[] = "conf=list(gamma=".round($spin_confint,2).", col=\"red\", lty=\"dashed\", ia=FALSE)";
68
$options_plotgof[] = "conf=list()"; }
69
if($chk_ctrline == "ctrline") {
70
if($spin_ctrline != "0.95")
71
$options_plotgof[] = "ctrline=list(gamma=".round($spin_ctrline,2).", col=\"blue\", lty=\"solid\")";
73
$options_plotgof[] = "ctrline=list()"; }
77
$options[] = "=list(\"$\")" ;
80
// more advanced options
81
// user defined ranges? we'll round it to two digits
82
if(($spin_abilfrom != "-3" || $spin_abilto != "3") && $spin_abilfrom < $spin_abilto)
83
$options_plotgof[] = "xlim=c(".round($spin_abilfrom,2).",".round($spin_abilto,2).")" ;
84
// annotate lines and show legend?
85
if($annotation == "number" || $annotation == "none" || $annotation == "identify")
86
$options_plotgof[] = "tlab=\"$annotation\"" ;
89
rk.header("Andersen's LR test")
93
// only the following section will be generated for $final==false
96
lr.res <- LRtest(<? getRK("x");
97
if($options_lrtest) echo(", ".join(", ", $options_lrtest));
100
if($options_plotgof) echo(", ".join(", ", $options_plotgof));
101
if($plot_options) echo($plot_options);
b'\\ No newline at end of file'