Learn R Programming

sensR (version 1.5-2)

twoACpwr: Exact Power Computation for the 2-AC Discrimination Protocol

Description

Computes the exact power for the 2-AC protocol using the (signed) likelihood root statistic. Power is computed for a significance test of d-prime. The tol argument specifies the precision with which power should be computed.

Usage

twoACpwr(tau, d.prime, size, d.prime0 = 0, alpha = 0.05, tol = 1e-5, 
         return.dist = FALSE, statistic = "likelihood",
         alternative = c("two.sided", "less", "greater"))

Arguments

tau

the value of tau under the alternative hypothesis

d.prime

the value of d.prime under the alternative hypothesis

size

the sample size

d.prime0

the value of d-prime under the null hypothesis in the significance test for which power should be computed

alpha

the size of the test

tol

specifies the precision with which power should be computed, e.g., 1e-4 cause power to be computed correctly to three significant digits. Lower values of tau gives higher precision, but also longer computation times.

return.dist

should the p-value distribution be returned rather than the power be computed?

statistic

the statistic used in the significance test for which the power should be computed. Currently only the (signed) likelihood root statistic is available---se the details for more information.

alternative

the type of alternative hypothesis in the significance test for which the power should be computed

Value

A data.frame with one line and the following entries

power

the computed power

actual.alpha

the actual size of the test (different from the nominal alpha given as argument due to the discreteness of the observations).

samples

the number of possible outcomes for this size

discarded

the number of outcomes for which the p-value is not computed. This number is zero if tol = 0

kept

the number of outcomes for which the p-value is computed in. This number equals samples if tol = 0

p

the probability vector of the multinomial distribution implied by the values of tau and d.prime.

Details

The main idea in this function is to compute all possible data outcomes and then compute the p-value for the chosen significance test for each of these outcomes. This gives the exact distribution of p-values from which the exact power can be computed. This is basically what happens if tol = 0.

There is, however, a problem with this approach if size is large, since the the number of possible outcomes increases very fast with the size; the order is O(n^2). The solution to this problem is to ignore those outcomes which will occur with very small probability. Often, a large proportion of the outcomes, say 90% will occur so rarely that they account for, say 1e-4 percent of the probability mass; it is therefore safe to ignore those outcomes without compromising the accuracy of the computed power by any relevant amount. For more information see the referenced paper and the package vignette Statistical Methodology.

The Wald statistic is not available here. The reason is that the Wald statistic is not always defined and the problem is therefore what to do with those cases where it is not defined? On the other hand the likelihood root statistic is defined in all cases, so theres is no problem here, and since the likelihood root statistic is more accurate than the Wald statistic, there is not much reason to use the Wald statistic after all.

For the record; the Wald statistic is not defined, when the standard error of d-prime is not defined. This happens when the variance-covariance matrix of tau and d-prime is not defined, which occurs in a number of boundary cases, i.e., when one or more cells contain zero frequencies. Since these outcomes occur with positive probability, the algorithm used by twoACpwr will always encounter those cases and have to deal with them. This would be cumbersome to implement.

References

Christensen R.H.B., Lee H-S and Brockhoff P.B. (2011). Estimation of the Thurstonian model for the 2-AC protocol. Submitted to Food Quality and Preference.

See Also

clm2twoAC, twoACpwr

Examples

Run this code
# NOT RUN {
## Exact power: 
twoACpwr(tau = .5, d.prime = .7, size = 50, tol = 0)

## Power exact to a reasonable number of digits
twoACpwr(tau = .5, d.prime = .7, size = 50, tol = 1e-5)

## Power for a similarity test in a discrimination setting where the
## true parameter values are expected to be tau = 0.4 and true d.prime
## = .5, while we want to show that d.prime < 1, i.e., under the null
## hypothesis d.prime = 1:
twoACpwr(tau = .4, d.prime = .5, size = 100, d.prime0 = 1, tol = 1e-5, 
         alternative = "less")

## Power for a difference test in a preference setting where the true
## parameter values are expected to be tau = 0.4 and d.prime = -0.5,
## while we want to show that d.prime is different from zero:
twoACpwr(tau = 0.4, d.prime = -0.5, size = 100, d.prime0 = 0, tol = 1e-5, 
         alternative = "two.sided")

# }

Run the code above in your browser using DataLab