Diff for "FAQ/power/pPow" - CBU statistics Wiki
location: Diff for "FAQ/power/pPow"
Differences between revisions 11 and 12
Revision 11 as of 2008-05-02 11:43:29
Size: 1416
Editor: PeterWatson
Comment:
Revision 12 as of 2013-03-08 10:17:14
Size: 1421
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
 See also [http://stat.ubc.ca/~rollin/stats/ssize/b1.html here.]  See also [[http://stat.ubc.ca/~rollin/stats/ssize/b1.html|here.]]
Line 3: Line 3:
Computes power for testing prop=const where prop and const are observed and expected (constant) proportions respectively, ntot is the total sample size and alpha is the (two-tailed) type I error. Power computation is also available using a [attachment:bin1.xls spreadsheet] and [:FAQ/Rpowprop:in R.] Computes power for testing prop=const where prop and const are observed and expected (constant) proportions respectively, ntot is the total sample size and alpha is the (two-tailed) type I error. Power computation is also available using a [[attachment:bin1.xls|spreadsheet]] and [[FAQ/Rpowprop|in R.]]

Computes power for testing prop=const where prop and const are observed and expected (constant) proportions respectively, ntot is the total sample size and alpha is the (two-tailed) type I error. Power computation is also available using a spreadsheet and in R.

[COPY AND PASTE THE SYNTAX BELOW INTO A SPSS SYNTAX WINDOW AND RUN; SET DATA AS DESIRED]

DATA LIST free
/prop const ntot alpha. 
BEGIN DATA. 
0.45 0.5 900 .05 
END DATA. 
set errors=none.
matrix.
get m /variables=prop const ntot alpha /missing=omit.
compute prop=make(1,1,0).
compute const=make(1,1,0).
compute ntot=make(1,1,0).
compute alpha=make(1,1,0).
compute prop=m(:,1).
compute const=m(:,1).
compute ntot=m(:,2).
compute alpha=m(:,3).
end matrix.
COMPUTE #chisq1 = ((prop-const)**2)/(const*(1-const)).
compute #df=1.
compute #conf = 1-alpha.
compute #chisq=ntot*#chisq1.
compute power = 1 - NCDF.CHISQ(IDF.CHISQ(#conf,#DF),#DF,#CHISQ).
formats prop (f5.2) const (f5.2) alpha (f5.2) ntot (f5.2) power (f5.2).
variable labels prop 'Proportion' const 'Constant' /alpha 'Two-Tailed Alpha' /ntot 'Total Sample Size' /power 'Power'.
report format=list automatic align(center)
  /variables=prop const alpha ntot power 
  /title "Power for given sample size for One sample test for a single proportion" .

None: FAQ/power/pPow (last edited 2013-03-08 10:17:14 by localhost)