[rkward-cvs] SF.net SVN: rkward: [1941] trunk/rkward/rkward/plugins/analysis/time_series
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Sun Aug 5 11:15:48 UTC 2007
Revision: 1941
http://rkward.svn.sourceforge.net/rkward/?rev=1941&view=rev
Author: sjar
Date: 2007-08-05 04:15:48 -0700 (Sun, 05 Aug 2007)
Log Message:
-----------
new times-series test kpss
Added Paths:
-----------
trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.php
trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.rkh
trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.xml
Added: trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.php 2007-08-05 11:15:48 UTC (rev 1941)
@@ -0,0 +1,42 @@
+<?
+function preprocess () { ?>
+require (tseries)
+<?
+}
+
+function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>
+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))
+
+<? }
+ if (getRK_val ("narm")) { ?>
+ var <- var[!is.na (var)] # remove NAs
+<? } ?>
+ try ({
+ test <- kpss.test (var, null = "<? getRK ("null"); ?>", lshort = <? getRK ("lshort"); ?>)
+ results[i, 'KPSS <? getRK ("null") ?>'] <- test$statistic
+ results[i, 'Truncation lag parameter'] <- test$parameter
+ results[i, 'p-value'] <- test$p.value
+ })
+}
+<?
+}
+
+function printout () {
+?>
+rk.header ("KPSS Test for Level Stationarity",
+ parameters=list ("null hypothesis", "<? getRK ("null"); ?>", "version of truncation lag parameter", "<? getRK ("lshort"); ?>"))
+
+rk.results (results)
+<?
+}
+?>
Property changes on: trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.rkh (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.rkh 2007-08-05 11:15:48 UTC (rev 1941)
@@ -0,0 +1,25 @@
+<!DOCTYPE rkhelp>
+<document>
+ <summary>
+ This test computes the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test for the null hypothesis that x is level or trend stationary.
+ </summary>
+
+ <usage>
+ Select the data sets for which you want to perform the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test. For this test the samples need to be numeric vectors (see below for details).
+ </usage>
+
+ <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="null">Indicates the null hypothesis and must be one of "Level" (default) or "Trend".</setting>
+ <setting id="lshort">Defines whether the short or long version of the truncation lag parameter is 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/kpss.test"/></li>
+ </ul>
+ </related>
+</document>
Added: trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.xml 2007-08-05 11:15:48 UTC (rev 1941)
@@ -0,0 +1,34 @@
+<!DOCTYPE rkplugin>
+
+
+<document>
+ <code file="kpss_test.php"/>
+ <help file="kpss_test.rkh"/>
+
+ <dialog label="KPSS Test for Stationarity">
+ <tabbook>
+ <tab id="tab_variables" label="Basic settings">
+ <row>
+ <varselector id="vars"/>
+ <column>
+ <varslot type="numeric" id="x" multi="true" source="vars" required="true" label="variable(s):"/>
+ <radio id="null" label="null hypothesis">
+ <option label="Level" value="Level"/>
+ <option label="Trend" value="Trend"/>
+ </radio>
+ <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>
+
+</document>
Property changes on: trunk/rkward/rkward/plugins/analysis/time_series/kpss_test.xml
___________________________________________________________________
Name: svn:executable
+ *
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