两组均数检验理论基础和样本量估计的PASS实现

2024-03-09 19:34   上海  

两组均数的样本量是老生常谈的内容,但为了让各位读者理解各种数据分布类型的假设检验,我们重新梳理下基本概念,并实例讲解增加理解。

1

优效     

 


1. Two-Sample T-Tests for Superiority by a Margin Assuming Equal Variance         

 

1.1 The Statistical Hypotheses         

 

1.2 Superiority by a Margin Tests    

1.3 Two-Sample Equal-Variance T-Test Statistic

1.4 Computing the Power    

2. Two-Sample T-Tests for Superiority by a Margin Allowing Unequal Variance         

 

2.1 Two-Sample Unequal-Variance T-Test (Welch’s T-Test) Statistic

2.2 Computing the Power    

3. Mann-Whitney U or Wilcoxon Rank-Sum Tests for Superiority by a Margin

3.1 Mann-Whitney U or Wilcoxon Rank-Sum Test Statistic

3.2 Computing the Power    

4. Superiority by a Margin Tests for the Ratio of Two Means (Log-Normal Data)

4.1 Superiority Testing Using Ratios

4.2 Log-Transformation    

4.3 Coefficient of Variation

4.4 Example 1 – Finding Power

A company has developed a drug for treating rheumatism and wants to show that it is superior to the standard drug by a certain amount. Responses following either treatment are known to follow a log normal distribution. A parallel-group design will be used, and the logged data will be analyzed with a two-sample t test. Researchers have decided to set the margin of superiority at 0.20. Past experience leads the researchers to set the COV to 1.50. The significance level is 0.025. The power will be computed assuming that the true ratio is either 1.30 or 1.40. Sample sizes between 100 and 1000 will be included in the analysis.    

第一步:参数录入

第二步:结果输出    

4.5 Example 2 – Validation using Another Procedure

我们用Two-Sample T-Tests for Superiority by a Margin Assuming Equal Variance板块来验证:

𝑆M= ln(1 + 𝑆M) = ln(1.2) = 0.182322

𝛿 = ln(𝑅1) = ln(1.3) = 0.262364

= ln(1.52 + 1) = 1.085659

第一步:参数录入    

第二部:结果输出

可以发现和example1红色高亮的power一致。         

 

5. Superiority by a Margin Tests for the Ratio of Two Means (Normal Data)

5.1 Superiority Testing Using Ratios

5.2 Coefficient of Variation

   

5.3 Power Calculation

5.4 Tests

5.4.1 Equal Variances T-Test

   

5.4.2 Unequal Variances Large Sample Z-Test

5.4.3 Unequal Variances Satterthwaite T-Test    

5.4.4 Unequal Variances Delta Method Z-Test    

2

非劣效   

 


和优效类似,只是界值的方向不一致。 

3

差异性检验      

 


The two-sample t-test is commonly used in this situation. When the variances of the two groups are unequal, Welch’s unequal-variance t-test is often used. When the data are not normally distributed, the Mann-Whitney U (or Wilcoxon Rank-Sum) test may be used.         

 

1.Technical Details    

2.Generating Random Distributions

3.Test Statistics

3.1 Two-Sample T-Test with Equal Variances    

3.2 Welch’s Unequal-Variance T-Test

3.3 Trimmed T-Test with Equal Variances    

3.4 Trimmed T-Test with Unequal Variances

3.5 Mann-Whitney U or Wilcoxon Rank-Sum Test    

4. Standard Deviations

Specify the distribution that represents the type of data you expect from your study.        

 

The possible distributions are Beta, Exponential, Gamma, Gumbel, Laplace, Logistic, Lognormal, Normal, Poisson, TukeyGH, Uniform, Weibull.       

 

All these distributions can be specified with a mean and standard deviation. The Beta and TukeyGH distributions each require two additional parameters. The Exponential and Poisson distributions require only the mean to be specified since the standard deviation can be computed from the mean.         

 

Normal vs. TukeyGH

Tukey's distribution can be used to generate values that are nearly Normal, with departure from normality controlled by entering skewness (G) and kurtosis (H) parameters. Tukey's distribution with G = H = 0 is equivalent to the Normal distribution.       

 

5. Example 1 – Power at Various Sample Sizes

         

 

   

Researchers are planning a parallel-group experiment to test whether the difference in response to a

certain drug is zero. The researchers will use a two-sided t-test with an alpha level of 0.05. They want to compare the power at sample sizes of 50, 100, and 200 when the shift in the means is 0.6 from drug 1 to drug 2. They assume that the data are normally distributed with a standard deviation of 2. Since this is an exploratory analysis, they set the number of simulation iterations to 2000.

第一步:参数录入

第二步:结果输出         

 

6. Example 2 – Comparative Results

         

 

第一步:参数录入,因为是对比各种方法,所以选择checked,然后会输出表和图。    

   

第二步:结果输出

由上表和图可知,在小中大样本中,power最大的是Welch,小样本和大样本中,一类错误最小的是T test和Welch,中样本最小的是trim type。    

7. Example 3 – Selecting a Test Statistic when the Data Contain Outliers

         

 

The two-sample t-test is known to be robust to the violation of some assumptions, but it is susceptible to inaccuracy because the data contain outliers. This example will investigate the impact of outliers on the power and precision of the five test statistics available in PASS.

A mixture of two normal distributions will be used to randomly generate outliers. The mixture will draw 95% of the data from a normal distribution with a mean of 0 and a standard deviation of 1. The other 5% of the data will come from a normal distribution with a mean of 0 and a standard deviation that ranges from 1 to 10.

第一步:参数录入,按照高亮的格式录入。

第二步:结果输出    

第一行给出了两个标准差(S 和 A)相等的标准情况的结果。    

请注意,在这种情况下,t 检验的功效略高于其他检验的功效。随着标准差的增加(A 等于 5,然后是 10),Trim检验和 Mann-Whitney检验的功效仍然很高,但 t 检验的功效从 88% 下降到 43%。此外,对于Trim检验和非参数检验,alpha 的值保持不变,但 t 检验的 alpha 变得非常保守。         

 

此模拟的结论是,如果存在异常值的可能性,则应使用非参数检验或Trim检验。         

 

8. Example 4– Selecting a Test Statistic when the Data are Skewed

         

 

The two-sample t-test is known to be robust to the violation of some assumptions, but it is susceptible to inaccuracy when the underlying distributions are skewed. This example will investigate the impact of skewness on the power and precision of the five test statistics available in PASS.

Tukey’s lambda distribution will be used because it allows the amount of skewness to be gradually

increased.

第一步:参数录入    

第二步:结果输出

   

第一行给出了没有偏度 (G = 0) 的标准情况的结果。请注意,在这种情况下,t 检验的功效略高于其他检验的功效。随着偏度的增加(G 等于 0.5,然后是 0.9),Trim检验和 Mann-Whitney 检验的功效增加,但 t 检验的功效大致相同。此外,alpha 的值在所有测试中都保持不变。         

 

此模拟的结论是,如果存在偏度,您将通过使用非参数或Trim检验来获得功效。        

 

Take home message              

 

1.通常使用双样本 t 检验。当两组的方差不相等时,通常使用Welch的不等方差t检验。当数据不是正态分布时,可以使用 Mann-Whitney U(或 Wilcoxon 秩和)检验。
2.如果存在异常值的可能性,则应使用非参数检验或Trim检验。
3.如果存在偏度,您将通过使用非参数或Trim检验来获得功效         

 

参考文献

PASS说明书

流行病学与卫生统计学
Pivot数据交流平台,每周分享临床试验研究设计、实施、统计等相关信息。
 最新文章