S-Plus functions for computing statistical power, binomial.sample.size and normal.sample.size (accessible via pull-down menus under Statistics --> Power and Sample Size) are good, but limited in scope. You can use these functions to compute power and sample size requirements for one and two-sample tests of proportions (binomial.sample.size) or to compute power and sample size requirements for one and two-sample t-tests (normal.sample.size), but not to compute power and sample size for general linear models, including ANOVA and regression.
Daniel Heitjan has written a set of four S-Plus functions to do compute power and sample size requirements for general linear models, following the methods of Muller & Peterson (1984):
pfnc: computes power of F-tests
pchisqnc: computes power of Chi-Square tests
glhpwr: computes power of General Linear Models
sscomp: computes minimum sample size requirements for General Linear Models.
Daniel Heitjan made these functions available to the academic community through StatLib. You should read about StatLib to understand how the statistical community interacts regarding software sharing.
These power and sample size functions are available for your use. The on-line documentation is opaque (but can be read by typing help(name.of.function) at the S-Plus command prompt), and assumes a fairly sophisticated understanding of matrix algebra and general linear models. Nonetheless, the functions work.
Here's what you have to do:
1. Before you start an S-Plus session, you need to map a network drive.
2. Map a network drive by right-clicking on the Network Neighborhood
icon on the Windows desktop, and selecting Map Network Drive...
from the pull-down menu. The following dialog box appears:
Accept the default Drive letter (in this example, it is H:), but remember it!
In the Path box, enter \\ambr\pecology
and then press the OK button.
3. Begin your S-Plus session.
4. In the Object Browser window, right-click on the SearchPath
icon in the left-hand panel of the window, and select Attach
Database... from the pull-down menu.
The following dialog box appears:
In the Database Path or Object Name, enter DRIVE:\s
where DRIVE is the Drive letter you saw in the Map Network Drive dialog box above. Be sure to type a colon (:) after the drive letter, followed by a backslash (\) followed by the letter s (in this example, the drive is H, so you would type H:\s in the Databaes Path or Object Name box).
Change the value in the Position box from 1 to 2
Press the OK button
5. All of the commands for power analysis must be entered in the Command Window, but first you have to attach your dataset.
6. In the Command Window of S-Plus, type the command attach(name_of_your_dataset), where name_of_your_dataset is the name that you gave to your dataset (such as vtcensus97).
7. Now you're ready to use the functions for power analysis.
8. See the on-line documentation for the syntax for each command.
9. An S-Plus Script file, powtest.ssc, is also in the s directory on \\ambr\pecology. This file contains examples of commands for using the functions for power analysis and sample size calculations. You can open this script file in the S-Plus Script editor, and run them from there (press F-10 once you have the Script file loaded). See Chapter 21 of the S-Plus user's manual for information on using S-Plus scripts and the S-Plus script editor.
10. When you exit S-Plus, do not save the changed Object Browser.
Reference
Muller,
K. E. and B. L. Peterson. 1984. Practical methods for computing
power in testing the multivariate general linear hypothesis. Computational
Statistics and Data Analysis 2: 143-158.
|
|
|
|
|
|
|
|
||||