[rkward-cvs] [rkward] /: Generate files for power analysis plugin

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Jan 12 20:19:36 UTC 2015


Git commit a7fc57f115fe40e38a2d85997baada77dfbd14b5 by Thomas Friedrichsmeier.
Committed on 11/01/2015 at 20:58.
Pushed by tfry into branch 'master'.

Generate files for power analysis plugin

M  +2    -0    ChangeLog
M  +4    -0    rkward/plugins/analysis.pluginmap
A  +203  -0    rkward/plugins/analysis/power/Poweranalysis.js
A  +93   -0    rkward/plugins/analysis/power/Poweranalysis.rkh
A  +248  -0    rkward/plugins/analysis/power/Poweranalysis.xml
M  +4    -3    rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R

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

diff --git a/ChangeLog b/ChangeLog
index 5e5ecfb..5666a56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+- Added power analysis plugin (already existed as separate plugin)
+  - TODO: add automated tests
 - <matrix> element gains options min_rows and min_columns, and the details of fixed_width="true" have been improved
 - Fixed: <valueslot>s were quirky with respect to showing as invalid
 - Fix a hang-on-exit issue
diff --git a/rkward/plugins/analysis.pluginmap b/rkward/plugins/analysis.pluginmap
index 39b6ec3..28ae0eb 100644
--- a/rkward/plugins/analysis.pluginmap
+++ b/rkward/plugins/analysis.pluginmap
@@ -57,6 +57,9 @@
 
 		<!-- regression -->
 		<component type="standard" id="linear_regression" file="analysis/regression/linear_regression.xml" label="Linear Regression" />
+
+		<!-- Power analysis -->
+		<component type="standard" id="power_analysis" file="analysis/power/Poweranalysis.xml" label="Power Analysis" i18n_context="Power of tests" />
 	</components>
 
 	<hierarchy>
@@ -65,6 +68,7 @@
 			<entry component="basic_statistics" group="descriptives"/>
 			<entry component="descriptive" group="descriptives"/>
 
+			<entry component="power_analysis"/>
 			<menu id="correlation" label="Correlation">
 				<entry component="corr_matrix" />
 				<entry component="cor_graph" />
diff --git a/rkward/plugins/analysis/power/Poweranalysis.js b/rkward/plugins/analysis/power/Poweranalysis.js
new file mode 100644
index 0000000..18aba7c
--- /dev/null
+++ b/rkward/plugins/analysis/power/Poweranalysis.js
@@ -0,0 +1,203 @@
+// this code was generated using the rkwarddev package.
+//perhaps don't make changes here, but in the rkwarddev script instead!
+
+
+
+function preprocess(){
+	// add requirements etc. here
+	echo("require(pwr)\n");
+}
+
+function calculate(){
+	// read in variables from dialog
+	var drpPwrStat = getValue("drp_pwr_stat");
+	var spnNmbrfgrp = getValue("spn_Nmbrfgrp");
+	var drpPwrType = getValue("drp_pwr_type");
+	var drpPwrProptype = getValue("drp_pwr_proptype");
+	var drpPwrHypothesis = getValue("drp_pwr_hypothesis");
+	var radEffctEta = getValue("rad_effct_eta");
+	var radPwrParam = getValue("rad_pwr_param");
+	var spnPower = getValue("spn_Power");
+	var pwrSpinDf = getValue("pwr_spin_df");
+	var pwrSpinDfu = getValue("pwr_spin_dfu");
+	var pwrSpinDfv = getValue("pwr_spin_dfv");
+	var pwrSpinSample0 = getValue("pwr_spin_sample0");
+	var pwrSpinSample1 = getValue("pwr_spin_sample1");
+	var pwrSpinSample2 = getValue("pwr_spin_sample2");
+	var spnEffectsz = getValue("spn_Effectsz");
+	var spnSgnfcncl = getValue("spn_Sgnfcncl");
+	var svbSvrsltst = getValue("svb_Svrsltst");
+
+	// the R code to be evaluated
+	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);
+	}
+	}
+	if(drpPwrStat == "pwr.r.test") {
+		echo("pwr.r.test(");
+	if(radPwrParam != "Sample size") {
+		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 + ")) # calculate f from eta squared");
+		}
+	}
+	}
+	if(drpPwrStat == "pwr.f2.test") {
+		echo("pwr.f2.test(");
+	if(radPwrParam != "Parameter count") {
+		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") {
+		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") {
+		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") {
+		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 + ",");
+		}
+	} else {
+		echo(",\n\t\t\tsig.level=NULL");
+	}
+	if(radPwrParam != "Power") {
+		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.anova.test" & drpPwrStat != "pwr.f2.test" & drpPwrStat != "pwr.chisq.test") {
+		if(drpPwrHypothesis != "two.sided") {
+			echo(",\n\t\t\talternative=\"" + drpPwrHypothesis + "\"");
+		}
+	}
+	echo("\n\t\t)\n\t)\n\n");
+}
+
+function printout(){
+	// printout the results
+
+
+	var drpPwrStat = getValue("drp_pwr_stat");
+	var radPwrParam = getValue("rad_pwr_param");
+	echo("\t# Catch errors due to unsuitable data\n" + "\tif(class(pwr.result) == \"try-error\"){\n" + "\t\trk.print(\"Power anaylsis not possible with the data you provided\")\n" + "\t\treturn()\n\t}\n\n" + "\t# Prepare printout\n" + "\tnote <- pwr.result[[\"note\"]]\n" + "\tparameters <- list(\"Target measure\"=\"" + radPwrParam + "\")\n" + "\tif(!is.null(pwr.result[[\"alternative\"]])){\n\t\tparameters[[\"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) <- \"Parameters\"\n\n" + "\trk.results(pwr.result)\n" + "\tif(!is.null(note)){\n\t\trk.print(paste(\"<strong>Note:</strong> \", note))\n\t}\n\n");
+	if(drpPwrStat == "pwr.t.test" | drpPwrStat == "pwr.norm.test") {
+		echo("\trk.print(\"Interpretation of effect size <strong>d</strong> (according to Cohen):\")\n" + "\trk.results(data.frame(small=0.2, medium=0.5, large=0.8))\n");
+	}
+	if(drpPwrStat == "pwr.r.test") {
+		echo("\trk.print(\"Interpretation of effect size <strong>r</strong> (according to Cohen):\")\n" + "\trk.results(data.frame(small=0.1, medium=0.3, large=0.5))\n");
+	}
+	if(drpPwrStat == "pwr.f2.test") {
+		echo("\trk.print(\"Interpretation of effect size <strong>f<sup>2</sup></strong> (according to Cohen):\")\n" + "\trk.results(data.frame(small=0.02, medium=0.15, large=0.35))\n");
+	}
+	if(drpPwrStat == "pwr.anova.test") {
+		echo("\trk.print(\"Interpretation of effect size <strong>f</strong> (according to Cohen):\")\n" + "\trk.results(data.frame(small=0.1, medium=0.25, large=0.4))\n");
+	}
+	if(drpPwrStat == "pwr.chisq.test") {
+		echo("\trk.print(\"Interpretation of effect size <strong>w</strong> (according to Cohen):\")\n" + "\trk.results(data.frame(small=0.1, medium=0.3, large=0.5))\n");
+	}
+	if(drpPwrStat == "pwr.p.test") {
+		echo("\trk.print(\"Interpretation of effect size <strong>h</strong> (according to Cohen):\")\n" + "\trk.results(data.frame(small=0.2, medium=0.5, 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");
+	}
+
+}
+
diff --git a/rkward/plugins/analysis/power/Poweranalysis.rkh b/rkward/plugins/analysis/power/Poweranalysis.rkh
new file mode 100644
index 0000000..838ec81
--- /dev/null
+++ b/rkward/plugins/analysis/power/Poweranalysis.rkh
@@ -0,0 +1,93 @@
+<!DOCTYPE rkhelp >
+<document>
+	<!-- this code was generated using the rkwarddev package.
+			perhaps don't make changes here, but in the rkwarddev script instead! -->
+	<title>
+		Power analysis
+	</title>
+	<summary>
+		Perform power anaylsis 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.
+	</usage>
+	<!-- <section id="sct_EDITORDE" title="EDIT OR DELETE ME">
+				EDIT OR DELETE ME
+			</section> -->
+	<settings>
+		<caption id="frm_SttstclM" />
+		<setting id="drp_pwr_stat">
+			Specify the statistical method to perform power estimation for
+		</setting>
+		<setting id="spn_Nmbrfgrp">
+			Number of groups. For ANOVA, only.
+		</setting>
+		<setting id="drp_pwr_type">
+			Only enabled where applicable. Specify the nature of samples used in the test. For samples of different sizes, only one sample size can be estimated.
+		</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.
+		</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_Targtmsr" />
+		<setting id="rad_pwr_param">
+			Parameter to estimate, given the others.
+		</setting>
+		<caption id="frm_Knwnmsrs" />
+		<caption id="frm_spnbPP0801" />
+		<setting id="spn_Power">
+			Targetted 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: Targetted 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.
+		</setting>
+		<setting id="pwr_spin_dfu">
+			Only shown for general linear model: Targetted 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.
+		</setting>
+		<caption id="frm_sS0301F130" />
+		<setting id="pwr_spin_sample0">
+			Sample size. Note that depending on the selected method, this can mean observations per sample, per group, or in total. Make sure to read the note shown below the control.
+		</setting>
+		<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;)
+		</setting>
+		<caption id="frm_spnSS00501" />
+		<setting id="spn_Sgnfcncl">
+			Targetted level of significance
+		</setting>
+	</settings>
+	<related>
+		<ul>
+			<li>
+				<link href="rkward://rhelp/pwr">
+					Description of the R package "pwr", used to perform the power calculations.
+				</link>
+			</li>
+		</ul>
+	</related>
+	<technical>
+	</technical>
+</document>
diff --git a/rkward/plugins/analysis/power/Poweranalysis.xml b/rkward/plugins/analysis/power/Poweranalysis.xml
new file mode 100644
index 0000000..cd25f87
--- /dev/null
+++ b/rkward/plugins/analysis/power/Poweranalysis.xml
@@ -0,0 +1,248 @@
+<!DOCTYPE rkplugin >
+<document>
+	<!-- this code was generated using the rkwarddev package.
+			perhaps don't make changes here, but in the rkwarddev script instead! -->
+	<code file="Poweranalysis.js" />
+	<help file="Poweranalysis.rkh" />
+	<logic>
+		<convert id="pwr_lgc_power" sources="rad_pwr_param.string" mode="equals" standard="Power" />
+		<convert id="pwr_lgc_sample" sources="rad_pwr_param.string" mode="equals" standard="Sample size" />
+		<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_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" />
+		<convert id="pwr_lgc_rtest" sources="drp_pwr_stat.string" mode="equals" standard="pwr.r.test" />
+		<convert id="pwr_lgc_anova" sources="drp_pwr_stat.string" mode="equals" standard="pwr.anova.test" />
+		<convert id="pwr_lgc_f2test" sources="drp_pwr_stat.string" mode="equals" standard="pwr.f2.test" />
+		<convert id="pwr_lgc_chisq" sources="drp_pwr_stat.string" mode="equals" standard="pwr.chisq.test" />
+		<convert id="pwr_lgc_proptest" sources="drp_pwr_stat.string" mode="equals" standard="pwr.p.test" />
+		<convert id="pwr_lgc_norm" sources="drp_pwr_stat.string" mode="equals" standard="pwr.norm.test" />
+		<convert id="pwr_lgc_sample_2p_same" sources="drp_pwr_proptype.string" mode="equals" standard="two.sample.same" />
+		<convert id="pwr_lgc_sample_2p_diff" sources="drp_pwr_proptype.string" mode="equals" standard="two.sample.diff" />
+		<convert id="pwr_lgc_sample_t_same" sources="drp_pwr_type.string" mode="equals" standard="two.sample" />
+		<convert id="pwr_lgc_sample_t_diff" sources="drp_pwr_type.string" mode="equals" standard="two.sample.diff" />
+		<convert id="pwr_lgc_sample_t_pairs" sources="drp_pwr_type.string" mode="equals" standard="paired" />
+		<convert id="pwr_lgc_sample_t_onesample" sources="drp_pwr_type.string" mode="equals" standard="one.sample" />
+		<convert id="pwr_lgc_2p" sources="pwr_lgc_sample_2p_same;pwr_lgc_proptest" mode="and" />
+		<convert id="pwr_lgc_2p2n" sources="pwr_lgc_sample_2p_diff;pwr_lgc_proptest" mode="and" />
+		<convert id="pwr_lgc_tsame" sources="pwr_lgc_sample_t_same;pwr_lgc_ttest" mode="and" />
+		<convert id="pwr_lgc_tdiff" sources="pwr_lgc_sample_t_diff;pwr_lgc_ttest" mode="and" />
+		<convert id="pwr_lgc_tpaired" sources="pwr_lgc_sample_t_pairs;pwr_lgc_ttest" mode="and" />
+		<convert id="pwr_lgc_tunpaired" sources="pwr_lgc_sample_t_onesample;pwr_lgc_ttest" mode="and" />
+		<connect governor="pwr_lgc_proptest.not" client="drp_pwr_type.visible" />
+		<connect governor="pwr_lgc_ttest" client="drp_pwr_type.enabled" />
+		<connect governor="pwr_lgc_proptest" client="drp_pwr_proptype.visible" />
+		<connect governor="pwr_lgc_proptest" client="drp_pwr_proptype.enabled" />
+		<connect governor="pwr_lgc_f2test" client="rad_pwr_param.opt_Prmtrcnt.enabled" />
+		<connect governor="pwr_lgc_f2test.not" client="frm_sS0301F130.visible" />
+		<convert id="pwr_lgc_show_df" sources="pwr_lgc_f2test;pwr_lgc_chisq" mode="or" />
+		<connect governor="pwr_lgc_show_df" client="frm_sD301D3011.visible" />
+		<connect governor="pwr_lgc_chisq" client="pwr_spin_df.visible" />
+		<connect governor="pwr_lgc_f2test" client="pwr_spin_dfu.visible" />
+		<connect governor="pwr_lgc_f2test" client="pwr_txt_dfu.visible" />
+		<connect governor="pwr_lgc_f2test" client="pwr_spin_dfv.visible" />
+		<connect governor="pwr_lgc_f2test" client="pwr_txt_dfv.visible" />
+		<convert id="pwr_lgc_efct_d" sources="pwr_lgc_ttest;pwr_lgc_norm" mode="or" />
+		<connect governor="pwr_lgc_efct_d" client="pwr_txt_efct_d.visible" />
+		<connect governor="pwr_lgc_rtest" client="pwr_txt_efct_r.visible" />
+		<convert id="pwr_lgc_efct_f" sources="rad_effct_eta.string" mode="equals" standard="f" />
+		<convert id="pwr_lgc_efct_show_f" sources="pwr_lgc_anova;pwr_lgc_efct_f" mode="and" />
+		<convert id="pwr_lgc_efct_show_e2" sources="pwr_lgc_anova;pwr_lgc_efct_f.not" mode="and" />
+		<connect governor="pwr_lgc_efct_show_f" client="pwr_txt_efct_f.visible" />
+		<connect governor="pwr_lgc_efct_show_e2" client="pwr_txt_efct_e2.visible" />
+		<connect governor="pwr_lgc_f2test" client="pwr_txt_efct_f2.visible" />
+		<connect governor="pwr_lgc_chisq" client="pwr_txt_efct_w.visible" />
+		<connect governor="pwr_lgc_proptest" client="pwr_txt_efct_h.visible" />
+		<connect governor="pwr_lgc_anova" client="rad_effct_eta.visible" />
+		<connect governor="pwr_lgc_effect.not" client="rad_effct_eta.enabled" />
+		<connect governor="pwr_lgc_anova" client="spn_Nmbrfgrp.enabled" />
+		<convert id="pwr_lgc_smpl_ps" sources="pwr_lgc_tsame;pwr_lgc_tunpaired;pwr_lgc_2p" mode="or" />
+		<convert id="pwr_lgc_smpl_nondefault" sources="pwr_lgc_ttest;pwr_lgc_2p;pwr_lgc_2p2n;pwr_lgc_tdiff;pwr_lgc_anova;pwr_lgc_chisq" mode="or" />
+		<connect governor="pwr_lgc_smpl_ps" client="pwr_txt_smpl_ps.visible" />
+		<connect governor="pwr_lgc_anova" client="pwr_txt_smpl_pg.visible" />
+		<connect governor="pwr_lgc_chisq" client="pwr_txt_smpl_tt.visible" />
+		<connect governor="pwr_lgc_tpaired" client="pwr_txt_smpl_pairs.visible" />
+		<connect governor="pwr_lgc_smpl_nondefault.not" client="pwr_txt_smpl.visible" />
+		<convert id="pwr_lgc_smpl_diff" sources="pwr_lgc_tdiff;pwr_lgc_2p2n" mode="or" />
+		<connect governor="pwr_lgc_smpl_diff" client="pwr_spin_sample1.visible" />
+		<connect governor="pwr_lgc_smpl_diff" client="pwr_spin_sample2.visible" />
+		<connect governor="pwr_lgc_smpl_diff.not" client="pwr_spin_sample0.visible" />
+		<convert id="pwr_lgc_smpl_switch" sources="pwr_lgc_sample;pwr_lgc_smpl_diff" mode="and" />
+		<convert id="pwr_lgc_enable_sample_frame" sources="pwr_lgc_sample.not;pwr_lgc_smpl_switch" mode="or" />
+		<connect governor="pwr_lgc_enable_sample_frame" client="frm_sS0301F130.enabled" />
+		<connect governor="pwr_lgc_sample.not" client="pwr_spin_sample2.enabled" />
+		<connect governor="pwr_lgc_df_u.not" client="pwr_spin_dfu.enabled" />
+		<connect governor="pwr_lgc_sample.not" client="pwr_spin_dfv.enabled" />
+		<connect governor="pwr_lgc_df_u.not" client="pwr_txt_dfu.enabled" />
+		<connect governor="pwr_lgc_sample.not" client="pwr_txt_dfv.enabled" />
+		<convert id="pwr_lgc_noalternative" sources="pwr_lgc_anova.not;pwr_lgc_f2test.not;pwr_lgc_chisq.not" mode="and" />
+		<connect governor="pwr_lgc_noalternative" client="drp_pwr_hypothesis.enabled" />
+		<convert id="pwr_lgc_alt_less" sources="drp_pwr_hypothesis.string" mode="equals" standard="less" />
+		<convert id="pwr_lgc_alt_greater" sources="drp_pwr_hypothesis.string" mode="equals" standard="greater" />
+		<convert id="pwr_lgc_pos_effect" sources="spn_Effectsz.real" mode="range" min="0" />
+		<convert id="pwr_lgc_neg_effect" sources="spn_Effectsz.real" mode="range" max="0" />
+		<convert id="pwr_lgc_alt_warn_neg" sources="pwr_lgc_alt_less;pwr_lgc_noalternative;pwr_lgc_pos_effect" mode="and" />
+		<convert id="pwr_lgc_alt_warn_pos" sources="pwr_lgc_alt_greater;pwr_lgc_noalternative;pwr_lgc_neg_effect" mode="and" />
+		<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">
+		<row id="row_cSMSMSTCAN">
+			<column id="clm_fSMSMSTCAN">
+				<frame label="Statistical Method" id="frm_SttstclM">
+					<dropdown id="drp_pwr_stat" label="Select a method">
+						<option label="t-Tests of means" value="pwr.t.test" checked="true" />
+						<option label="Correlation test" value="pwr.r.test" />
+						<option label="ANOVA (balanced one-way)" value="pwr.anova.test" />
+						<option label="General linear model" value="pwr.f2.test" />
+						<option label="Chi-squared test" value="pwr.chisq.test" />
+						<option label="Proportion tests" value="pwr.p.test" />
+						<option label="Mean of a normal distribution (known variance)" value="pwr.norm.test" />
+					</dropdown>
+					<spinbox label="Number of groups" id="spn_Nmbrfgrp" initial="2" min="1" type="integer" />
+					<dropdown id="drp_pwr_type" label="Samples">
+						<option label="Two samples (equal sizes)" value="two.sample" checked="true" />
+						<option label="Two samples (different sizes)" value="two.sample.diff" />
+						<option label="Single sample (test against constant)" value="one.sample" />
+						<option label="Paired samples" value="paired" />
+					</dropdown>
+					<dropdown id="drp_pwr_proptype" label="Samples">
+						<option label="Two samples (equal sizes)" value="two.sample.same" checked="true" />
+						<option label="Two samples (different sizes)" value="two.sample.diff" />
+						<option label="One sample" value="one.sample" />
+					</dropdown>
+					<dropdown id="drp_pwr_hypothesis" label="Using test hypothesis">
+						<option label="Two-sided" value="two.sided" checked="true" />
+						<option label="First is greater" value="greater" />
+						<option label="Second is greater" value="less" />
+					</dropdown>
+					<text id="pwr_txt_hypothesis_neg" type="warning">
+						Hypothesis probably expects a negative effect size!
+					</text>
+					<text id="pwr_txt_hypothesis_pos" type="warning">
+						Hypothesis probably expects a positive effect size!
+					</text>
+					<radio id="rad_effct_eta" label="Provided effect size">
+						<option label="Cohen's f" value="f" checked="true" />
+						<option label="Eta squared" value="e2" />
+					</radio>
+				</frame>
+				<stretch />
+			</column>
+			<column id="clm_fTTPPPSSEE">
+				<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="Sample size" value="Sample size" />
+						<option label="Effect size" value="Effect size" />
+						<option label="Significance level" value="Significance level" />
+						<option label="Parameter count" value="Parameter count" id="opt_Prmtrcnt" />
+					</radio>
+					<stretch />
+				</frame>
+			</column>
+			<column id="clm_fKKPP0801P">
+				<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>
+					<frame id="frm_sD301D3011">
+						<spinbox label="Degrees of freedom" id="pwr_spin_df" initial="30" min="1" type="integer" />
+						<spinbox label="Degrees of freedom for numerator" id="pwr_spin_dfu" initial="30" min="1" type="integer" />
+						<text id="pwr_txt_dfu">
+							df 							<sub>
+								num
+							</sub>
+							: k − 1
+						</text>
+						<spinbox label="Degrees of freedom for denominator" id="pwr_spin_dfv" initial="30" min="1" type="integer" />
+						<text id="pwr_txt_dfv">
+							df 							<sub>
+								den
+							</sub>
+							: N − k
+						</text>
+					</frame>
+					<frame id="frm_sS0301F130">
+						<spinbox label="Sample size" id="pwr_spin_sample0" initial="30" min="1" type="integer" />
+						<spinbox label="First sample size" id="pwr_spin_sample1" initial="30" min="1" type="integer" />
+						<spinbox label="Second sample size" id="pwr_spin_sample2" initial="30" min="1" type="integer" />
+						<text id="pwr_txt_smpl">
+							Number of observations
+						</text>
+						<text id="pwr_txt_smpl_ps">
+							Number of observations 							<b>
+								per sample
+							</b>
+						</text>
+						<text id="pwr_txt_smpl_pg">
+							Number of observations 							<b>
+								per group
+							</b>
+						</text>
+						<text id="pwr_txt_smpl_tt">
+							Number of observations 							<b>
+								in total
+							</b>
+						</text>
+						<text id="pwr_txt_smpl_pairs">
+							Number of 							<b>
+								pairs
+							</b>
+						</text>
+					</frame>
+					<frame id="frm_sEE0311MCM">
+						<spinbox label="Effect size" id="spn_Effectsz" initial="0.3" min="-1" max="1" />
+						<text id="pwr_txt_efct_d">
+							Measure for selected method is 							<b>
+								Cohen's d
+							</b>
+						</text>
+						<text id="pwr_txt_efct_r">
+							Measure for selected method is 							<b>
+								Pearson's r
+							</b>
+						</text>
+						<text id="pwr_txt_efct_f">
+							Measure for selected method is 							<b>
+								Cohen's f
+							</b>
+						</text>
+						<text id="pwr_txt_efct_e2">
+							Measure for selected method is 							<b>
+								Eta 								<sup>
+									2
+								</sup>
+							</b>
+						</text>
+						<text id="pwr_txt_efct_f2">
+							Measure for selected method is 							<b>
+								Cohen's f 								<sup>
+									2
+								</sup>
+							</b>
+						</text>
+						<text id="pwr_txt_efct_w">
+							Measure for selected method is 							<b>
+								Cohen's w
+							</b>
+						</text>
+						<text id="pwr_txt_efct_h">
+							Measure for selected method is 							<b>
+								Cohen's h
+							</b>
+						</text>
+					</frame>
+					<frame id="frm_spnSS00501">
+						<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" />
+				</frame>
+			</column>
+		</row>
+	</dialog>
+</document>
diff --git a/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R b/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
index 9c9cf0b..f73b9fb 100644
--- a/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
+++ b/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
@@ -18,9 +18,9 @@ about.info <- rk.XML.about(
   author=c(
     person(given="Meik", family="Michalke",
       email="meik.michalke at hhu.de", role=c("aut","cre")),
-    person(given="Thomas", family="Friedrichsmeier", role=c("ctb"))),
+    person(given="Thomas", family="Friedrichsmeier", email="thomas.friedrichsmeier at ruhr-uni-bochum.de", role=c("ctb"))),
   about=list(desc="RKWard GUI to perform power analysis and sample size estimation.",
-    version="0.01-3", url="http://rkward.sf.net")
+    version="0.01-3", url="http://rkward.kde.org")
   )
 dependencies.info <- rk.XML.dependencies(
   dependencies=list(rkward.min=ifelse(isTRUE(guess.getter), "0.6.0", "0.5.6"),
@@ -546,7 +546,8 @@ pwr.plugin.dir <<- rk.plugin.skeleton(
   ),
   pluginmap=list(name="Power analysis", hierarchy=list("analysis")),
   dependencies=dependencies.info,
-  create=c("pmap", "xml", "js", "desc", "rkh"),
+#  create=c("pmap", "xml", "js", "desc", "rkh"),	# standalone
+  create=c("xml", "js", "rkh"),
   overwrite=overwrite,
   tests=FALSE,
 # edit=TRUE,





More information about the rkward-tracker mailing list