# NOT RUN {
sgpower(true=2, null.lo=-1, null.hi=1, std.err=1, interval.type='confidence',
'interval.level'=0.05)
sgpower(true=0, null.lo=-1, null.hi=1, std.err=1, interval.type='confidence',
'interval.level'=0.05)
# plot the power curve
sigma = 5
n = 20
theta = seq(-10, 10, by=0.1)
power = sgpower(true=theta, null.lo=-1, null.hi=1, std.err=sigma/sqrt(n),
interval.type='confidence', interval.level=0.05)$power.alt
plot(theta, power, type='l', ylab='power')
# }
Run the code above in your browser using DataLab