Glance 接受模型對象並返回 tibble::tibble()
,其中僅包含一行模型摘要。摘要通常是擬合優度度量、殘差假設檢驗的 p 值或模型收斂信息。
Glance 永遠不會返返回自對建模函數的原始調用的信息。這包括建模函數的名稱或傳遞給建模函數的任何參數。
Glance 不計算匯總度量。相反,它將這些計算外包給適當的方法並將結果收集在一起。有時擬合優度測量是不確定的。在這些情況下,該度量將報告為 NA
。
無論模型矩陣是否秩虧,Glance 都會返回相同的列數。如果是這樣,則不再具有明確定義值的列中的條目將使用適當類型的 NA
進行填充。
參數
- x
-
anova
對象,例如由stats::anova()
、car::Anova()
、car::leveneTest()
或car::linearHypothesis()
創建的對象。 - ...
-
附加參數。不曾用過。僅需要匹配通用簽名。注意:拚寫錯誤的參數將被吸收到
...
中,並被忽略。如果拚寫錯誤的參數有默認值,則將使用默認值。例如,如果您傳遞conf.lvel = 0.9
,所有計算將使用conf.level = 0.95
進行。這裏有兩個異常:
注意
請注意,glance.anova()
的輸出將根據初始化 anova 調用而變化。在某些情況下,它隻會返回一個空 DataFrame 。在其他情況下, glance.anova()
可能返回 tidy.anova()
所共有的列。這部分是為了保持與 broom
早期版本的向後兼容性,但也因為底層方差分析模型產生的組件也可以合理地解釋為 goodness-of-fit 摘要。
也可以看看
其他方差分析:glance.aov()
、tidy.TukeyHSD()
、tidy.anova()
、tidy.aovlist()
、tidy.aov()
、tidy.manova()
例子
# fit models
a <- lm(mpg ~ wt + qsec + disp, mtcars)
b <- lm(mpg ~ wt + qsec, mtcars)
mod <- anova(a, b)
# summarize model fit with tidiers
tidy(mod)
#> # A tibble: 2 × 7
#> term df.residual rss df sumsq statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 mpg ~ wt + qsec + di… 28 195. NA NA NA NA
#> 2 mpg ~ wt + qsec 29 195. -1 -0.00102 0.000147 0.990
glance(mod)
#> # A tibble: 1 × 2
#> deviance df.residual
#> <dbl> <dbl>
#> 1 195. 29
# car::linearHypothesis() example
library(car)
mod_lht <- linearHypothesis(a, "wt - disp")
tidy(mod_lht)
#> # A tibble: 1 × 10
#> term null.value estimate std.error statistic p.value df.residual rss
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 wt - … 0 -5.03 1.23 16.6 3.39e-4 28 195.
#> # ℹ 2 more variables: df <dbl>, sumsq <dbl>
glance(mod_lht)
#> # A tibble: 1 × 2
#> deviance df.residual
#> <dbl> <dbl>
#> 1 195. 28
相關用法
- R broom glance.aov 瞥一眼 lm 物體
- R broom glance.aareg 瀏覽 a(n) aareg 對象
- 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.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 對象
注:本文由純淨天空篩選整理自等大神的英文原創作品 Glance at a(n) anova object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。