[rkward-cvs] SF.net SVN: rkward: [1940] trunk/rkward/rkward/plugins/analysis

sjar at users.sourceforge.net sjar at users.sourceforge.net
Sun Aug 5 11:15:11 UTC 2007


Revision: 1940
          http://rkward.svn.sourceforge.net/rkward/?rev=1940&view=rev
Author:   sjar
Date:     2007-08-05 04:15:11 -0700 (Sun, 05 Aug 2007)

Log Message:
-----------
Box_test now in time_series

Added Paths:
-----------
    trunk/rkward/rkward/plugins/analysis/time_series/
    trunk/rkward/rkward/plugins/analysis/time_series/Box_test.php
    trunk/rkward/rkward/plugins/analysis/time_series/Box_test.rkh
    trunk/rkward/rkward/plugins/analysis/time_series/Box_test.xml

Added: trunk/rkward/rkward/plugins/analysis/time_series/Box_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/Box_test.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/time_series/Box_test.php	2007-08-05 11:15:11 UTC (rev 1940)
@@ -0,0 +1,40 @@
+<?
+function preprocess () {
+}
+
+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 <- Box.test (var, lag = <? getRK ("lag"); ?>, type = "<? getRK ("type"); ?>")
+		results[i, 'X-squared'] <- test$statistic
+		results[i, 'degrees of freedom'] <- test$parameter
+		results[i, 'p-value'] <- test$p.value
+	})
+}
+<?
+}
+
+function printout () {
+?>
+rk.header ("<? getRK ("type"); ?> Test",
+	parameters=list ("lag", "<? getRK ("lag"); ?>", "type", "<? getRK ("type"); ?>"))
+
+rk.results (results)
+<?
+}
+?>


Property changes on: trunk/rkward/rkward/plugins/analysis/time_series/Box_test.php
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/rkward/rkward/plugins/analysis/time_series/Box_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/Box_test.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/time_series/Box_test.rkh	2007-08-05 11:15:11 UTC (rev 1940)
@@ -0,0 +1,24 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+		This test computes Box–Pierce or Ljung–Box test statistic for examining the null hypothesis of independence in a given time series.
+	</summary>
+
+	<usage>
+		Select the data sets for which you want to perform the Box–Pierce or Ljung–Box 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="type">Define type of test. Either Ljung-Box or Box-Pierce can 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/Box.test"/></li>
+		</ul>
+	</related>
+</document>

Added: trunk/rkward/rkward/plugins/analysis/time_series/Box_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/time_series/Box_test.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/time_series/Box_test.xml	2007-08-05 11:15:11 UTC (rev 1940)
@@ -0,0 +1,33 @@
+<!DOCTYPE rkplugin>
+
+
+<document>
+	<code file="Box_test.php"/>
+	<help file="Box_test.rkh"/>
+	
+	<dialog label="Box-Pierce and Ljung-Box Tests">
+		<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):"/>
+						<spinbox type="real" label="lag" id="lag" min="0" initial="1" max="99" />
+						<frame label="Type of test">
+							<radio id="type" label="test to be performed">
+								<option label="Box-Pierce" value="Box-Pierce"/>
+								<option label="Ljung-Box" value="Ljung-Box"/>
+							</radio>
+						</frame>
+					</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/Box_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