asypow.n: Asymptotic Sample Size

Description Usage Arguments Value References See Also Examples

View source: R/asypow.n.R

Description

Calculates the sample size required to obtain the desired power for a test via likelihood ratio methods.

Usage

1
       asypow.n(asypow.obj, power, significance)

Arguments

asypow.obj

The object returned from asypow.noncent.

power

The desired power of the test.

significance

The desired significance level of the test.

Value

Returns the sample size needed to achieve specified power at the specified significance level.

References

Cox, D.R. and Hinkley, D.V. (1974). Theoretical Statistics Chapman and Hall, London.

See Also

asypow.noncent, asypow.sig, asypow.power

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Three Sample Poisson Example :
#    Three independent Poisson processes produce events at
#    mean rates of 1, 2 and 3 per day. For how many days
#    must the processes be observed to have an 80% chance
#    of detecting that the means are different at an
#    overall significance level of 0.05?
# Step 1 : Find the information matrix
pois.mean <- c(1,2,3)
info.pois <- info.poisson.kgroup(pois.mean, group.size=3)
# Step 2: Create the constraints matrix
constraints <- matrix(c(2,1,2,2,2,3),ncol=3,byrow=TRUE)
# Step 3: Find the noncentrality parameter and
#         degrees of freedom for the test
poisson.object <- asypow.noncent(pois.mean, info.pois, constraints)
# Step 4: Compute sample size needed for 
#         0.8 power with significance level 0.05
n.pois <- asypow.n(poisson.object, 0.8, 0.05)
# Step 5: Divide the sample size by 3 (the number of processes)
#         to get the number of days required.
n.days <- n.pois/3
print(n.days)

asypow documentation built on May 2, 2019, 2:37 a.m.

Related to asypow.n in asypow...