clear all
close all
%
disp('Power Calculation for Repeated Measures')
lw = 3;
set(0, 'DefaultAxesFontSize', 16);
fs = 16;
msize = 10;
%
% For the repeated measures design a cohort of n subjects
% goes through all levels of a factor of interest.
% Suppose that rho is the correlation between scores for
% any two levels of the factor, that is, the circularity condition
% is satisfied.
% Then the noncentrality parameter lambda is
% n sum_i alpha_i^2 /((1-rho) sigma^2) = n k f^2/(1-rho),
% where the notation is the same as in the ANOVA case
% (n - number of subjects, k - number of treatments,
% alpha_i - the effect of the ith treatment, sigma^2 -
% model variance)
n=25; k=3; alpha=0.05; rho=0.6;
%f^2 = average alpha^2/variance
% = 1/k * sum(alpha_i^2) / sigma^2
%Cohen's effect sizes:
%f=0.1 small, f=0.25 medium, f=0.4 large;
f = 0.25;
lambda = n * k * f^2/(1-rho) %11.7188
power = 1-ncfcdf( finv(1-alpha, k-1, (n-1)*(k-1)),...
k-1, (n-1)*(k-1), lambda) %0.8526
n=25; k=3; alpha=0.05; barrho=0.6; eps=0.7;
f = 0.25;
lambda = n * k * f^2/(1-barrho) %11.7188
power = 1-ncfcdf( finv(1-alpha, eps*(k-1), eps*(n-1)*(k-1)),...
eps * (k-1), eps*(n-1)*(k-1), eps*lambda) %0.7464
%If epsilon is 0.8 and rho=0.6 is an average
%of
% G*Power
% ANOVA: Repeated measures, within factors
% effect size 0.25
% alpha 0.05
% beta 0.85
% number of groups 1
% number of measures 3
% corr among rep measures 0.6
% nonsphericity correction epsilon 1
%
% lambda = 11.71875
% critical F = 3.19
% numdf = 2
% denom df = 48
% total sample size = 25
% actual power = 0.852641