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

sjar at users.sourceforge.net sjar at users.sourceforge.net
Fri Dec 9 20:38:57 UTC 2011


Revision: 4089
          http://rkward.svn.sourceforge.net/rkward/?rev=4089&view=rev
Author:   sjar
Date:     2011-12-09 20:38:57 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
* harmonic, geometric and interquantile mean added
* option to output results to a file added (or better embed export plugin?)

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.js
    trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh
    trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml

Modified: trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.js
===================================================================
--- trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.js	2011-12-09 20:38:33 UTC (rev 4088)
+++ trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.js	2011-12-09 20:38:57 UTC (rev 4089)
@@ -17,6 +17,18 @@
 		// trim is the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed
 		echo ('	results[i, \'mean\'] <- try (mean (var, trim = ' + getValue ("trim") + ', na.rm=TRUE))\n');
 	}
+	if (getValue ("geo_mean")) {
+		// compute the geometric mean
+		echo ('	results[i, \'geometric mean\'] <- try (prod (na.omit(var))^(1 / length (na.omit(var))))\n');
+	}
+	if (getValue ("interquantile_mean")) {
+		// compute the quartile (25% and 75%) mean
+		echo ('	results[i, \'interquantile mean\'] <- try (sum(quantile(var, probs=c(0.25), na.rm=T), quantile(var, probs=c(0.75), na.rm=TRUE)) / 2)\n');
+	}
+	if (getValue ("harmonic_mean")) {
+		// compute the harmonic mean
+		echo ('	results[i, \'harmonic mean\'] <- try (1 / mean(1 / na.omit(var)))\n');
+	}
 	if (getValue ("median")) {
 		echo ('	results[i, \'median\'] <- try (median (var, na.rm=TRUE))\n');
 	}
@@ -63,6 +75,7 @@
 	echo ('))\n');
 	echo ('\n');
 	echo ('rk.results (results)\n');
+	if (getValue ("save_to_file")) echo ('write.csv(file="' + getValue ("file") + '", results)\n');
 }
 
 

Modified: trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh
===================================================================
--- trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh	2011-12-09 20:38:33 UTC (rev 4088)
+++ trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh	2011-12-09 20:38:57 UTC (rev 4089)
@@ -17,6 +17,8 @@
 		<caption id="tab_mean_sd"/>
 		<setting id="mean">Should the mean value be computed?</setting>
 		<setting id="trim">Trim of the mean. See <link href="rkward://rhelp/mean"/></setting>
+		<setting id="geo_mean">Should the geometric mean value be computed?</setting>
+		<setting id="interquantile_mean">Should the interquantile mean value be computed?</setting>
 		<setting id="sd">Compute the standard deviation?</setting>
 		<caption id="tab_median_mad"/>
 		<setting id="median">Should the median value be computed?</setting>

Modified: trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml
===================================================================
--- trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml	2011-12-09 20:38:33 UTC (rev 4088)
+++ trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml	2011-12-09 20:38:57 UTC (rev 4089)
@@ -14,21 +14,28 @@
 						<varslot multi="true" type="numeric" source="vars" id="x" num_dimensions="1" label="variable(s):" required="true" />
 					</column>
 				</row>
+					<checkbox value_unchecked="0" checked="flase" value="1" id="save_to_file" label="Save results to file" />
+					<browser type="savefile" size="small" id="file" filter="*.csv" initial="data" label="Name of the file" />
 			</tab>
 			<tab label="Mean Standard Deviation" id="tab_mean_sd">
 				<column>
-					<checkbox value_unchecked="0" checked="true" value="1" id="mean" label="mean" />
-					<spinbox type="real" initial="0" min="0" id="trim" max="0.5" label="trim" />
+					<frame>
+					      <checkbox value_unchecked="0" checked="true" value="1" id="mean" label="Mean" />
+					      <spinbox type="real" initial="0" min="0" id="trim" max="0.5" label="Trim of mean" />
+					</frame>    
+					<checkbox value_unchecked="0" checked="false" value="1" id="geo_mean" label="Geometric mean" />
+					<checkbox value_unchecked="0" checked="false" value="1" id="interquantile_mean" label="Interquantile mean" />
+					<checkbox value_unchecked="0" checked="false" value="1" id="harmonic_mean" label="Harmonic mean" />
 				</column>
 				<column>
-					<checkbox value_unchecked="0" checked="true" value="1" id="sd" label="standard deviation" />
+					<checkbox value_unchecked="0" checked="true" value="1" id="sd" label="Standard deviation" />
 				</column>
 				<stretch/>
 			</tab>
 			<tab label="Median, MAD" id="tab_median_mad">
 				<column>
 					<frame label="Median" >
-						<checkbox value_unchecked="0" value="1" id="median" label="median" />
+						<checkbox value_unchecked="0" value="1" id="median" label="Median" />
 					</frame>
 					<frame label="Median Absolute Deviation (mad)" >
 						<checkbox value_unchecked="0" value="1" id="mad" label="mad" />

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