~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/plugins/plots/irt/tests/eRm_plotLR.php

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-05-11 21:58:23 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090511215823-m2f3gehcvapwrzgp
Tags: 0.5.0d-0ubuntu1
* New upstream release (LP: #375213)
* Bump Standards-Version to 3.8.1
* Drop cmake, libphon-dev from build-deps
* Update maintainer field

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?
 
2
function preprocess () {
 
3
  // we'll need the eRm package, so in case it's not loaded...
 
4
?>
 
5
  require(eRm)
 
6
<?}
 
7
 
 
8
function calculate () {
 
9
}
 
10
 
 
11
function printout () {
 
12
        doPrintout (true);
 
13
}
 
14
 
 
15
function preview () {
 
16
        preprocess ();
 
17
        calculate ();
 
18
        doPrintout (false);
 
19
}
 
20
 
 
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
 
24
        // be generated.
 
25
 
 
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");
 
38
 
 
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");
 
45
 
 
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() ;
 
51
  // plot all items?
 
52
  if($inp_items) {
 
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";
 
62
  if($chk_se == "se")
 
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)";
 
67
    else
 
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\")";
 
72
    else
 
73
      $options_plotgof[] = "ctrline=list()"; }
 
74
 
 
75
/*
 
76
  if($ == "")
 
77
    $options[] = "=list(\"$\")" ;
 
78
*/
 
79
 
 
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\"" ;
 
87
 
 
88
        if ($final) { ?>
 
89
rk.header("Andersen's LR test")
 
90
 
 
91
rk.graph.on()
 
92
<?       }
 
93
        // only the following section will be generated for $final==false
 
94
 
 
95
        ?>
 
96
lr.res <- LRtest(<? getRK("x");
 
97
              if($options_lrtest) echo(", ".join(", ", $options_lrtest));
 
98
          ?>)
 
99
try(plotGOF(lr.res<?
 
100
              if($options_plotgof) echo(", ".join(", ", $options_plotgof));
 
101
              if($plot_options) echo($plot_options);
 
102
          ?>))
 
103
<?
 
104
        if ($final) { ?>
 
105
rk.graph.off()
 
106
<? }
 
107
}
 
108
?>
 
 
b'\\ No newline at end of file'