[rkward-cvs] SF.net SVN: rkward:[2382] branches/release_branch_0.4.9/rkward/plugins/ plots/irt
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Mon Nov 17 23:22:25 UTC 2008
Revision: 2382
http://rkward.svn.sourceforge.net/rkward/?rev=2382&view=rev
Author: sjar
Date: 2008-11-17 23:22:24 +0000 (Mon, 17 Nov 2008)
Log Message:
-----------
* experimental software
* plot plug-ins for irt by meik michalke
* still under development, thus in own folder for easier maintenance (folder hierarchy will be flatted later)
Added Paths:
-----------
branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/
branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.php
branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.xml
Added: branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.php
===================================================================
--- branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.php (rev 0)
+++ branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.php 2008-11-17 23:22:24 UTC (rev 2382)
@@ -0,0 +1,108 @@
+<?
+function preprocess () {
+ // we'll need the eRm package, so in case it's not loaded...
+?>
+ require(eRm)
+<?}
+
+function calculate () {
+}
+
+function printout () {
+ doPrintout (true);
+}
+
+function preview () {
+ preprocess ();
+ calculate ();
+ doPrintout (false);
+}
+
+function doPrintout ($final) {
+ // this function takes care of generating the code for the printout() section. If $final is set to true,
+ // it generates the full code, including headers. If $final is set to false, only the essentials will
+ // be generated.
+
+ // let's read all values into php variables for the sake of readable code
+ $rad_splitcr = getRK_val("rad_splitcr");
+ $splitvector = getRK_val("splitvector");
+ $inp_items = getRK_val("inp_items");
+ $chk_se = getRK_val("chk_se");
+ $chk_confint = getRK_val("chk_confint");
+ $spin_confint = getRK_val("spin_confint");
+ $chk_ctrline = getRK_val("chk_ctrline");
+ $spin_ctrline = getRK_val("spin_ctrline");
+ $spin_abilfrom = getRK_val("spin_abilfrom");
+ $spin_abilto = getRK_val("spin_abilto");
+ $annotation = getRK_val("annotation");
+
+ // in case there are generic plot options defined:
+ $plot_options = getRK_val("plotoptions.code.printout");
+ $plot_ops_main = getRK_val("plotoptions.main");
+ $plot_ops_type = getRK_val("plotoptions.pointtype");
+ $plot_ops_xlab = getRK_val("plotoptions.xlab");
+ $plot_ops_ylab = getRK_val("plotoptions.ylab");
+
+ ///////////////////////////////////
+ // check for selected options
+ // these two arrays will contain the options for the two functions that will be called:
+ $options_lrtest = array() ;
+ $options_plotgof = array() ;
+ // plot all items?
+ if($inp_items) {
+ // for user convenience, we replace "-", ";" and space, split all input into an array
+ // and join it again, separated by commas:
+ $inp_items = str_replace("-",":",$inp_items);
+ $arr_items = split('[ ;]', $inp_items);
+ $options_plotgof[] = "beta.subset=c(".join(",", $arr_items).")"; }
+ if($rad_splitcr == "mean" || $rad_splitcr == "all.r")
+ $options_lrtest[] = "splitcr=\"$rad_splitcr\"";
+ if($rad_splitcr == "vector")
+ $options_lrtest[] = "splitcr=$splitvector";
+ if($chk_se == "se")
+ $options_lrtest[] = "se=TRUE";
+ if($chk_confint == "conf") {
+ if($spin_confint != "0.95")
+ $options_plotgof[] = "conf=list(gamma=".round($spin_confint,2).", col=\"red\", lty=\"dashed\", ia=FALSE)";
+ else
+ $options_plotgof[] = "conf=list()"; }
+ if($chk_ctrline == "ctrline") {
+ if($spin_ctrline != "0.95")
+ $options_plotgof[] = "ctrline=list(gamma=".round($spin_ctrline,2).", col=\"blue\", lty=\"solid\")";
+ else
+ $options_plotgof[] = "ctrline=list()"; }
+
+/*
+ if($ == "")
+ $options[] = "=list(\"$\")" ;
+*/
+
+ // more advanced options
+ // user defined ranges? we'll round it to two digits
+ if(($spin_abilfrom != "-3" || $spin_abilto != "3") && $spin_abilfrom < $spin_abilto)
+ $options_plotgof[] = "xlim=c(".round($spin_abilfrom,2).",".round($spin_abilto,2).")" ;
+ // annotate lines and show legend?
+ if($annotation == "number" || $annotation == "none" || $annotation == "identify")
+ $options_plotgof[] = "tlab=\"$annotation\"" ;
+
+ if ($final) { ?>
+rk.header("Andersen's LR test")
+
+rk.graph.on()
+<? }
+ // only the following section will be generated for $final==false
+
+ ?>
+lr.res <- LRtest(<? getRK("x");
+ if($options_lrtest) echo(", ".join(", ", $options_lrtest));
+ ?>)
+try(plotGOF(lr.res<?
+ if($options_plotgof) echo(", ".join(", ", $options_plotgof));
+ if($plot_options) echo($plot_options);
+ ?>))
+<?
+ if ($final) { ?>
+rk.graph.off()
+<? }
+}
+?>
\ No newline at end of file
Added: branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.xml
===================================================================
--- branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.xml (rev 0)
+++ branches/release_branch_0.4.9/rkward/plugins/plots/irt/tests/eRm_plotLR.xml 2008-11-17 23:22:24 UTC (rev 2382)
@@ -0,0 +1,74 @@
+<!DOCTYPE rkplugin>
+<document>
+ <code file="eRm_plotLR.php" />
+ <!-- <help file="eRm_plotLR.rkh" /> -->
+
+ <logic>
+ <convert id="split_vec" mode="equals" sources="rad_splitcr.string" standard="vector" />
+ <convert id="logic_conf" mode="and" sources="chk_se.state;chk_se.enabled" />
+
+ <connect client="splitvector.enabled" governor="split_vec" />
+ <connect client="splitvector.required" governor="split_vec" />
+ <connect client="chk_confint.enabled" governor="logic_conf" />
+ <connect client="spin_confint.enabled" governor="logic_conf" />
+ <connect client="chk_ctrline.enabled" governor="logic_conf" />
+ <connect client="spin_ctrline.enabled" governor="logic_conf" />
+ </logic>
+
+ <dialog label="Andersen LR-Test">
+ <tabbook>
+ <tab id="tab_variables" label="Model">
+ <row id="row_vars">
+ <varselector id="vars" />
+ <column>
+ <varslot type="numeric" id="x" classes="Rm" source="vars" required="true" label="Choose fitted model to test (plot):"/>
+ <text>Only objects of class Rm are valid!</text>
+ <stretch />
+ <radio id="rad_splitcr" label="Split criterion for subject raw scores">
+ <option label="Median" value="median" checked="true" />
+ <option label="Mean" value="mean" />
+ <option label="Full raw score split" value="all.r" />
+ <option label="Use vector to define groups" value="vector" />
+ </radio>
+ <varslot type="numeric" id="splitvector" source="vars" label="Select grouping vector:"/>
+ <text>Can be numeric, character or a factor</text>
+ <preview id="preview"/>
+ </column>
+ </row>
+ </tab>
+ <tab id="tab_type" label="Plot options">
+ <column id="col_type">
+ <frame id="frame_items" label="Optional item selection">
+ <input id="inp_items" label="List of items (plot all if empty)" />
+ </frame>
+ <frame id="frame_items" label="Confidence intervals">
+ <checkbox id="chk_se" label="Compute standard errors" value="se" value_unchecked="0" />
+ <row>
+ <checkbox id="chk_confint" label="Confidence intervals" value="conf" />
+ <spinbox id="spin_confint" label="Confidence level:" type="real" initial="0.95" min="0" max="1" size="small" />
+ </row>
+ <row>
+ <checkbox id="chk_ctrline" label="Confidence bands" value="ctrline" />
+ <spinbox id="spin_ctrline" label="Confidence level:" type="real" initial="0.95" min="0" max="1" size="small" />
+ </row>
+ </frame>
+ <frame label="Range of person parameters">
+ <row>
+ <spinbox id="spin_abilfrom" label="From:" type="real" initial="-3" size="small" />
+ <spinbox id="spin_abilto" label="To:" type="real" initial="3" size="small" />
+ </row>
+ </frame>
+ <stretch />
+ <radio id="annotation" label="Annotation">
+ <option label="Annotate items (item names)" value="items" checked="true" />
+ <option label="Annotate items (rank number of betas)" value="number" />
+ <option label="Plain dots, no annotation" value="none" />
+ <option label="Interactive labeling" value="identify" />
+ </radio>
+ <stretch />
+ <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Generic plot options" />
+ </column>
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list