fix_sample_pow: Simulation of the sample size , the type I error rate and the...

Description Usage Arguments Value Author(s)

Description

This is an auxiliary function. It calculates the sample size , simulated type I error rate and the simulated power of a fixed-sample design. The originally planned sample size is calculated on the basis of an assumed standard deviation. A distinction is made between one-sided and two-sided tests. The test statistic is compared to the quantiles of the t-distribution.

Usage

1
2
fix_sample_pow(sd_ber, delta = 0, Delta, sd, test = 1, alpha = 0.05, beta = 0.2,
               simu = 10000)

Arguments

sd_ber

Vector of numbers. Interval of an area for the actual standard deviation in the data.

delta

Number. Expectation difference of two samples.
If you select a Test for superiority/ difference then select 'delta = 0'.
Only if you select a Test for non-inferiority you can select 'delta != 0'.
Attention: If you chose 'test = 1' and 'delta != 0', the test for non-inferiority will automatically
be applied.
If not specified, delta is set to 0.

Delta

Number. Relevant difference of expected values in the alternative hypothesis.

sd

Number. Assumed standard deviation of the data.
Used to calculate the originally planned sample size.

test

Number. What type of hypothesis test should be performed, one-sided (Superiority/
Non-Inferiority test) or two-sided (Test for difference).
One-sided (test = 1): Superiortity H0: mu_x - mu_y <= 0 vs. H1: mu_x - mu_y >0
Non-Inferiority H0: mu_x - mu_y >= delta vs. H1: mu_x - mu_y < delta
Two-sided (test = 2): Difference H0: |mu_x - mu_y| = 0 vs. H1: |mu_x - mu_y| != 0
Attention: Choice of delta. (see delta)
If not specified, the one-Sided Test (Superiority/ Non-Inferiority Test) is used.

alpha

Number. Desired alpha-level of the test.
If not specified, alpha is set to 0.05.

beta

Number. Acceptable beta error of the test.
If not specified, beta is set to 0.2.

simu

Number. How many simulations should be performed?
If not specified, simu is set to 10000.

Value

This function only creates the sample size, type I error rate and Power values for multiple actual standard deviation values.
The output is used in the function sample_pow to visualize the sample size, the type I error rate and the power.

Author(s)

Csilla van Lunteren

@seealso fix_calc


vanLunteren/plan_norm documentation built on May 20, 2019, 12:32 p.m.