Glance 接受模型對象並返回 tibble::tibble()
,其中僅包含一行模型摘要。摘要通常是擬合優度度量、殘差假設檢驗的 p 值或模型收斂信息。
Glance 永遠不會返返回自對建模函數的原始調用的信息。這包括建模函數的名稱或傳遞給建模函數的任何參數。
Glance 不計算匯總度量。相反,它將這些計算外包給適當的方法並將結果收集在一起。有時擬合優度測量是不確定的。在這些情況下,該度量將報告為 NA
。
無論模型矩陣是否秩虧,Glance 都會返回相同的列數。如果是這樣,則不再具有明確定義值的列中的條目將使用適當類型的 NA
進行填充。
參數
- x
-
通過調用
AER::ivreg()
創建的ivreg
對象。 - diagnostics
-
邏輯指示是否返回Wu-Hausman和Sargan診斷信息。
- ...
-
附加參數。不曾用過。僅需要匹配通用簽名。注意:拚寫錯誤的參數將被吸收到
...
中,並被忽略。如果拚寫錯誤的參數有默認值,則將使用默認值。例如,如果您傳遞conf.lvel = 0.9
,所有計算將使用conf.level = 0.95
進行。這裏有兩個異常:
注意
從 0.7.0 開始,glance.ivreg
返回 Wu-Hausman 內生性測試和過度識別限製的 Sargan 測試的統計數據。如果儀器數量不大於內生回歸變量的數量,則 Sargan 測試值將返回為 NA
。
也可以看看
其他 ivreg 整理器:augment.ivreg()
、tidy.ivreg()
值
恰好隻有一行和一列的 tibble::tibble()
:
- adj.r.squared
-
調整後的 R 平方統計量,除了考慮自由度之外,與 R 平方統計量類似。
- df
-
模型使用的自由度。
- df.residual
-
剩餘自由度。
- nobs
-
使用的觀察數。
- r.squared
-
R 平方統計量,或模型解釋的變異百分比。也稱為決定係數。
- sigma
-
殘差的估計標準誤差。
- statistic
-
Wald 檢驗統計量。
- p.value
-
Wald 檢驗的 P 值。
例子
# load libraries for models and data
library(AER)
# load data
data("CigarettesSW", package = "AER")
# fit model
ivr <- ivreg(
log(packs) ~ income | population,
data = CigarettesSW,
subset = year == "1995"
)
# summarize model fit with tidiers
tidy(ivr)
#> # A tibble: 2 × 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 (Intercept) 4.61e+ 0 4.45e- 2 104. 3.74e-56
#> 2 income -5.71e-10 2.33e-10 -2.44 1.84e- 2
tidy(ivr, conf.int = TRUE)
#> # A tibble: 2 × 7
#> term estimate std.error statistic p.value conf.low conf.high
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 (Intercept) 4.61e+ 0 4.45e- 2 104. 3.74e-56 4.52e+0 4.70e+ 0
#> 2 income -5.71e-10 2.33e-10 -2.44 1.84e- 2 -1.03e-9 -1.13e-10
tidy(ivr, conf.int = TRUE, instruments = TRUE)
#> # A tibble: 1 × 5
#> term num.df den.df statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 income 1 46 3329. 1.46e-44
augment(ivr)
#> # A tibble: 48 × 6
#> .rownames `log(packs)` income population .fitted .resid
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 49 4.62 83903280 4262731 4.56 0.0522
#> 2 50 4.71 45995496 2480121 4.59 0.124
#> 3 51 4.28 88870496 4306908 4.56 -0.285
#> 4 52 4.04 771470144 31493524 4.17 -0.131
#> 5 53 4.41 92946544 3738061 4.56 -0.145
#> 6 54 4.38 104315120 3265293 4.55 -0.177
#> 7 55 4.82 18237436 718265 4.60 0.223
#> 8 56 4.53 333525344 14185403 4.42 0.112
#> 9 57 4.58 159800448 7188538 4.52 0.0591
#> 10 58 4.53 60170928 2840860 4.58 -0.0512
#> # ℹ 38 more rows
augment(ivr, data = CigarettesSW)
#> # A tibble: 96 × 11
#> state year cpi population packs income tax price taxs .fitted
#> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 AL 1985 1.08 3973000 116. 46014968 32.5 102. 33.3 4.56
#> 2 AR 1985 1.08 2327000 129. 26210736 37 101. 37 4.59
#> 3 AZ 1985 1.08 3184000 105. 43956936 31 109. 36.2 4.56
#> 4 CA 1985 1.08 26444000 100. 447102816 26 108. 32.1 4.17
#> 5 CO 1985 1.08 3209000 113. 49466672 31 94.3 31 4.56
#> 6 CT 1985 1.08 3201000 109. 60063368 42 128. 51.5 4.55
#> 7 DE 1985 1.08 618000 144. 9927301 30 102. 30 4.60
#> 8 FL 1985 1.08 11352000 122. 166919248 37 115. 42.5 4.42
#> 9 GA 1985 1.08 5963000 127. 78364336 28 97.0 28.8 4.52
#> 10 IA 1985 1.08 2830000 114. 37902896 34 102. 37.9 4.58
#> # ℹ 86 more rows
#> # ℹ 1 more variable: .resid <dbl>
augment(ivr, newdata = CigarettesSW)
#> # A tibble: 96 × 10
#> state year cpi population packs income tax price taxs .fitted
#> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 AL 1985 1.08 3973000 116. 46014968 32.5 102. 33.3 4.59
#> 2 AR 1985 1.08 2327000 129. 26210736 37 101. 37 4.60
#> 3 AZ 1985 1.08 3184000 105. 43956936 31 109. 36.2 4.59
#> 4 CA 1985 1.08 26444000 100. 447102816 26 108. 32.1 4.36
#> 5 CO 1985 1.08 3209000 113. 49466672 31 94.3 31 4.58
#> 6 CT 1985 1.08 3201000 109. 60063368 42 128. 51.5 4.58
#> 7 DE 1985 1.08 618000 144. 9927301 30 102. 30 4.61
#> 8 FL 1985 1.08 11352000 122. 166919248 37 115. 42.5 4.52
#> 9 GA 1985 1.08 5963000 127. 78364336 28 97.0 28.8 4.57
#> 10 IA 1985 1.08 2830000 114. 37902896 34 102. 37.9 4.59
#> # ℹ 86 more rows
glance(ivr)
#> # A tibble: 1 × 8
#> r.squared adj.r.squared sigma statistic p.value df df.residual nobs
#> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int> <int>
#> 1 0.131 0.112 0.229 5.98 0.0184 2 46 48
相關用法
- R broom glance.rlm 瀏覽 a(n) rlm 對象
- R broom glance.felm 瞥一眼毛氈物體
- R broom glance.geeglm 瀏覽 a(n) geeglm 對象
- R broom glance.plm 瀏覽一個 (n) plm 對象
- R broom glance.biglm 瀏覽 a(n) biglm 對象
- R broom glance.clm 瀏覽 a(n) clm 對象
- R broom glance.rma 瀏覽一個(n) rma 對象
- R broom glance.multinom 瀏覽一個(n)多項對象
- R broom glance.survexp 瀏覽 a(n) survexp 對象
- R broom glance.survreg 看一眼 survreg 對象
- R broom glance.rq 查看 a(n) rq 對象
- R broom glance.mjoint 查看 a(n) mjoint 對象
- R broom glance.fitdistr 瀏覽 a(n) fitdistr 對象
- R broom glance.glm 瀏覽 a(n) glm 對象
- R broom glance.coxph 瀏覽 a(n) coxph 對象
- R broom glance.margins 瀏覽 (n) 個 margins 對象
- R broom glance.poLCA 瀏覽一個(n) poLCA 對象
- R broom glance.aov 瞥一眼 lm 物體
- R broom glance.sarlm 瀏覽一個(n)spatialreg對象
- R broom glance.polr 瀏覽 a(n) polr 對象
- R broom glance.negbin 看一眼 negbin 對象
- R broom glance.mlogit 瀏覽一個(n) mlogit 對象
- R broom glance.fixest 看一眼最固定的物體
- R broom glance.nls 瀏覽 a(n) nls 對象
- R broom glance.mfx 瀏覽一個 (n) mfx 對象
注:本文由純淨天空篩選整理自等大神的英文原創作品 Glance at a(n) ivreg object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。