likelihood ratio test、Wald test、score test
https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faqhow-are-the-likelihood-ratio-wald-and-lagrange-multiplier-score-tests-different-andor-similar/
https://bookdown.org/ltupper/340f21_notes/glm-inference-tests.html
https://data.princeton.edu/wws509/notes/c3s2
likelihood ratio test
似然比检验在假设检验中的地位如极大似然估计(MEL)在点估计中的地位
Wald test
With DESeq2, the Wald test is the default used for hypothesis testing when comparing two groups. The Wald test is a test of hypothesis usually performed on parameters that have been estimated by maximum likelihood.. In our case we are testing each gene model coefficient (LFC) which was derived using parameters like dispersion which were estimated using maximum likelihood.
DESeq2 implements the Wald test by:
- Taking the LFC and dividing it by its standard error, resulting in a z-statistic
- The z-statistic is compared to a standard normal distribution, and a p-value is computed reporting the probability that a z-statistic at least as extreme as the observed value would be selected at random
- If the p-value is small we reject the null hypothesis and state that there is evidence against the null (i.e. the gene is differentially expressed)
How to Perform a Wald Test in R
wald测试可用于测试模型中的一个或多个参数是否等于某些值。
该测试通常用于确定回归模型中的一个或多个预测变量等于零。
我们使用以下零假设和备择假设进行测试:
- H0:一组预测变量都等于零。
- HA:集合中的所有预测变量并不等于零。
如果我们无法拒绝零假设,那么我们可以从模型中删除指定的预测变量集,因为它们对模型的拟合度没有统计学上的显着改善。
下面的示例显示了如何在R中进行wald测试。
在此示例中,我们将使用R中的内置mtcars 数据集拟合以下多个线性回归模型:
mpg = β_0 + β_1disp + β_2carb + β_3hp + β_4cyl
以下代码显示了如何拟合此回归模型并查看模型摘要:
#fit regression model
model <- lm(mpg ~ disp + carb + hp + cyl, data = mtcars)
#view model summary
summary(model)
Call:
lm(formula = mpg ~ disp + carb + hp + cyl, data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-5.0761 -1.5752 -0.2051 1.0745 6.3047
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 34.021595 2.523397 13.482 1.65e-13 ***
disp -0.026906 0.011309 -2.379 0.0247 *
carb -0.926863 0.578882 -1.601 0.1210
hp 0.009349 0.020701 0.452 0.6551
cyl -1.048523 0.783910 -1.338 0.1922
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.973 on 27 degrees of freedom
Multiple R-squared: 0.788, Adjusted R-squared: 0.7566
F-statistic: 25.09 on 4 and 27 DF, p-value: 9.354e-09
接下来,我们可以使用来自aod软件包的wald.test() 函数来测试预测变量“hp”和“cyl” 的回归系数是否等于零。
此函数使用以下基本使用如下:
wald.test(Sigma, b, Terms)
- Sigma: The variance-covariance matrix of the regression model
- b: A vector of regression coefficients from the model
- Terms: A vector that specifies which coefficients to test
以下代码显示了如何在实践中使用此函数:
library(aod)
#perform Wald Test to determine if 3rd and 4th predictor variables are both zero
wald.test(Sigma = vcov(model), b = coef(model), Terms = 3:4)
Wald test:
----------
Chi-squared test:
X2 = 3.6, df = 2, P(> X2) = 0.16
从输出来看,我们可以看到测试的p值为0.16。
由于该p值不少于.05,因此我们无法拒绝WALD检验的零假设。
这意味着我们可以假设预测变量“ hp”和“ cyl”的回归系数均等于零。