ztest.pow: 'ztest' power function

Description Usage Arguments Note References See Also Examples

Description

Compute the power of the one-sample equivalence test for population means of normal summary values with known population variance.

Usage

1
2
ztest.pow(rho, tau.u, alpha, sigma, norm = 1, support = c(-Inf, Inf),
  log = FALSE)

Arguments

rho

vector of quantile

tau.u

Upper boundary point of the equivalence region

alpha

Level of the equivalence test

sigma

Standard deviation of the test statistic.

norm

Normalization constant for the truncated power function.

support

Support of the truncated power function (vector of dimension 2).

log

If TRUE, the power function is returned on the log scale.

Note

The power function can be truncated to support and then standardized with norm. If one of these is set, the other must be provided too.

References

http://arxiv.org/abs/1305.4283

See Also

ztest.pow.norm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# power function of the Z-test,
# to test the equivalence of autocorrelations of normal summary values in the MA(1) model

n2s		<- function(n){ 1/sqrt(floor(n)-3) }	#need formula to convert n.of.y into s.of.T
s2n		<- function(s){ (1/s)^2+3 }				#need formula to convert s.of.T into n.of.y
n.of.y	<- 1500		#number of independent pairs of the form (y_t, y_{t+1}) for simulated summary values y_t, t=1, ...

#	reasonable power properties of the ABC accept/reject step

rho		<- seq(-0.3,0.3,0.001)
tau.u	<- 0.09
tmp		<- data.table(rho=rho, power=ztest.pow(rho, tau.u, alpha=0.01, n2s(n.of.y)))
p		<- ggplot(tmp,aes(x=rho,y=power)) + geom_line() + labs(y='Power\n(ABC acceptance probability)')
print(p)

# power increases with tau.u and becomes flat

tmp <- lapply(c(0.06,0.07,0.08,0.1,0.15,0.2),function(tau.u)
		{
			data.table(tau.u=as.factor(tau.u),rho=rho,power=ztest.pow(rho, tau.u, alpha=0.01, n2s(n.of.y)), tau.u=tau.u)
		})
tmp	<- do.call('rbind', tmp)
p <- ggplot(tmp,aes(x=rho,y=power,colour=tau.u,group=tau.u)) + geom_line() + labs(y='Power\n(ABC acceptance probability)')
print(p)

# power increases with n.of.y and becomes flat

tau.u <- 0.1
tmp <- lapply(c(750,1000,1500,3000),function(n.of.y)
		{
			data.table(n.of.y=as.factor(n.of.y),rho=rho,power=ztest.pow(rho, tau.u, alpha=0.01, n2s(n.of.y)),n.of.y=n.of.y)
		})
tmp	<- do.call('rbind', tmp)
p <- ggplot(tmp,aes(x=rho,y=power,colour=n.of.y,group=n.of.y)) + geom_line() + labs(y='Power\n(ABC acceptance probability)')
print(p)

olli0601/abc.star documentation built on May 24, 2019, 12:53 p.m.