Glance 接受模型對象並返回 tibble::tibble()
,其中僅包含一行模型摘要。摘要通常是擬合優度度量、殘差假設檢驗的 p 值或模型收斂信息。
Glance 永遠不會返返回自對建模函數的原始調用的信息。這包括建模函數的名稱或傳遞給建模函數的任何參數。
Glance 不計算匯總度量。相反,它將這些計算外包給適當的方法並將結果收集在一起。有時擬合優度測量是不確定的。在這些情況下,該度量將報告為 NA
。
無論模型矩陣是否秩虧,Glance 都會返回相同的列數。如果是這樣,則不再具有明確定義值的列中的條目將使用適當類型的 NA
進行填充。
參數
- x
-
從
mclust::Mclust()
返回Mclust
對象。 - ...
-
附加參數。不曾用過。僅需要匹配通用簽名。注意:拚寫錯誤的參數將被吸收到
...
中,並被忽略。如果拚寫錯誤的參數有默認值,則將使用默認值。例如,如果您傳遞conf.lvel = 0.9
,所有計算將使用conf.level = 0.95
進行。這裏有兩個異常:
值
恰好隻有一行和一列的 tibble::tibble()
:
- BIC
-
模型的貝葉斯信息準則。
- df
-
模型使用的自由度。
- logLik
-
模型的對數似然。 [stats::logLik()] 可能是一個有用的參考。
- nobs
-
使用的觀察數。
- model
-
表示具有最佳 BIC 的模型類型的字符串
- G
-
最佳模型中的混合成分數量
- hypvol
-
如果其他模型包含噪聲分量,則為超體積參數的值。否則`NA`。
例子
# load library for models and data
library(mclust)
# load data manipulation libraries
library(dplyr)
library(tibble)
library(purrr)
library(tidyr)
set.seed(27)
centers <- tibble(
cluster = factor(1:3),
# number points in each cluster
num_points = c(100, 150, 50),
# x1 coordinate of cluster center
x1 = c(5, 0, -3),
# x2 coordinate of cluster center
x2 = c(-1, 1, -2)
)
points <- centers %>%
mutate(
x1 = map2(num_points, x1, rnorm),
x2 = map2(num_points, x2, rnorm)
) %>%
select(-num_points, -cluster) %>%
unnest(c(x1, x2))
# fit model
m <- Mclust(points)
# summarize model fit with tidiers
tidy(m)
#> # A tibble: 3 × 6
#> component size proportion variance mean.x1 mean.x2
#> <int> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 1 101 0.335 1.12 5.01 -1.04
#> 2 2 150 0.503 1.12 0.0594 1.00
#> 3 3 49 0.161 1.12 -3.20 -2.06
augment(m, points)
#> # A tibble: 300 × 4
#> x1 x2 .class .uncertainty
#> <dbl> <dbl> <fct> <dbl>
#> 1 6.91 -2.74 1 3.98e-11
#> 2 6.14 -2.45 1 1.99e- 9
#> 3 4.24 -0.946 1 1.47e- 4
#> 4 3.54 0.287 1 2.94e- 2
#> 5 3.91 0.408 1 7.48e- 3
#> 6 5.30 -1.58 1 4.22e- 7
#> 7 5.01 -1.77 1 1.06e- 6
#> 8 6.16 -1.68 1 7.64e- 9
#> 9 7.13 -2.17 1 4.16e-11
#> 10 5.24 -2.42 1 1.16e- 7
#> # ℹ 290 more rows
glance(m)
#> # A tibble: 1 × 7
#> model G BIC logLik df hypvol nobs
#> <chr> <int> <dbl> <dbl> <dbl> <dbl> <int>
#> 1 EII 3 -2402. -1175. 9 NA 300
相關用法
- 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) Mclust object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。