[rkward-cvs] SF.net SVN: rkward: [1733] trunk/rkward/rkward/plugins/analysis/TESTS
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Mar 26 17:51:33 UTC 2007
Revision: 1733
http://svn.sourceforge.net/rkward/?rev=1733&view=rev
Author: tfry
Date: 2007-03-26 10:51:33 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Modifications to PP test:
* Add options length and narm for consistency
* The truncation lag short/long is finally a good example of a two choices option that works best as a radio, not checkbox
* local() adjustments
Modified Paths:
--------------
trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.php
trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.rkh
trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.xml
Modified: trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.php 2007-03-26 17:25:09 UTC (rev 1732)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.php 2007-03-26 17:51:33 UTC (rev 1733)
@@ -1,42 +1,40 @@
<?
- function preprocess () {
- }
+function preprocess () {
+}
- function calculate () {
+function calculate () {
$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
?>
-require(outliers)
+objects <- list (<? echo ($vars); ?>)
+results <- data.frame ('Variable Name'=rep (NA, length (objects)), check.names=FALSE)
+for (i in 1:length (objects)) {
+ results[i, 'Variable Name'] <- rk.get.description (objects[[i]], is.substitute=TRUE)
+ var <- eval (objects[[i]], envir=globalenv ())
+<? if (getRK_val ("length")) { ?>
+ results[i, 'Length'] <- length (var)
+ results[i, 'NAs'] <- sum (is.na(var))
-rk.temp.objects <- list (<? echo ($vars); ?>)
-rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.objects)), check.names=FALSE)
-local ({
- i=0;
- for (var in rk.temp.objects) {
- i = i+1
- rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
- try ({
- rk.temp.t <- PP.test (eval (var), lshort = <? getRK ("lshort"); ?>)
- rk.temp.results$'Dickey-Fuller'[i] <<- rk.temp.t$statistic
- rk.temp.results$'Truncation lag parameter'[i] <<- rk.temp.t$parameter
- rk.temp.results$'p-value'[i] <<- rk.temp.t$p.value
- })
- }
-})
+<? }
+ if (getRK_val ("narm")) { ?>
+ var <- var[!is.na (var)] # remove NAs
+<? } ?>
+ try ({
+ test <- PP.test (var, lshort = <? getRK ("lshort"); ?>)
+ results[i, 'Dickey-Fuller'] <- test$statistic
+ results[i, 'Truncation lag parameter'] <- test$parameter
+ results[i, 'p-value'] <- test$p.value
+ })
+}
<?
- }
+}
function printout () {
?>
rk.header ("Phillips-Perron Test for Unit Roots",
parameters=list ("Truncation lag parameter short ('TRUE') or long ('FALSE')", "<? getRK ("lshort"); ?>"))
-rk.results (rk.temp.results)
-<?
-}
-function cleanup () {
-?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
+rk.results (results)
<?
}
?>
Modified: trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.rkh 2007-03-26 17:25:09 UTC (rev 1732)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.rkh 2007-03-26 17:51:33 UTC (rev 1733)
@@ -11,12 +11,14 @@
<settings>
<caption id="tab_variables"/>
<setting id="x">Select the data to be computed. The vectors need to be numeric, and can be of different length.</setting>
- <setting id="lshort">If checked (TRUE), the short version of the truncation lag parameter is used otherwise the long (FALSE).</setting>
+ <setting id="lshort">Which version of the truncation lag parameter should be used?</setting>
+ <caption id="tab_options"/>
+ <setting id="narm">Exclude missing values from calculation?</setting>
+ <setting id="length">Show the total length of the data, and the number of missing values (purely informational, does not affect the test)?</setting>
</settings>
<related>
<ul>
<li><link href="rkward://rhelp/PP.test"/></li>
</ul>
-
</related>
</document>
Modified: trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.xml 2007-03-26 17:25:09 UTC (rev 1732)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/PP_test.xml 2007-03-26 17:51:33 UTC (rev 1733)
@@ -12,10 +12,18 @@
<varselector id="vars"/>
<column>
<varslot type="numeric" id="x" multi="true" source="vars" required="true" label="variable(s):"/>
- <checkbox id="lshort" label="short or long truncation lag parameter" value_unchecked="FALSE" value="TRUE" checked="true" />
+ <radio id="lshort" label="version of truncation lag parameter">
+ <option label="short" value="TRUE"/>
+ <option label="long" value="FALSE"/>
+ </radio>
</column>
</row>
</tab>
+ <tab id="tab_options" label="Options">
+ <checkbox id="narm" checked="false" value="1" value_unchecked="0" label="Exclude missing values" />
+ <checkbox id="length" checked="true" value="1" value_unchecked="0" label="Show Length and NAs" />
+ <stretch/>
+ </tab>
</tabbook>
</dialog>
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