[rkward-cvs] SF.net SVN: rkward-code:[4876] branches/external_plugins/rk.power
m-eik at users.sf.net
m-eik at users.sf.net
Sun Oct 5 18:46:37 UTC 2014
Revision: 4876
http://sourceforge.net/p/rkward/code/4876
Author: m-eik
Date: 2014-10-05 18:46:36 +0000 (Sun, 05 Oct 2014)
Log Message:
-----------
rk.power: nicer output, fixing sample information
Modified Paths:
--------------
branches/external_plugins/rk.power/DESCRIPTION
branches/external_plugins/rk.power/R/rk.power-package.R
branches/external_plugins/rk.power/debian/changelog
branches/external_plugins/rk.power/inst/CITATION
branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.js
branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.xml
branches/external_plugins/rk.power/inst/rkward/rk.power.pluginmap
branches/external_plugins/rk.power/inst/rkward/rkwarddev_power_plugin_script.R
branches/external_plugins/rk.power/man/rk.power-package.Rd
Modified: branches/external_plugins/rk.power/DESCRIPTION
===================================================================
--- branches/external_plugins/rk.power/DESCRIPTION 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/DESCRIPTION 2014-10-05 18:46:36 UTC (rev 4876)
@@ -1,7 +1,7 @@
Package: rk.power
Type: Package
Title: RKWard GUI to perform power analysis and sample size estimation.
-Version: 0.01-1
+Version: 0.01-2
Date: 2014-10-05
Author: Meik Michalke <meik.michalke at hhu.de>
Maintainer: Meik Michalke <meik.michalke at hhu.de>
Modified: branches/external_plugins/rk.power/R/rk.power-package.R
===================================================================
--- branches/external_plugins/rk.power/R/rk.power-package.R 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/R/rk.power-package.R 2014-10-05 18:46:36 UTC (rev 4876)
@@ -3,9 +3,9 @@
#' \tabular{ll}{
#' Package: \tab rk.power\cr
#' Type: \tab Package\cr
-#' Version: \tab 0.01-1\cr
+#' Version: \tab 0.01-2\cr
#' Date: \tab 2014-10-05\cr
-#' Depends: \tab rkward (>= 0.5.6)\cr
+#' Depends: \tab rkward (>= 0.5.6)\cr
#' Enhances: \tab rkward\cr
#' License: \tab GPL (>= 3)\cr
#' LazyLoad: \tab yes\cr
Modified: branches/external_plugins/rk.power/debian/changelog
===================================================================
--- branches/external_plugins/rk.power/debian/changelog 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/debian/changelog 2014-10-05 18:46:36 UTC (rev 4876)
@@ -1,3 +1,9 @@
+r-other-rkward-rk.power (0.01-2-1) unstable; urgency=low
+
+ * new upstream release
+
+ -- m.eik michalke <meik.michalke at hhu.de> Sun, 05 Oct 2014 20:42:36 +0200
+
r-other-rkward-rk.power (0.01-1-1) unstable; urgency=low
* new upstream release
Modified: branches/external_plugins/rk.power/inst/CITATION
===================================================================
--- branches/external_plugins/rk.power/inst/CITATION 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/inst/CITATION 2014-10-05 18:46:36 UTC (rev 4876)
@@ -2,12 +2,12 @@
title="rk.power: RKWard GUI to perform power analysis and sample size estimation.",
author="Meik Michalke",
year="2014",
- note="(Version 0.01-1)",
+ note="(Version 0.01-2)",
url="http://rkward.sf.net",
textVersion =
paste("Michalke, M. (2014). ",
- "rk.power: RKWard GUI to perform power analysis and sample size estimation. (Version 0.01-1). ",
+ "rk.power: RKWard GUI to perform power analysis and sample size estimation. (Version 0.01-2). ",
"Available from http://rkward.sf.net",
sep=""),
Modified: branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.js
===================================================================
--- branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.js 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.js 2014-10-05 18:46:36 UTC (rev 4876)
@@ -35,7 +35,7 @@
if(drpPwrStat == "pwr.t.test") {
if(drpPwrType == "two.sample.diff") {
echo("pwr.t2n.test(");
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Sample size") {
echo("\n\t\tn1=" + pwrSpinSample1 + ",\n\t\tn2=" + pwrSpinSample2);
} else if(radPwrParam2samples == "n2") {
echo("\n\t\tn1=" + pwrSpinSample1 + ",");
@@ -44,12 +44,12 @@
}
} else {
echo("pwr.t.test(");
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Sample size") {
echo("\n\t\tn=" + pwrSpinSample0);
}
}
- if(radPwrParam != "effect") {
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Effect size") {
+ if(radPwrParam != "Sample size") {
echo(",");
}
echo("\n\t\td=" + spnEffectsz);
@@ -57,11 +57,11 @@
}
if(drpPwrStat == "pwr.r.test") {
echo("pwr.r.test(");
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Sample size") {
echo("\n\t\tn=" + pwrSpinSample0);
}
- if(radPwrParam != "effect") {
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Effect size") {
+ if(radPwrParam != "Sample size") {
echo(",");
}
echo("\n\t\tr=" + spnEffectsz);
@@ -70,10 +70,10 @@
if(drpPwrStat == "pwr.anova.test") {
echo("pwr.anova.test(");
echo("\n\t\tk=" + spnNmbrfgrp);
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Sample size") {
echo(",\n\t\tn=" + pwrSpinSample0);
}
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Effect size") {
if(radEffctEta == "f") {
echo(",\n\t\tf=" + spnEffectsz);
} else {
@@ -83,24 +83,24 @@
}
if(drpPwrStat == "pwr.f2.test") {
echo("pwr.f2.test(");
- if(radPwrParam != "sample") {
+ if(radPwrParam != "Sample size") {
echo(",\n\t\tu=" + pwrSpinDfu + ",\n\t\tv=" + pwrSpinDfv);
} else if(radPwrParam2df == "v") {
echo("\n\t\tu=" + pwrSpinDfu);
} else {
echo("\n\t\tv=" + pwrSpinDfv);
}
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Effect size") {
echo(",\n\t\tf2=" + spnEffectsz);
}
}
if(drpPwrStat == "pwr.chisq.test") {
echo("pwr.chisq.test(");
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Effect size") {
echo("\n\t\tw=" + spnEffectsz);
}
- if(radPwrParam != "sample") {
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Sample size") {
+ if(radPwrParam != "Effect size") {
echo(",");
}
echo("\n\t\tN=" + pwrSpinSample0);
@@ -117,11 +117,11 @@
if(drpPwrProptype == "one.sample") {
echo("pwr.p.test(");
}
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Effect size") {
echo("\n\t\th=" + spnEffectsz);
}
- if(radPwrParam != "sample") {
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Sample size") {
+ if(radPwrParam != "Effect size") {
echo(",");
}
if(drpPwrProptype != "two.sample.diff") {
@@ -139,24 +139,24 @@
}
if(drpPwrStat == "pwr.norm.test") {
echo("pwr.norm.test(");
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Effect size") {
echo("\n\t\td=" + spnEffectsz);
}
- if(radPwrParam != "sample") {
- if(radPwrParam != "effect") {
+ if(radPwrParam != "Sample size") {
+ if(radPwrParam != "Effect size") {
echo(",");
}
echo("\n\t\tn=" + pwrSpinSample0);
}
}
- if(radPwrParam != "significance") {
+ if(radPwrParam != "Significance level") {
if(spnSgnfcncl != 0.05) {
echo("\n\t\tsig.level=" + spnSgnfcncl + ",");
}
} else {
echo(",\n\t\tsig.level=NULL");
}
- if(radPwrParam != "power") {
+ if(radPwrParam != "Power") {
echo(",\n\t\tpower=" + spnPower);
}
if(drpPwrStat == "pwr.t.test" & drpPwrType != "two.sample.diff" & drpPwrType != "two.sample") {
@@ -172,9 +172,29 @@
function printout(){
// printout the results
- echo("rk.header(\"Power analysis results\")\n");
- echo("rk.print(pwr.result)\n");
+
+ var drpPwrStat = getValue("drp_pwr_stat");
+ var radPwrParam = getValue("rad_pwr_param");
+ echo("\t# Prepare printout\n" + "\tmethod <- pwr.result[[\"method\"]]\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" + "\tpwr.result[c(\"method\", \"note\", \"alternative\")] <- NULL\n" + "\tpwr.result <- as.data.frame(unlist(pwr.result))\n" + "\tcolnames(pwr.result) <- \"Parameters\"\n\n" + "\trk.header(method, parameters=parameters)\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");
Modified: branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.xml
===================================================================
--- branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.xml 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/inst/rkward/plugins/Poweranalysis.xml 2014-10-05 18:46:36 UTC (rev 4876)
@@ -5,10 +5,10 @@
<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" />
- <convert id="pwr_lgc_effect" sources="rad_pwr_param.string" mode="equals" standard="effect" />
- <convert id="pwr_lgc_signif" sources="rad_pwr_param.string" mode="equals" standard="significance" />
+ <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" />
<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" />
@@ -21,14 +21,16 @@
<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_nopairs" sources="drp_pwr_type.string" mode="notequals" 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_nopairs;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" />
@@ -53,8 +55,8 @@
<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_tunpaired;pwr_lgc_2p" mode="or" />
- <convert id="pwr_lgc_smpl_nondefault" sources="pwr_lgc_ttest;pwr_lgc_2p;pwr_txt_smpl_ps;pwr_lgc_anova;pwr_lgc_chisq" mode="or" />
+ <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" />
@@ -94,14 +96,14 @@
<connect governor="pwr_lgc_alt_warn_pos" client="pwr_txt_hypothesis_pos.visible" />
</logic>
<dialog label="Power analysis">
- <row id="row_cTTPPSES2E">
- <column id="clm_fTTPPSES2E">
+ <row id="row_cTTPPPSSEE">
+ <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" />
- <option label="Effect size" value="effect" />
- <option label="Significance level" value="significance" />
+ <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" />
</radio>
<stretch />
<radio id="rad_pwr_param_2samples" label="Estimate">
@@ -157,89 +159,87 @@
</column>
<column id="clm_fKKPP0801P">
<frame label="Known measures" id="frm_Knwnmsrs">
- <frame id="frm_fPP0801PP0">
- <frame id="frm_spnbPP0801">
- <spinbox label="Power" id="spn_Power" initial="0.8" min="0" max="1" />
- </frame>
- <frame id="frm_sD301D301D">
- <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" />
- <spinbox label="Degrees of freedom for denominator" id="pwr_spin_dfv" initial="30" min="1" type="integer" />
- </frame>
- <frame id="frm_sS0301F130">
- <spinbox label="Sample size" id="pwr_spin_sample0" initial="30" min="1" type="integer" />
- <spinbox label="First sample" id="pwr_spin_sample1" initial="30" min="1" type="integer" />
- <spinbox label="Second sample" 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>
+ <frame id="frm_spnbPP0801">
+ <spinbox label="Power" id="spn_Power" initial="0.8" min="0" max="1" />
</frame>
+ <frame id="frm_sD301D301D">
+ <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" />
+ <spinbox label="Degrees of freedom for denominator" id="pwr_spin_dfv" initial="30" min="1" type="integer" />
+ </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>
Modified: branches/external_plugins/rk.power/inst/rkward/rk.power.pluginmap
===================================================================
--- branches/external_plugins/rk.power/inst/rkward/rk.power.pluginmap 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/inst/rkward/rk.power.pluginmap 2014-10-05 18:46:36 UTC (rev 4876)
@@ -14,7 +14,7 @@
name="rk.power"
shortinfo="RKWard GUI to perform power analysis and sample size estimation."
longinfo="RKWard GUI to perform power analysis and sample size estimation."
- version="0.01-1"
+ version="0.01-2"
releasedate="2014-10-05"
url="http://rkward.sf.net"
license="GPL (>= 3)"
Modified: branches/external_plugins/rk.power/inst/rkward/rkwarddev_power_plugin_script.R
===================================================================
--- branches/external_plugins/rk.power/inst/rkward/rkwarddev_power_plugin_script.R 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/inst/rkward/rkwarddev_power_plugin_script.R 2014-10-05 18:46:36 UTC (rev 4876)
@@ -18,7 +18,7 @@
person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de", role=c("aut","cre"))),
about=list(desc="RKWard GUI to perform power analysis and sample size estimation.",
- version="0.01-1", url="http://rkward.sf.net")
+ version="0.01-2", url="http://rkward.sf.net")
)
dependencies.info <- rk.XML.dependencies(
dependencies=list(rkward.min=ifelse(isTRUE(guess.getter), "0.6.0", "0.5.6"),
@@ -27,10 +27,10 @@
pwr.parameter.rad <- rk.XML.radio(label="Parameter to determine", options=list(
- "Power of test"=c(val="power", chk=TRUE),
- "Sample size"=c(val="sample"),
- "Effect size"=c(val="effect"),
- "Significance level"=c(val="significance")
+ "Power of test"=c(val="Power", chk=TRUE),
+ "Sample size"=c(val="Sample size"),
+ "Effect size"=c(val="Effect size"),
+ "Significance level"=c(val="Significance level")
), id.name="rad_pwr_param")
pwr.parameter.twosamples.rad <- rk.XML.radio(label="Estimate", options=list(
@@ -91,8 +91,8 @@
pwr.input.dfv <- rk.XML.spinbox(label="Degrees of freedom for denominator", id.name="pwr_spin_dfv", min=1, real=FALSE, initial=30)
pwr.input.sample <- rk.XML.spinbox(label="Sample size", id.name="pwr_spin_sample0", min=1, real=FALSE, initial=30)
-pwr.input.sample.n1 <- rk.XML.spinbox(label="First sample", id.name="pwr_spin_sample1", min=1, real=FALSE, initial=30)
-pwr.input.sample.n2 <- rk.XML.spinbox(label="Second sample", id.name="pwr_spin_sample2", min=1, real=FALSE, initial=30)
+pwr.input.sample.n1 <- rk.XML.spinbox(label="First sample size", id.name="pwr_spin_sample1", min=1, real=FALSE, initial=30)
+pwr.input.sample.n2 <- rk.XML.spinbox(label="Second sample size", id.name="pwr_spin_sample2", min=1, real=FALSE, initial=30)
pwr.txt.sample.default <- rk.XML.text("Number of observations", id.name="pwr_txt_smpl")
pwr.txt.sample.ps <- rk.XML.text("Number of observations <b>per sample</b>", id.name="pwr_txt_smpl_ps")
pwr.txt.sample.pg <- rk.XML.text("Number of observations <b>per group</b>", id.name="pwr_txt_smpl_pg")
@@ -142,35 +142,33 @@
),
rk.XML.col(
rk.XML.frame(
- rk.XML.frame(
- pwr.frame.power <- rk.XML.frame(pwr.input.power),
- pwr.frame.df <- rk.XML.frame(
- pwr.input.df,
- pwr.input.dfu,
- pwr.input.dfv
- ),
+ pwr.frame.power <- rk.XML.frame(pwr.input.power),
+ pwr.frame.df <- rk.XML.frame(
+ pwr.input.df,
+ pwr.input.dfu,
+ pwr.input.dfv
+ ),
pwr.frame.sample <- rk.XML.frame(
- pwr.input.sample,
- pwr.input.sample.n1,
- pwr.input.sample.n2,
- pwr.txt.sample.default,
- pwr.txt.sample.ps,
- pwr.txt.sample.pg,
- pwr.txt.sample.tt,
- pwr.txt.sample.pairs
- ),
+ pwr.input.sample,
+ pwr.input.sample.n1,
+ pwr.input.sample.n2,
+ pwr.txt.sample.default,
+ pwr.txt.sample.ps,
+ pwr.txt.sample.pg,
+ pwr.txt.sample.tt,
+ pwr.txt.sample.pairs
+ ),
pwr.frame.effect <- rk.XML.frame(
- pwr.input.effect,
- pwr.txt.effect.d,
- pwr.txt.effect.r,
- pwr.txt.effect.f,
- pwr.txt.effect.e2,
- pwr.txt.effect.f2,
- pwr.txt.effect.w,
- pwr.txt.effect.h
- ),
- pwr.frame.signif <- rk.XML.frame(pwr.input.signif)
+ pwr.input.effect,
+ pwr.txt.effect.d,
+ pwr.txt.effect.r,
+ pwr.txt.effect.f,
+ pwr.txt.effect.e2,
+ pwr.txt.effect.f2,
+ pwr.txt.effect.w,
+ pwr.txt.effect.h
),
+ pwr.frame.signif <- rk.XML.frame(pwr.input.signif),
rk.XML.stretch(),
save.results.pwr,
label="Known measures"
@@ -184,10 +182,10 @@
## logic section
lgc.sect.pwr <- rk.XML.logic(
- pwr.gov.want.power <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="power"), id.name="pwr_lgc_power"),
- pwr.gov.want.sample <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="sample"), id.name="pwr_lgc_sample"),
- pwr.gov.want.effect <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="effect"), id.name="pwr_lgc_effect"),
- pwr.gov.want.signif <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="significance"), id.name="pwr_lgc_signif"),
+ pwr.gov.want.power <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="Power"), id.name="pwr_lgc_power"),
+ pwr.gov.want.sample <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="Sample size"), id.name="pwr_lgc_sample"),
+ pwr.gov.want.effect <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="Effect size"), id.name="pwr_lgc_effect"),
+ pwr.gov.want.signif <- rk.XML.convert(sources=list(string=pwr.parameter.rad), mode=c(equals="Significance level"), id.name="pwr_lgc_signif"),
rk.XML.connect(governor=pwr.gov.want.power, client=pwr.frame.power, set="enabled", not=TRUE),
rk.XML.connect(governor=pwr.gov.want.effect, client=pwr.frame.effect, set="enabled", not=TRUE),
rk.XML.connect(governor=pwr.gov.want.signif, client=pwr.frame.signif, set="enabled", not=TRUE),
@@ -201,14 +199,16 @@
pwr.gov.meth.norm <- rk.XML.convert(sources=list(string=pwr.stat.drop), mode=c(equals="pwr.norm.test"), id.name="pwr_lgc_norm"),
pwr.gov.meth.proptest.same <- rk.XML.convert(sources=list(string=pwr.proptype.drop), mode=c(equals="two.sample.same"), id.name="pwr_lgc_sample_2p_same"),
pwr.gov.meth.proptest.diff <- rk.XML.convert(sources=list(string=pwr.proptype.drop), mode=c(equals="two.sample.diff"), id.name="pwr_lgc_sample_2p_diff"),
+ pwr.gov.meth.ttest.typesame <- rk.XML.convert(sources=list(string=pwr.type.drop), mode=c(equals="two.sample"), id.name="pwr_lgc_sample_t_same"),
pwr.gov.meth.ttest.2diff <- rk.XML.convert(sources=list(string=pwr.type.drop), mode=c(equals="two.sample.diff"), id.name="pwr_lgc_sample_t_diff"),
pwr.gov.meth.ttest.pairs <- rk.XML.convert(sources=list(string=pwr.type.drop), mode=c(equals="paired"), id.name="pwr_lgc_sample_t_pairs"),
- pwr.gov.meth.ttest.nopairs <- rk.XML.convert(sources=list(string=pwr.type.drop), mode=c(notequals="paired"), id.name="pwr_lgc_sample_t_nopairs"),
+ pwr.gov.meth.ttest.single <- rk.XML.convert(sources=list(string=pwr.type.drop), mode=c(equals="one.sample"), id.name="pwr_lgc_sample_t_onesample"),
pwr.gov.meth.2ptest <- rk.XML.convert(sources=list(pwr.gov.meth.proptest.same, pwr.gov.meth.proptest), mode=c(and=""), id.name="pwr_lgc_2p"),
pwr.gov.meth.2p2ntest <- rk.XML.convert(sources=list(pwr.gov.meth.proptest.diff, pwr.gov.meth.proptest), mode=c(and=""), id.name="pwr_lgc_2p2n"),
+ pwr.gov.meth.ttest.same <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.typesame, pwr.gov.meth.ttest), mode=c(and=""), id.name="pwr_lgc_tsame"),
pwr.gov.meth.ttest.diff <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.2diff, pwr.gov.meth.ttest), mode=c(and=""), id.name="pwr_lgc_tdiff"),
pwr.gov.meth.ttest.paired <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.pairs, pwr.gov.meth.ttest), mode=c(and=""), id.name="pwr_lgc_tpaired"),
- pwr.gov.meth.ttest.unpaired <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.nopairs, pwr.gov.meth.ttest), mode=c(and=""),
+ pwr.gov.meth.ttest.onesample <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.single, pwr.gov.meth.ttest), mode=c(and=""),
id.name="pwr_lgc_tunpaired"),
rk.XML.connect(governor=pwr.gov.meth.proptest, client=pwr.type.drop, set="visible", not=TRUE),
@@ -239,11 +239,12 @@
rk.XML.connect(governor=pwr.gov.meth.anova, client=pwr.input.groups, set="enabled"),
# text for sample size
- pwr.gov.smpl.ps <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.unpaired, pwr.gov.meth.2ptest), mode=c(or=""), id.name="pwr_lgc_smpl_ps"),
+ pwr.gov.smpl.ps <- rk.XML.convert(sources=list(pwr.gov.meth.ttest.same, pwr.gov.meth.ttest.onesample, pwr.gov.meth.2ptest), mode=c(or=""), id.name="pwr_lgc_smpl_ps"),
pwr.gov.smpl.nondefault <- rk.XML.convert(sources=list(
pwr.gov.meth.ttest,
pwr.gov.meth.2ptest,
- pwr.txt.sample.ps,
+ pwr.gov.meth.2p2ntest,
+ pwr.gov.meth.ttest.diff,
pwr.gov.meth.anova,
pwr.gov.meth.chisq), mode=c(or=""), id.name="pwr_lgc_smpl_nondefault"),
rk.XML.connect(governor=pwr.gov.smpl.ps, client=pwr.txt.sample.ps, set="visible"),
@@ -303,7 +304,7 @@
ite(id(pwr.type.drop, " == \"two.sample.diff\""),
rk.paste.JS(# yes
echo("pwr.t2n.test("),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
echo("\n\t\tn1=", pwr.input.sample.n1, ",\n\t\tn2=", pwr.input.sample.n2),
ite(id(pwr.parameter.twosamples.rad, " == \"n2\""),
echo("\n\t\tn1=", pwr.input.sample.n1, ","),
@@ -313,14 +314,14 @@
),
rk.paste.JS(#no
echo("pwr.t.test("),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
echo("\n\t\tn=", pwr.input.sample)
)
)
),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
rk.paste.JS(
- ite(id(pwr.parameter.rad, " != \"sample\""), echo(",")),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""), echo(",")),
echo("\n\t\td=", pwr.input.effect)
)
)
@@ -331,12 +332,12 @@
ite(id(pwr.stat.drop, " == \"pwr.r.test\""),
rk.paste.JS(
echo("pwr.r.test("),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
echo("\n\t\tn=", pwr.input.sample)
),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
rk.paste.JS(
- ite(id(pwr.parameter.rad, " != \"sample\""), echo(",")),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""), echo(",")),
echo("\n\t\tr=", pwr.input.effect)
)
)
@@ -348,10 +349,10 @@
rk.paste.JS(
echo("pwr.anova.test("),
echo("\n\t\tk=", pwr.input.groups),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
echo(",\n\t\tn=", pwr.input.sample)
),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
ite(id(pwr.effect.etasq.rad, " == \"f\""),
echo(",\n\t\tf=", pwr.input.effect),
echo(",\n\t\tf=sqrt(", pwr.input.effect,"/(1-", pwr.input.effect,")) # calculate f from eta squared")
@@ -364,14 +365,14 @@
ite(id(pwr.stat.drop, " == \"pwr.f2.test\""),
rk.paste.JS(
echo("pwr.f2.test("),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
echo(",\n\t\tu=", pwr.input.dfu, ",\n\t\tv=", pwr.input.dfv),
ite(id(pwr.parameter.twodf.rad, " == \"v\""),
echo("\n\t\tu=", pwr.input.dfu),
echo("\n\t\tv=", pwr.input.dfv)
)
),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
rk.paste.JS(
echo(",\n\t\tf2=", pwr.input.effect)
)
@@ -383,12 +384,12 @@
ite(id(pwr.stat.drop, " == \"pwr.chisq.test\""),
rk.paste.JS(
echo("pwr.chisq.test("),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
echo("\n\t\tw=", pwr.input.effect)
),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
rk.paste.JS(
- ite(id(pwr.parameter.rad, " != \"effect\""), echo(",")),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""), echo(",")),
echo("\n\t\tN=", pwr.input.sample)
)
),
@@ -402,12 +403,12 @@
ite(id(pwr.proptype.drop, " == \"two.sample.same\""), echo("pwr.2p.test(")),
ite(id(pwr.proptype.drop, " == \"two.sample.diff\""), echo("pwr.2p2n.test(")),
ite(id(pwr.proptype.drop, " == \"one.sample\""), echo("pwr.p.test(")),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
echo("\n\t\th=", pwr.input.effect)
),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
rk.paste.JS(
- ite(id(pwr.parameter.rad, " != \"effect\""), echo(",")),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""), echo(",")),
ite(id(pwr.proptype.drop, " != \"two.sample.diff\""),
echo("\n\t\tn=", pwr.input.sample),
echo("\n\t\tn1=", pwr.input.sample.n1, ",\n\t\tn2=", pwr.input.sample.n2)
@@ -427,22 +428,22 @@
ite(id(pwr.stat.drop, " == \"pwr.norm.test\""),
rk.paste.JS(
echo("pwr.norm.test("),
- ite(id(pwr.parameter.rad, " != \"effect\""),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""),
echo("\n\t\td=", pwr.input.effect)
),
- ite(id(pwr.parameter.rad, " != \"sample\""),
+ ite(id(pwr.parameter.rad, " != \"Sample size\""),
rk.paste.JS(
- ite(id(pwr.parameter.rad, " != \"effect\""), echo(",")),
+ ite(id(pwr.parameter.rad, " != \"Effect size\""), echo(",")),
echo("\n\t\tn=", pwr.input.sample)
)
)
)
),
- ite(id(pwr.parameter.rad, " != \"significance\""),
+ ite(id(pwr.parameter.rad, " != \"Significance level\""),
ite(id(pwr.input.signif, " != 0.05"), echo("\n\t\tsig.level=", pwr.input.signif, ",")),
echo(",\n\t\tsig.level=NULL")
),
- ite(id(pwr.parameter.rad, " != \"power\""),
+ ite(id(pwr.parameter.rad, " != \"Power\""),
echo(",\n\t\tpower=", pwr.input.power)
),
ite(id(pwr.stat.drop, " == \"pwr.t.test\" & ", pwr.type.drop, " != \"two.sample.diff\" & ", pwr.type.drop, " != \"two.sample\""),
@@ -457,10 +458,46 @@
)
pwr.js.print <- rk.paste.JS(
- echo("rk.print(pwr.result)\n")
+ rk.JS.vars(list(pwr.stat.drop, pwr.parameter.rad)),
+ echo(
+ "\t# Prepare printout\n",
+ "\tmethod <- pwr.result[[\"method\"]]\n",
+ "\tnote <- pwr.result[[\"note\"]]\n",
+ "\tparameters <- list(\"Target measure\"=\"", pwr.parameter.rad, "\")\n",
+ "\tif(!is.null(pwr.result[[\"alternative\"]])){\n\t\tparameters[[\"alternative\"]] <- pwr.result[[\"alternative\"]]\n\t}\n\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.header(method, parameters=parameters)\n",
+ "\trk.results(pwr.result)\n",
+ "\tif(!is.null(note)){\n\t\trk.print(paste(\"<strong>Note:</strong> \", note))\n\t}\n\n"
+ ),
+ ite(id(pwr.stat.drop, " == \"pwr.t.test\" | ", pwr.stat.drop, " == \"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")
+ ),
+ ite(id(pwr.stat.drop, " == \"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")
+ ),
+ ite(id(pwr.stat.drop, " == \"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")
+ ),
+ ite(id(pwr.stat.drop, " == \"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")
+ ),
+ ite(id(pwr.stat.drop, " == \"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")
+ ),
+ ite(id(pwr.stat.drop, " == \"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")
+ )
)
-
#############
## if you run the following function call, files will be written to tempdir!
#############
@@ -474,7 +511,7 @@
dialog=pwr.full.dialog,
logic=lgc.sect.pwr
),
- js=list(#results.header=FALSE,
+ js=list(results.header=FALSE,
require="pwr",
calculate=pwr.js.calc,
printout=pwr.js.print),
Modified: branches/external_plugins/rk.power/man/rk.power-package.Rd
===================================================================
--- branches/external_plugins/rk.power/man/rk.power-package.Rd 2014-10-05 08:29:11 UTC (rev 4875)
+++ branches/external_plugins/rk.power/man/rk.power-package.Rd 2014-10-05 18:46:36 UTC (rev 4876)
@@ -10,9 +10,9 @@
\tabular{ll}{
Package: \tab rk.power\cr
Type: \tab Package\cr
-Version: \tab 0.01-1\cr
+Version: \tab 0.01-2\cr
Date: \tab 2014-10-05\cr
-Depends: \tab rkward (>= 0.5.6)\cr
+Depends: \tab rkward (>= 0.5.6)\cr
Enhances: \tab rkward\cr
License: \tab GPL (>= 3)\cr
LazyLoad: \tab yes\cr
More information about the rkward-tracker
mailing list