Power analysis for two sample z-test
<p>I need to compute the power of the statistical test that has been performed on the data. I have 2 csv files that have a sample size of 50 per file.
The difference of means is statistically significant at the 0.05 level. The samples come from Normal distribution with unknown variance. </p>

<p>So I performed a z score test with the following code: X and Y are the two sample with sample size of 50 each.</p>

<pre><code>zTest &lt;- function(x, y) {
Difference &lt;- (mean(x) - mean(y)) # difference between the two sample means
seDifference &lt;- sqrt(((sd(x)^2)/length(x)) + ((sd(y)^2)/length(y))) #standard error for difference
zScore &lt;- Difference/seDifference # z score
return(zScore) # return z score
}
</code></pre>

<p>The Z score value that I get is -15.78006</p>

<p>Now I need to compute the power of the statistical test performed above. My question is how do I find out the power from here. What is the formula? and How do I apply it in R. If you are going to suggest to use the pwr package in R then please explain how it works.</p>

<p>Thanks in advance and apologies if I'm being vague. I am new to power analysis.</p>