[R] Power calculation for the time series experiment

Greg Snow Greg.Snow at intermountainmail.org
Wed Jul 11 18:38:34 CEST 2007

The built in power functions are for the fairly straight forward
situations.  Yours does not appear to fit into any of those.  You need
to think through your problem a bit more before starting to think about

What do you mean by effect size of 1.5 (is that 1.5 standard deviations?
Or raw units? What is the SD?  Is the effect of 1.5 the same at each
time point? Or would it change?)

How do you plan on analyzing the data?  Manova? Lme?

What do you expect the correlation structure to be?

I would suggest creating a dataset that represents the structure that
you expect (includes the time points, treatment group, and any thing
else).  Then fill in the response with random data (rnorm to start,
mvrnorm may be useful for the correlated part).  Now analyze this data
with the tool you plan to use to make sure that it works and gives the
expected output.

Now take the code you used above and create a function or set of lines
such that it is easy to change things like the overall sample size, the
correlation(s), the SD and/or effect size.  Have the result of the
function or code be the p-value of interest.

Now use the replicate function to run this code/function a bunch of
times, the number of times that the p-value is less than your alpha is
your estimate of the power for that set of conditions.  Now change some
conditions (sample size, correlation, ...) and repeate.

Hope this helps,

Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of A Ezhil
> Sent: Wednesday, July 11, 2007 8:15 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Power calculation for the time series experiment
> Hi All,
> We are planning to run an experiment, where samples will be 
> taken at different time points (say, 0, 4, 8, 16, 24). If I 
> am interested in the effect size of 1.5 for a reasonably 
> large samples (say 500), what will be the power? Is it a good 
> idea to use F-test (one-way
> ANOVA) as my test statistics?  How can we include correlation 
> structure among samples in the power analysis, if I use 
> one-way ANOVA design? 
> I am aware of power.anova.test() in R that will help me to do 
> power calculation for one-way ANOVA.  It will be of great 
> help if you send me some related articles or pointers to some 
> useful resources.
> Thanks in advance.
> Kind regards,
> Ezhil
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list