如果我在 R 中创建一个线性模型,我会得到整个模型的 p 值。当我创建逻辑回归模型时,我没有。为什么是这样?
线性回归
x<-rnorm(100)
y<-x+rnorm(100)
summary(lm(y~x))
Call: lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-2.46237 -0.52810 -0.04574 0.48878 2.81002
Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept) -0.02318 0.09394 -0.247 0.806 x 1.10130 0.09421 11.690 <2e-16***
--- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9374 on 98 degrees of freedom Multiple
R-squared: 0.5824, Adjusted R-squared: 0.5781 F-statistic: 136.7 on
1 and 98 DF, p-value: < 2.2e-16
逻辑回归
x<-rnorm(100)
y<-factor(c(rep("ONE",50),rep("TWO",50)))
summary(glm(y~x,family = "binomial"))
Call: glm(formula = y ~ x, family = "binomial")
Deviance Residuals:
Min 1Q Median 3Q Max
-1.20658 -1.18093 -0.00499 1.17444 1.21414
Coefficients:
Estimate Std. Error z value Pr(>|z|) (Intercept) 3.857e-05 .000e-01 0.000 1.000 x -3.924e-02 2.055e-01 -0.191 0.849
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 138.63 on 99 degrees of freedom Residual deviance: 138.59 on 98 degrees of freedom AIC: 142.59
Number of Fisher Scoring iterations: 3