99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2019-01-13 閱讀量: 996
二值型因子現(xiàn)可作為Logistic回歸的結(jié)果變量

> fit.full <- glm(ynaffair ~ gender + age + yearsmarried + children +

religiousness + education + occupation +rating,

data=Affairs, family=binomial())

> summary(fit.full)

Call:

glm(formula = ynaffair ~ gender + age + yearsmarried + children +

religiousness + education + occupation + rating, family = binomial(),

data = Affairs)

Deviance Residuals:

Min 1Q Median 3Q Max

-1.571 -0.750 -0.569 -0.254 2.519

Coefficients:

Estimate Std. Error z value Pr(>|z|)

(Intercept) 1.3773 0.8878 1.55 0.12081

gendermale 0.2803 0.2391 1.17 0.24108

age -0.0443 0.0182 -2.43 0.01530 *

yearsmarried 0.0948 0.0322 2.94 0.00326 **

childrenyes 0.3977 0.2915 1.36 0.17251

religiousness -0.3247 0.0898 -3.62 0.00030 ***

education 0.0211 0.0505 0.42 0.67685

occupation 0.0309 0.0718 0.43 0.66663

rating -0.4685 0.0909 -5.15 2.6e-07 ***

---

Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 675.38 on 600 degrees of freedom

Residual deviance: 609.51 on 592 degrees of freedom

AIC: 627.5

Number of Fisher Scoring iterations: 4

從回歸系數(shù)的p值(最后一欄)可以看到,性別、是否有孩子、學(xué)歷和職業(yè)對方程的貢獻都

不顯著(你無法拒絕參數(shù)為0的假設(shè))。去除這些變量重新擬合模型,檢驗新模型是否擬合得好:

> fit.reduced <- glm(ynaffair ~ age + yearsmarried + religiousness +

rating, data=Affairs, family=binomial())

> summary(fit.reduced)

Call:

glm(formula = ynaffair ~ age + yearsmarried + religiousness + rating,

family = binomial(), data = Affairs)

Deviance Residuals:

Min 1Q Median 3Q Max

-1.628 -0.755 -0.570 -0.262 2.400

Coefficients:

Estimate Std. Error z value Pr(>|z|)

(Intercept) 1.9308 0.6103 3.16 0.00156 **

age -0.0353 0.0174 -2.03 0.04213 *

yearsmarried 0.1006 0.0292 3.44 0.00057 ***

religiousness -0.3290 0.0895 -3.68 0.00023 ***

rating -0.4614 0.0888 -5.19 2.1e-07 ***

---

Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 675.38 on 600 degrees of freedom

Residual deviance: 615.36 on 596 degrees of freedom

AIC: 625.4

Number of Fisher Scoring iterations: 4

新模型的每個回歸系數(shù)都非常顯著(p<0.05)。由于兩模型嵌套(fit.reducedfit.full

的一個子集),你可以使用anova()函數(shù)對它們進行比較,對于廣義線性回歸,可用卡方檢驗。

> anova(fit.reduced, fit.full, test="Chisq")

Analysis of Deviance Table

Model 1: ynaffair ~ age + yearsmarried + religiousness + rating

Model 2: ynaffair ~ gender + age + yearsmarried + children +

religiousness + education + occupation + rating

Resid. Df Resid. Dev Df Deviance P(>|Chi|)

1 596 615

2 592 610 4 5.85 0.21

結(jié)果的卡方值不顯著(p=0.21),表明四個預(yù)測變量的新模型與九個完整預(yù)測變量的模型擬

合程度一樣好。這使得你更加堅信添加性別、孩子、學(xué)歷和職業(yè)變量不會顯著提高方程的預(yù)測精

度,因此可以依據(jù)更簡單的模型進行解釋。

0.0000
2
關(guān)注作者
收藏
評論(0)

發(fā)表評論

暫無數(shù)據(jù)
推薦帖子