From: jonas on 25 Sep 2009 16:39 Hello, I have a problem using the function sampsizepwr.m (from the statistics toolbox) to determine the power of a proposed population size in an experimental setup. Here is the documentation for this function: http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/sampsizepwr.html&http://www.bing.com/search?q=matlab+determine+power+variance\&go=&form=QBRE&qs=n I would like to calculate the power that I have do detect a difference between two population given a fixed sample size and alpha and taking into consideration both tails. I do understand the documentation and get a return value that seems sensible at first, however, the power I get for a given combination, lets say N=50, p2=0.2, p2=0.4 and alpha=0.05 is different from what online power calculators such as http://www.swogstat.org/Stat/Public/cgi-bin/binomial.exe give. Take an example, sampsizepwr('p',.2,.4,[],50) gives a power of 0.90, the online calculator gives 0.22. Does anyone know why this might be? Note that I tried a number of online calculators for this and they all agree, Matlab is the outlier. Thanks, Jonas
From: Peter Perkins on 25 Sep 2009 18:11 jonas wrote: > http://www.swogstat.org/Stat/Public/cgi-bin/binomial.exe Jonas, the above appears to be a power calculator for a test of the difference in binomial proportions, i.e., a 2-sample test ... > Take an example, sampsizepwr('p',.2,.4,[],50) gives a power of 0.90, > the online calculator gives 0.22. .... whereas SAMPSIZEPWR is computing power for a 1-sample test against a fully-specified null hypothesis. Not surprisingly, the power for the 2-sample test is much lower since both probabilities have to be estimated. This simulation reps = 10000; p0 = .2; p1 = .4; n = 50; x = binornd(n,p1,reps,1); xExp = p0*n; diff = abs(xExp - x); pval = binocdf(xExp - diff,n,p0) + 1-binocdf(xExp+diff,n,p0); ecdf(pval); xlabel('p-value'); ought to convince you that SAMPSIZEPWR is getting the right answer (check the value of the ECDF at .05 on the horizontal axis), even though it may not be the answer you're looking for. Hope this helps.
|
Pages: 1 Prev: Removing a data cursor programmatically Next: 3D Geometry |