Re: [R] Power calculation with measurement error

From: Mike Lawrence <Mike.Lawrence_at_dal.ca>
Date: Tue, 26 Jun 2007 15:38:45 -0300

On 26-Jun-07, at 2:36 PM, Mike Lawrence wrote:
> On 26-Jun-07, at 8:12 AM, Mike Lawrence wrote:
>> Hi all,
>> Hopefully this will be quick, I'm looking for pointers to packages/
>> functions that would allow me to calculate the power of a t.test when
>> the DV has measurement error. That is, I understand that, ceteris
>> paribus, experiments using measure with more error (lower
>> reliability) will have lower power.
>
> I came across a reference (http://memetic.ca/reliability.pdf) that
> provides a formula for calculating the noncentrality parameter for
> tests using imperfect measures (see Eq. 4), as well as a table of
> some resulting power estimates. However, while I have created a (very
> slow) monte carlo function that so far as I can tell matches their
> results, when I attempt to implement their analytic solution it's way
> off. Can anyone see what I'm doing incorrectly?
>
> n=100
> r=.5 #reliability
> e=.5 #effect size
> delta=(sqrt(r*n)/2)*e
> power.t.test(n,delta,sig.level=.05,alternative='one.sided')
>
> Two-sample t test power calculation
>
> n = 100
> delta = 1.767767
> sd = 1
> sig.level = 0.05
> power = 1
> alternative = one.sided
>
> NOTE: n is number in *each* group
>
>
> Meanwhile, their tables and my monte carlo method say that the power
> in that circumstance should be .7

Found it; I was using power.t.test without being thorough in reading its details. Sorry for the spam, and for anyone that's interested, here's the final analytic solution:

#get power for a t.test, incorporating measurement error.
#n = total number of participants across your 2 groups
#r = estimated reliability of the measure used
#e = measured effect size
get.power=function(n,r,e,tails=2,alpha=.05){
	d=(sqrt(r*n)/2)*e
	a=1-ifelse(tails==2,alpha/2,alpha)
	p=1-pt(qt(a,n-2),n-2,d)
	return(p)

}

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. Received on Tue 26 Jun 2007 - 18:53:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Jun 2007 - 19:32:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.