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

sjar at users.sourceforge.net sjar at users.sourceforge.net
Sat Aug 4 23:53:26 UTC 2007


Revision: 1938
          http://rkward.svn.sourceforge.net/rkward/?rev=1938&view=rev
Author:   sjar
Date:     2007-08-04 16:53:25 -0700 (Sat, 04 Aug 2007)

Log Message:
-----------
New time-series test "Box.test" from stats

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/Makefile.am
    trunk/rkward/rkward/plugins/under_development.pluginmap

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

Modified: trunk/rkward/rkward/plugins/Makefile.am
===================================================================
--- trunk/rkward/rkward/plugins/Makefile.am	2007-08-04 15:17:43 UTC (rev 1937)
+++ trunk/rkward/rkward/plugins/Makefile.am	2007-08-04 23:53:25 UTC (rev 1938)
@@ -350,7 +350,8 @@
 	analysis/ansari_bradley/ansari_bradley_test.php \
 	analysis/ansari_bradley/ansari_bradley_exact_test.php \
 	analysis/ansari_bradley/ansari_bradley_test.xml \
-	analysis/ansari_bradley/ansari_bradley_test.rkh
+	analysis/ansari_bradley/ansari_bradley_test.rkh \
+	analysis/ansari_bradley/ansari_bradley_exact_test.rkh
 
 pluginsXanalysisXmomentsdir = $(kde_datadir)/rkward/analysis/moments
 dist_pluginsXanalysisXmoments_DATA = \
@@ -397,10 +398,13 @@
 dist_pluginsXanalysisXTESTS_DATA = \
 	analysis/TESTS/mood_test.rkh \
 	analysis/TESTS/PP_test.rkh \
+	analysis/TESTS/Box_test.rkh \
 	analysis/TESTS/mood_test.php \
 	analysis/TESTS/PP_test.php \
 	analysis/TESTS/mood_test.xml \
-	analysis/TESTS/PP_test.xml
+	analysis/TESTS/PP_test.xml \
+	analysis/TESTS/Box_test.php \
+	analysis/TESTS/Box_test.xml
 
 pluginsXanalysisXvariancesdir = $(kde_datadir)/rkward/analysis/variances
 dist_pluginsXanalysisXvariances_DATA = \

Added: trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.php	2007-08-04 23:53:25 UTC (rev 1938)
@@ -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/TESTS/Box_test.php
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.rkh	2007-08-04 23:53:25 UTC (rev 1938)
@@ -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/TESTS/Box_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/TESTS/Box_test.xml	2007-08-04 23:53:25 UTC (rev 1938)
@@ -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/TESTS/Box_test.xml
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/rkward/rkward/plugins/under_development.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/under_development.pluginmap	2007-08-04 15:17:43 UTC (rev 1937)
+++ trunk/rkward/rkward/plugins/under_development.pluginmap	2007-08-04 23:53:25 UTC (rev 1938)
@@ -6,6 +6,7 @@
 		<component type="standard" id="mcrosstab" file="analysis/crosstab_multi.xml" label="Multiple" />
 		<component type="standard" id="piechart" file="plots/piechart.xml" label="Piechart" />
 		<component type="standard" id="dotchart" file="plots/dotchart.xml" label="Dotchart" />
+		<component type="standard" id="Box_test" file="analysis/TESTS/Box_test.xml" label="Box–Pierce or Ljung–Box Tests" />
 	</components>
 
 	<hierarchy>
@@ -20,6 +21,9 @@
 				<entry component="crosstab" />
 				<entry component="mcrosstab" />
 			</menu>
+			<menu id="misc_tests" label="Miscellaneous tests" index="4">
+				<entry component="Box_test"/>
+			</menu>
 		</menu>
 		<menu id="plots" label="Plots" index="5">
 			<entry component="piechart" index="11"/>


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