[rkward] /: Generate updated files for power analysis plugin (with preview)

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Jan 26 14:33:44 UTC 2016


Git commit abf2ab4e02f7de56134ec1805e2c11642a314f80 by Thomas Friedrichsmeier.
Committed on 26/01/2016 at 14:33.
Pushed by tfry into branch 'master'.

Generate updated files for power analysis plugin (with preview)

M  +1    -0    ChangeLog
M  +156  -128  rkward/plugins/analysis/power/Poweranalysis.js
M  +20   -19   rkward/plugins/analysis/power/Poweranalysis.rkh
M  +13   -10   rkward/plugins/analysis/power/Poweranalysis.xml
M  +1    -1    rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
M  +1    -1    tests/analysis_plugins.R

http://commits.kde.org/rkward/abf2ab4e02f7de56134ec1805e2c11642a314f80

diff --git a/ChangeLog b/ChangeLog
index 8ea0ed1..745d2ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- Add preview to Power Analysis plugin
 - Add support for adding "htmlwidget"- and "gvis"-class objects to the output window via rk.print()
 - Add plugins for importing Excel files (.xls and .xlsx, Perl- and Java-based)
 - Add ability to extract <matrix> values row-wise in plugins
diff --git a/rkward/plugins/analysis/power/Poweranalysis.js b/rkward/plugins/analysis/power/Poweranalysis.js
index f8c8d7a..b3074ad 100644
--- a/rkward/plugins/analysis/power/Poweranalysis.js
+++ b/rkward/plugins/analysis/power/Poweranalysis.js
@@ -1,16 +1,21 @@
 // this code was generated using the rkwarddev package.
-//perhaps don't make changes here, but in the rkwarddev script instead!
+// perhaps don't make changes here, but in the rkwarddev script instead!
 
 
 
-function preprocess(){
+function preview(){
+	preprocess(true);
+	calculate(true);
+	printout(true);
+}
+
+function preprocess(is_preview){
 	// add requirements etc. here
 	echo("require(pwr)\n");
 }
 
-function calculate(){
+function calculate(is_preview){
 	// read in variables from dialog
-
 	var drpPwrStat = getString("drp_pwr_stat");
 	var spnNmbrfgrp = getString("spn_Nmbrfgrp");
 	var drpPwrType = getString("drp_pwr_type");
@@ -33,140 +38,161 @@ function calculate(){
 	echo("\tpwr.result <- try(\n\t\t");
 	if(drpPwrStat == "pwr.t.test") {
 		if(drpPwrType == "two.sample.diff") {
-		echo("pwr.t2n.test(");
-	if(radPwrParam != "Sample size") {
-		echo("\n\t\t\tn1=" + pwrSpinSample1 + ",\n\t\t\tn2=" + pwrSpinSample2);
-	} else {
-		echo("\n\t\t\tn1=" + pwrSpinSample1 + ",");
-	}
-	} else {
-		echo("pwr.t.test(");
-	if(radPwrParam != "Sample size") {
-		echo("\n\t\t\tn=" + pwrSpinSample0);
-	}
-	}
-	if(radPwrParam != "Effect size") {
-		if(radPwrParam != "Sample size") {
-		echo(",");
-	}
-	echo("\n\t\t\td=" + spnEffectsz);
-	}
+			echo("pwr.t2n.test(");	
+			if(radPwrParam != "Sample size") {
+				echo("\n\t\t\tn1=" + pwrSpinSample1 + ",\n\t\t\tn2=" + pwrSpinSample2);	
+			} else {
+				echo("\n\t\t\tn1=" + pwrSpinSample1 + ",");	
+			}	
+		} else {
+			echo("pwr.t.test(");	
+			if(radPwrParam != "Sample size") {
+				echo("\n\t\t\tn=" + pwrSpinSample0);	
+			}	
+		}	
+		if(radPwrParam != "Effect size") {
+			if(radPwrParam != "Sample size") {
+				echo(",");	
+			}	
+			echo("\n\t\t\td=" + spnEffectsz);	
+		}	
 	}
 	if(drpPwrStat == "pwr.r.test") {
-		echo("pwr.r.test(");
-	if(radPwrParam != "Sample size") {
-		echo("\n\t\t\tn=" + pwrSpinSample0);
-	}
-	if(radPwrParam != "Effect size") {
+		echo("pwr.r.test(");	
 		if(radPwrParam != "Sample size") {
-		echo(",");
-	}
-	echo("\n\t\t\tr=" + spnEffectsz);
-	}
+			echo("\n\t\t\tn=" + pwrSpinSample0);	
+		}	
+		if(radPwrParam != "Effect size") {
+			if(radPwrParam != "Sample size") {
+				echo(",");	
+			}	
+			echo("\n\t\t\tr=" + spnEffectsz);	
+		}	
 	}
 	if(drpPwrStat == "pwr.anova.test") {
-		echo("pwr.anova.test(");
-	echo("\n\t\t\tk=" + spnNmbrfgrp);
-	if(radPwrParam != "Sample size") {
-		echo(",\n\t\t\tn=" + pwrSpinSample0);
-	}
-	if(radPwrParam != "Effect size") {
-		if(radEffctEta == "f") {
-			echo(",\n\t\t\tf=" + spnEffectsz);
-		} else {
-			echo(",\n\t\t\tf=sqrt(" + spnEffectsz + "/(1-" + spnEffectsz + "))");
-	comment("calculate f from eta squared", "\t");
-		}
-	}
+		echo("pwr.anova.test(");	
+		echo("\n\t\t\tk=" + spnNmbrfgrp);	
+		if(radPwrParam != "Sample size") {
+			echo(",\n\t\t\tn=" + pwrSpinSample0);	
+		}	
+		if(radPwrParam != "Effect size") {
+			if(radEffctEta == "f") {
+				echo(",\n\t\t\tf=" + spnEffectsz);	
+			} else {
+				echo(",\n\t\t\tf=sqrt(" + spnEffectsz + "/(1-" + spnEffectsz + "))");	
+				comment("calculate f from eta squared", "\t");	
+			}	
+		}	
 	}
 	if(drpPwrStat == "pwr.f2.test") {
-		echo("pwr.f2.test(");
-	if(radPwrParam != "Parameter count") {
-		echo("\n\t\t\tu=" + pwrSpinDfu);
-	}
-	if(radPwrParam != "Sample size") {
+		echo("pwr.f2.test(");	
 		if(radPwrParam != "Parameter count") {
-		echo(",");
-	}
-	echo("\n\t\t\tv=" + pwrSpinDfv);
-	}
-	if(radPwrParam != "Effect size") {
-		echo(",\n\t\t\tf2=" + spnEffectsz);
-	}
+			echo("\n\t\t\tu=" + pwrSpinDfu);	
+		}	
+		if(radPwrParam != "Sample size") {
+			if(radPwrParam != "Parameter count") {
+				echo(",");	
+			}	
+			echo("\n\t\t\tv=" + pwrSpinDfv);	
+		}	
+		if(radPwrParam != "Effect size") {
+			echo(",\n\t\t\tf2=" + spnEffectsz);	
+		}	
 	}
 	if(drpPwrStat == "pwr.chisq.test") {
-		echo("pwr.chisq.test(");
-	if(radPwrParam != "Effect size") {
-		echo("\n\t\t\tw=" + spnEffectsz);
-	}
-	if(radPwrParam != "Sample size") {
+		echo("pwr.chisq.test(");	
 		if(radPwrParam != "Effect size") {
-		echo(",");
-	}
-	echo("\n\t\t\tN=" + pwrSpinSample0);
-	}
-	echo(",\n\t\t\tdf=" + pwrSpinDf);
+			echo("\n\t\t\tw=" + spnEffectsz);	
+		}	
+		if(radPwrParam != "Sample size") {
+			if(radPwrParam != "Effect size") {
+				echo(",");	
+			}	
+			echo("\n\t\t\tN=" + pwrSpinSample0);	
+		}	
+		echo(",\n\t\t\tdf=" + pwrSpinDf);	
 	}
 	if(drpPwrStat == "pwr.p.test") {
 		if(drpPwrProptype == "two.sample.same") {
-		echo("pwr.2p.test(");
-	}
-	if(drpPwrProptype == "two.sample.diff") {
-		echo("pwr.2p2n.test(");
-	}
-	if(drpPwrProptype == "one.sample") {
-		echo("pwr.p.test(");
-	}
-	if(radPwrParam != "Effect size") {
-		echo("\n\t\t\th=" + spnEffectsz);
-	}
-	if(radPwrParam != "Sample size") {
+			echo("pwr.2p.test(");	
+		}	
+		if(drpPwrProptype == "two.sample.diff") {
+			echo("pwr.2p2n.test(");	
+		}	
+		if(drpPwrProptype == "one.sample") {
+			echo("pwr.p.test(");	
+		}	
 		if(radPwrParam != "Effect size") {
-		echo(",");
-	}
-	if(drpPwrProptype != "two.sample.diff") {
-		echo("\n\t\t\tn=" + pwrSpinSample0);
-	} else {
-		echo("\n\t\t\tn1=" + pwrSpinSample1 + ",\n\t\t\tn2=" + pwrSpinSample2);
-	}
-	} else if(drpPwrProptype == "two.sample.diff") {
-		echo(",\n\t\t\tn1=" + pwrSpinSample1);
-	}
+			echo("\n\t\t\th=" + spnEffectsz);	
+		}	
+		if(radPwrParam != "Sample size") {
+			if(radPwrParam != "Effect size") {
+				echo(",");	
+			}	
+			if(drpPwrProptype != "two.sample.diff") {
+				echo("\n\t\t\tn=" + pwrSpinSample0);	
+			} else {
+				echo("\n\t\t\tn1=" + pwrSpinSample1 + ",\n\t\t\tn2=" + pwrSpinSample2);	
+			}	
+		} else {
+			if(drpPwrProptype == "two.sample.diff") {
+				echo(",\n\t\t\tn1=" + pwrSpinSample1);	
+			}	
+		}	
 	}
 	if(drpPwrStat == "pwr.norm.test") {
-		echo("pwr.norm.test(");
-	if(radPwrParam != "Effect size") {
-		echo("\n\t\t\td=" + spnEffectsz);
-	}
-	if(radPwrParam != "Sample size") {
+		echo("pwr.norm.test(");	
 		if(radPwrParam != "Effect size") {
-		echo(",");
-	}
-	echo("\n\t\t\tn=" + pwrSpinSample0);
-	}
+			echo("\n\t\t\td=" + spnEffectsz);	
+		}	
+		if(radPwrParam != "Sample size") {
+			if(radPwrParam != "Effect size") {
+				echo(",");	
+			}	
+			echo("\n\t\t\tn=" + pwrSpinSample0);	
+		}	
 	}
 	if(radPwrParam != "Significance level") {
 		if(spnSgnfcncl != 0.05) {
-			echo(",\n\t\t\tsig.level=" + spnSgnfcncl);
-		}
+			echo(",\n\t\t\tsig.level=" + spnSgnfcncl);	
+		}	
 	} else {
-		echo(",\n\t\t\tsig.level=NULL");
+		echo(",\n\t\t\tsig.level=NULL");	
 	}
 	if(radPwrParam != "Power") {
-		echo(",\n\t\t\tpower=" + spnPower);
+		echo(",\n\t\t\tpower=" + spnPower);	
 	}
-	if(drpPwrStat == "pwr.t.test" & drpPwrType != "two.sample.diff" & drpPwrType != "two.sample") {
-		echo(",\n\t\t\ttype=\"" + drpPwrType + "\"");
+	if(drpPwrStat == "pwr.t.test" && drpPwrType != "two.sample.diff" && drpPwrType != "two.sample") {
+		echo(",\n\t\t\ttype=\"" + drpPwrType + "\"");	
 	}
-	if(drpPwrStat != "pwr.anova.test" & drpPwrStat != "pwr.f2.test" & drpPwrStat != "pwr.chisq.test") {
+	if(drpPwrStat != "pwr.anova.test" && drpPwrStat != "pwr.f2.test" && drpPwrStat != "pwr.chisq.test") {
 		if(drpPwrHypothesis != "two.sided") {
-			echo(",\n\t\t\talternative=\"" + drpPwrHypothesis + "\"");
-		}
+			echo(",\n\t\t\talternative=\"" + drpPwrHypothesis + "\"");	
+		}	
 	}
 	echo("\n\t\t)\n\t)\n\n");
 }
 
-function printout(){
+function printout(is_preview){
+	// read in variables from dialog
+	var drpPwrStat = getString("drp_pwr_stat");
+	var spnNmbrfgrp = getString("spn_Nmbrfgrp");
+	var drpPwrType = getString("drp_pwr_type");
+	var drpPwrProptype = getString("drp_pwr_proptype");
+	var drpPwrHypothesis = getString("drp_pwr_hypothesis");
+	var radEffctEta = getString("rad_effct_eta");
+	var radPwrParam = getString("rad_pwr_param");
+	var spnPower = getString("spn_Power");
+	var pwrSpinDf = getString("pwr_spin_df");
+	var pwrSpinDfu = getString("pwr_spin_dfu");
+	var pwrSpinDfv = getString("pwr_spin_dfv");
+	var pwrSpinSample0 = getString("pwr_spin_sample0");
+	var pwrSpinSample1 = getString("pwr_spin_sample1");
+	var pwrSpinSample2 = getString("pwr_spin_sample2");
+	var spnEffectsz = getString("spn_Effectsz");
+	var spnSgnfcncl = getString("spn_Sgnfcncl");
+	var svbSvrsltst = getString("svb_Svrsltst");
+
 	// printout the results
 
 
@@ -176,37 +202,39 @@ function printout(){
 	echo("\tif(class(pwr.result) == \"try-error\"){\n" + "\t\trk.print(" + i18n("Power analysis not possible with the data you provided") + ")\n" + "\t\treturn()\n\t}\n\n");
 	comment("Prepare printout", "\t");
 	echo("\tnote <- pwr.result[[\"note\"]]\n");
-	header = new Header ().addFromUI ("rad_pwr_param");
-
-	echo("\tparameters <- list(");
-	echo (header.extractParameters ());
-	echo(")\n" + "\tif(!is.null(pwr.result[[\"alternative\"]])){\n\t\tparameters[[" + i18n("alternative") + "]] <- pwr.result[[\"alternative\"]]\n\t}\n\n" + "\trk.header(pwr.result[[\"method\"]], parameters=parameters)\n" + "\tpwr.result[c(\"method\", \"note\", \"alternative\")] <- NULL\n" + "\tpwr.result <- as.data.frame(unlist(pwr.result))\n" + "\tcolnames(pwr.result) <- " + i18n("Parameters") + "\n\n" + "\trk.results(pwr.result)\n" + "\tif(!is.null(note)){\n\t\trk.print(paste(" + i18n("<strong>Note:</strong>") + ", note))\n\t}\n\n");
-	if(drpPwrStat == "pwr.t.test" | drpPwrStat == "pwr.norm.test") {
-		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "d") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.2, " + i18nc("effect size", "medium") + "=0.5, " + i18nc("effect size", "large") + "=0.8))\n");
+	if(!is_preview) {
+		header = new Header ().addFromUI ("rad_pwr_param");
+echo("\tparameters <- list(");echo (header.extractParameters ());echo(")\n" + "\tif(!is.null(pwr.result[[\"alternative\"]])){\n\t\tparameters[[" + i18n("alternative") + "]] <- pwr.result[[\"alternative\"]]\n\t}\n\n" + "\trk.header(pwr.result[[\"method\"]], parameters=parameters)\n");	
+	}
+	echo("\tpwr.result[c(\"method\", \"note\", \"alternative\")] <- NULL\n" + "\tpwr.result <- as.data.frame(unlist(pwr.result))\n" + "\tcolnames(pwr.result) <- " + i18n("Parameters") + "\n\n" + "\trk.results(pwr.result)\n" + "\tif(!is.null(note)){\n\t\trk.print(paste(" + i18n("<strong>Note:</strong>") + ", note))\n\t}\n\n");
+	if(drpPwrStat == "pwr.t.test" || drpPwrStat == "pwr.norm.test") {
+		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "d") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.2, " + i18nc("effect size", "medium") + "=0.5, " + i18nc("effect size", "large") + "=0.8))\n");	
 	}
 	if(drpPwrStat == "pwr.r.test") {
-		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "r") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.1, " + i18nc("effect size", "medium") + "=0.3, " + i18nc("effect size", "large") + "=0.5))\n");
+		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "r") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.1, " + i18nc("effect size", "medium") + "=0.3, " + i18nc("effect size", "large") + "=0.5))\n");	
 	}
 	if(drpPwrStat == "pwr.f2.test") {
-		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "f<sup>2</sup>") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.02, " + i18nc("effect size", "medium") + "=0.15, " + i18nc("effect size", "large") + "=0.35))\n");
+		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "f<sup>2</sup>") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.02, " + i18nc("effect size", "medium") + "=0.15, " + i18nc("effect size", "large") + "=0.35))\n");	
 	}
 	if(drpPwrStat == "pwr.anova.test") {
-		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "f") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.1, " + i18nc("effect size", "medium") + "=0.25, " + i18nc("effect size", "large") + "=0.4))\n");
+		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "f") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.1, " + i18nc("effect size", "medium") + "=0.25, " + i18nc("effect size", "large") + "=0.4))\n");	
 	}
 	if(drpPwrStat == "pwr.chisq.test") {
-		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "w") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.1, " + i18nc("effect size", "medium") + "=0.3, " + i18nc("effect size", "large") + "=0.5))\n");
+		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "w") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.1, " + i18nc("effect size", "medium") + "=0.3, " + i18nc("effect size", "large") + "=0.5))\n");	
 	}
 	if(drpPwrStat == "pwr.p.test") {
-		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "h") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.2, " + i18nc("effect size", "medium") + "=0.5, " + i18nc("effect size", "large") + "=0.8))\n");
-	}
-	//// save result object
-	// read in saveobject variables
-	var svbSvrsltst = getValue("svb_Svrsltst");
-	var svbSvrsltstActive = getValue("svb_Svrsltst.active");
-	var svbSvrsltstParent = getValue("svb_Svrsltst.parent");
-	// assign object to chosen environment
-	if(svbSvrsltstActive) {
-		echo(".GlobalEnv$" + svbSvrsltst + " <- pwr.result\n");
+		echo("\trk.print(" + i18nc("Argument is name of statistic, e.g. 'r'", "Interpretation of effect size <strong>%1</strong> (according to Cohen):", "h") + ")\n" + "\trk.results(data.frame(" + i18nc("effect size", "small") + "=0.2, " + i18nc("effect size", "medium") + "=0.5, " + i18nc("effect size", "large") + "=0.8))\n");	
+	}
+	if(!is_preview) {
+		//// save result object
+		// read in saveobject variables
+		var svbSvrsltst = getValue("svb_Svrsltst");
+		var svbSvrsltstActive = getValue("svb_Svrsltst.active");
+		var svbSvrsltstParent = getValue("svb_Svrsltst.parent");
+		// assign object to chosen environment
+		if(svbSvrsltstActive) {
+			echo(".GlobalEnv$" + svbSvrsltst + " <- pwr.result\n");
+		}	
 	}
 
 }
diff --git a/rkward/plugins/analysis/power/Poweranalysis.rkh b/rkward/plugins/analysis/power/Poweranalysis.rkh
index fd40680..70ab7cd 100644
--- a/rkward/plugins/analysis/power/Poweranalysis.rkh
+++ b/rkward/plugins/analysis/power/Poweranalysis.rkh
@@ -1,25 +1,25 @@
 <!DOCTYPE rkhelp >
 <document>
 	<!-- this code was generated using the rkwarddev package.
-			perhaps don't make changes here, but in the rkwarddev script instead! -->
+		perhaps don't make changes here, but in the rkwarddev script instead! -->
 	<title>
 		Power analysis
 	</title>
 	<summary>
-		Perform power analysis for a variety of statistical methods.
+		Perform power analysis for a variety of statistcal methods.
 	</summary>
 	<usage>
 		Given three of the parameters 'power of test', 
-		  'sample size', 'effect size', and 'significance level', this plugin will 
-		  estimate the fourth, i.e. for example the test power of a t.test at a given 
-		  sample size, effect size, and level of significance. On the left hand, specify the 
-		  statistical method, on the right hand side, enter the values of the given 
-		  parameters. In the control in the middle, select which of the parameters to estimate.
-		
-
-		  Note that in some cases it will not be possible to estimate a (finite) parameter at the given
-		  specifications. In general, this means that you have to increase sample size(s) or effect size,
-		  or decrease effect power or parameter count.
+	  'sample size', 'effect size', and 'significance level', this plugin will 
+	  estimate the fourth, i.e. for example the test power of a t.test at a given 
+	  sample size, effect size, and level of significance. On the left hand, specify the 
+	  statistical method, on the right hand side, enter the values of the given 
+	  parameters. In the control in the middle, select which of the parameters to estimate.
+	
+	
+	  Note that in some cases it will not be possible to estimate a (finite) parameter at the given
+	  specifications. In general, this means that you have to increase sample size(s) or effect size,
+	  or decrease effect power or parameter count.
 	</usage>
 	<!-- <section id="sct_EDITORDE" title="EDIT OR DELETE ME">
 				EDIT OR DELETE ME
@@ -37,31 +37,32 @@
 		</setting>
 		<setting id="drp_pwr_hypothesis">
 			Specify the hypothesis to use. Note that for the one-sided hypothesis "first is greater",
-			           a positive effect size is expected. For "second is greater", a negative effect size is expected.
+	           a positive effect size is expected. For "second is greater", a negative effect size is expected.
 		</setting>
 		<setting id="rad_effct_eta">
 			Only shown where applicable. Allows you to select, whether to specify the effect size as Cohen's f, or as Eta squared.
 		</setting>
+		<caption id="frm_prevwmdtpt" />
 		<caption id="frm_Targtmsr" />
 		<setting id="rad_pwr_param">
 			Parameter to estimate, given the others.
 		</setting>
 		<caption id="frm_Knwnmsrs" />
-		<caption id="frm_spnbPP0801" />
+		<caption id="frm_sPP080118H" />
 		<setting id="spn_Power">
 			Targeted power of test (1 minus Type II error probability)
 		</setting>
 		<caption id="frm_sD301D3011" />
 		<setting id="pwr_spin_df">
 			Only shown for chi-square statistics: Targeted degrees of freedom. As a reminder, this is (rows − 1)×(columns − 1) for a test of independence,
-			                               and (cells − 1) for a test of goodness of fit.
+	                               and (cells − 1) for a test of goodness of fit.
 		</setting>
 		<setting id="pwr_spin_dfu">
 			Only shown for general linear model: Targeted numerator degrees of freedom. As a reminder, this is the number of parameters to estimate, or number of groups/samples minus 1.
 		</setting>
 		<setting id="pwr_spin_dfv">
 			Only shown for general linear model: Available denominator degrees of freedom / degrees of freedom of the error term.
-			                               As a reminder, this is the total number of observations minus numerator degrees of freedom minus 1, or total number of observations minus number of groups/samples.
+	                               As a reminder, this is the total number of observations minus numerator degrees of freedom minus 1, or total number of observations minus number of groups/samples.
 		</setting>
 		<caption id="frm_sS0301F130" />
 		<setting id="pwr_spin_sample0">
@@ -70,9 +71,9 @@
 		<caption id="frm_sEE0311MCM" />
 		<setting id="spn_Effectsz">
 			Minimum detectable effect size. Note that effect size specifications differ between the available methods. Be sure to read the note shown below the control.
-			
-
-			   As a reminder, for mapping between cohen's f and Eta&sup2; use f&sup2; = Eta&sup2; / (1 − Eta&sup2;)
+	
+	
+	   As a reminder, for mapping between cohen's f and Eta&sup2; use f&sup2; = Eta&sup2; / (1 − Eta&sup2;)
 		</setting>
 		<caption id="frm_spnSS00501" />
 		<setting id="spn_Sgnfcncl">
diff --git a/rkward/plugins/analysis/power/Poweranalysis.xml b/rkward/plugins/analysis/power/Poweranalysis.xml
index 4f5a95b..76d0fe9 100644
--- a/rkward/plugins/analysis/power/Poweranalysis.xml
+++ b/rkward/plugins/analysis/power/Poweranalysis.xml
@@ -1,12 +1,12 @@
 <!DOCTYPE rkplugin >
 <document>
 	<!-- this code was generated using the rkwarddev package.
-			perhaps don't make changes here, but in the rkwarddev script instead! -->
+		perhaps don't make changes here, but in the rkwarddev script instead! -->
 	<code file="Poweranalysis.js" />
 	<help file="Poweranalysis.rkh" />
 	<!-- <dependencies>
 			</dependencies> -->
-	<about name="Power analysis" shortinfo="RKWard GUI to perform power analysis and sample size estimation." longinfo="RKWard GUI to perform power analysis and sample size estimation." version="0.02-1" releasedate="2015-02-02" url="http://rkward.kde.org" license="GPL (>= 3)">
+	<about name="Power analysis" shortinfo="RKWard GUI to perform power analysis and sample size estimation." longinfo="RKWard GUI to perform power analysis and sample size estimation." version="0.03-1" releasedate="2016-01-26" url="http://rkward.kde.org" license="GPL (>= 3)">
 		<author given="Meik" family="Michalke" email="meik.michalke at hhu.de" role="aut, cre" />
 		<author given="Thomas" family="Friedrichsmeier" email="thomas.friedrichsmeier at ruhr-uni-bochum.de" role="ctb" />
 	</about>
@@ -16,7 +16,7 @@
 		<convert id="pwr_lgc_effect" sources="rad_pwr_param.string" mode="equals" standard="Effect size" />
 		<convert id="pwr_lgc_signif" sources="rad_pwr_param.string" mode="equals" standard="Significance level" />
 		<convert id="pwr_lgc_df_u" sources="rad_pwr_param.string" mode="equals" standard="Parameter count" />
-		<connect governor="pwr_lgc_power.not" client="frm_spnbPP0801.enabled" />
+		<connect governor="pwr_lgc_power.not" client="frm_sPP080118H.enabled" />
 		<connect governor="pwr_lgc_effect.not" client="frm_sEE0311MCM.enabled" />
 		<connect governor="pwr_lgc_signif.not" client="frm_spnSS00501.enabled" />
 		<convert id="pwr_lgc_ttest" sources="drp_pwr_stat.string" mode="equals" standard="pwr.t.test" />
@@ -95,7 +95,7 @@
 		<connect governor="pwr_lgc_alt_warn_neg" client="pwr_txt_hypothesis_neg.visible" />
 		<connect governor="pwr_lgc_alt_warn_pos" client="pwr_txt_hypothesis_pos.visible" />
 	</logic>
-	<dialog label="Power analysis">
+	<dialog label="Power analysis" i18n_context="Here 'power' is a common statistical term and should not be translated">
 		<row id="row_cSMSMSTCAN">
 			<column id="clm_fSMSMSTCAN">
 				<frame label="Statistical Method" id="frm_SttstclM">
@@ -137,11 +137,14 @@
 					</radio>
 				</frame>
 				<stretch />
+				<frame id="frm_prevwmdtpt">
+					<preview mode="output" />
+				</frame>
 			</column>
-			<column id="clm_fTTPPPSSEE">
+			<column id="clm_fTTPPP18HS">
 				<frame label="Target measure" id="frm_Targtmsr">
 					<radio id="rad_pwr_param" label="Parameter to determine">
-						<option label="Power of test" value="Power" checked="true" />
+						<option label="Power of test" value="Power" checked="true" i18n_context="Here 'power' is a common statistical term and should not be translated" />
 						<option label="Sample size" value="Sample size" />
 						<option label="Effect size" value="Effect size" />
 						<option label="Significance level" value="Significance level" />
@@ -150,10 +153,10 @@
 					<stretch />
 				</frame>
 			</column>
-			<column id="clm_fKKPP0801P">
+			<column id="clm_fKKPP08011">
 				<frame label="Known measures" id="frm_Knwnmsrs">
-					<frame id="frm_spnbPP0801">
-						<spinbox label="Power" id="spn_Power" initial="0.8" min="0" max="1" />
+					<frame id="frm_sPP080118H">
+						<spinbox label="Power" id="spn_Power" initial="0.8" min="0" max="1" i18n_context="Here 'power' is a common statistical term and should not be translated" />
 					</frame>
 					<frame id="frm_sD301D3011">
 						<spinbox label="Degrees of freedom" id="pwr_spin_df" initial="30" min="1" type="integer" />
@@ -246,7 +249,7 @@
 						<spinbox label="Significance level" id="spn_Sgnfcncl" initial="0.05" min="0" max="1" />
 					</frame>
 					<stretch />
-					<saveobject label="Save results to workspace" checkable="true" initial="pwr.result" id="svb_Svrsltst" />
+					<saveobject label="Save results to workspace" checkable="true" initial="pwr.result" id="svb_Svrsltst" i18n_context="Here 'power' is a common statistical term and should not be translated" />
 				</frame>
 			</column>
 		</row>
diff --git a/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R b/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
index 7a75d8e..5987e78 100644
--- a/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
+++ b/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
@@ -466,7 +466,7 @@ pwr.js.calc <- rk.paste.JS(
 helper.make.effect.size.legend <<- function (indicator, small, medium, large) {
    indicator <- paste0("\"", indicator, "\"")
    rk.paste.JS (echo(
-      "\trk.print(", i18n ("Interpretation of effect size <strong>%1</strong> (according to Cohen): ", indicator, context="Argument is name of statistic, e.g. 'r'"), ")\n",
+      "\trk.print(", i18n ("Interpretation of effect size <strong>%1</strong> (according to Cohen):", indicator, context="Argument is name of statistic, e.g. 'r'"), ")\n",
       "\trk.results(data.frame(", i18n ("small", context="effect size"), paste0 ("=", small, ", "),
                                   i18n ("medium", context="effect size"), paste0 ("=", medium, ", "),
                                   i18n ("large", context="effect size"), paste0 ("=", large, "))\n"))
diff --git a/tests/analysis_plugins.R b/tests/analysis_plugins.R
index f6757aa..2bec5f2 100644
--- a/tests/analysis_plugins.R
+++ b/tests/analysis_plugins.R
@@ -154,7 +154,7 @@ suite <- new ("RKTestSuite", id="analysis_plugins",
 			rk.call.plugin ("rkward::power_analysis", drp_pwr_hypothesis.string="greater", drp_pwr_proptype.string="two.sample.same", drp_pwr_stat.string="pwr.p.test", pwr_spin_sample0.real="30.00", rad_pwr_param.string="Significance level", spn_Effectsz.real="0.30", spn_Power.real="0.81", svb_Svrsltst.active="0", svb_Svrsltst.objectname="pwr.result", svb_Svrsltst.parent=".GlobalEnv", submit.mode="submit")
 			rk.call.plugin ("rkward::power_analysis", drp_pwr_hypothesis.string="two.sided", drp_pwr_stat.string="pwr.norm.test", pwr_spin_sample0.real="30.00", rad_pwr_param.string="Significance level", spn_Effectsz.real="0.30", spn_Power.real="0.80", svb_Svrsltst.active="0", svb_Svrsltst.objectname="pwr.result", svb_Svrsltst.parent=".GlobalEnv", submit.mode="submit")
 			rk.call.plugin ("rkward::power_analysis", drp_pwr_stat.string="pwr.f2.test", pwr_spin_dfv.real="30.00", pwr_spin_sample0.real="30.00", rad_pwr_param.string="Parameter count", spn_Effectsz.real="0.30", spn_Power.real="0.80", spn_Sgnfcncl.real="0.10", svb_Svrsltst.active="0", svb_Svrsltst.objectname="pwr.result", svb_Svrsltst.parent=".GlobalEnv", submit.mode="submit")
-		})
+		}, libraries=c("pwr"))
 	), postCalls = list (	# like initCalls: run after all tests to clean up.
 		function () {
 			suppressWarnings (rm (list=c ("women", "warpbreaks", "rock", "co2", "test50x", "test50y", "test50z", "test10x", "test10y", "test10z", "test_table", "hptrend", "hpcycle"), envir=globalenv()))



More information about the rkward-tracker mailing list