Tidy 總結了有關模型組件的信息。模型組件可能是回歸中的單個項、單個假設、聚類或類。 tidy 所認為的模型組件的確切含義因模型而異,但通常是不言而喻的。如果模型具有多種不同類型的組件,您將需要指定要返回哪些組件。
參數
- x
-
從
quantreg::nlrq()
返回的nlrq
對象。 - data
-
base::data.frame 或
tibble::tibble()
包含用於生成對象x
的原始數據。默認為stats::model.frame(x)
,以便augment(my_fit)
返回增強的原始數據。不要將新數據傳遞給data
參數。增強將報告傳遞給data
參數的數據的影響和烹飪距離等信息。這些度量僅針對原始訓練數據定義。 - newdata
-
base::data.frame()
或tibble::tibble()
包含用於創建x
的所有原始預測變量。默認為NULL
,表示沒有任何內容傳遞給newdata
。如果指定了newdata
,則data
參數將被忽略。 - ...
-
附加參數。不曾用過。僅需要匹配通用簽名。注意:拚寫錯誤的參數將被吸收到
...
中,並被忽略。如果拚寫錯誤的參數有默認值,則將使用默認值。例如,如果您傳遞conf.lvel = 0.9
,所有計算將使用conf.level = 0.95
進行。這裏有兩個異常:
也可以看看
其他 quantreg 整理器: augment.rqs()
、 augment.rq()
、 glance.nlrq()
、 glance.rq()
、 tidy.nlrq()
、 tidy.rqs()
、 tidy.rq()
例子
# fit model
n <- nls(mpg ~ k * e^wt, data = mtcars, start = list(k = 1, e = 2))
# summarize model fit with tidiers + visualization
tidy(n)
#> # A tibble: 2 × 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 k 49.7 3.79 13.1 5.96e-14
#> 2 e 0.746 0.0199 37.5 8.86e-27
augment(n)
#> # A tibble: 32 × 4
#> mpg wt .fitted .resid
#> <dbl> <dbl> <dbl> <dbl>
#> 1 21 2.62 23.0 -2.01
#> 2 21 2.88 21.4 -0.352
#> 3 22.8 2.32 25.1 -2.33
#> 4 21.4 3.22 19.3 2.08
#> 5 18.7 3.44 18.1 0.611
#> 6 18.1 3.46 18.0 0.117
#> 7 14.3 3.57 17.4 -3.11
#> 8 24.4 3.19 19.5 4.93
#> 9 22.8 3.15 19.7 3.10
#> 10 19.2 3.44 18.1 1.11
#> # ℹ 22 more rows
glance(n)
#> # A tibble: 1 × 9
#> sigma isConv finTol logLik AIC BIC deviance df.residual nobs
#> <dbl> <lgl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int>
#> 1 2.67 TRUE 0.00000204 -75.8 158. 162. 214. 30 32
library(ggplot2)
ggplot(augment(n), aes(wt, mpg)) +
geom_point() +
geom_line(aes(y = .fitted))
newdata <- head(mtcars)
newdata$wt <- newdata$wt + 1
augment(n, newdata = newdata)
#> # A tibble: 6 × 13
#> .rownames mpg cyl disp hp drat wt qsec vs am gear
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Mazda RX4 21 6 160 110 3.9 3.62 16.5 0 1 4
#> 2 Mazda RX4 W… 21 6 160 110 3.9 3.88 17.0 0 1 4
#> 3 Datsun 710 22.8 4 108 93 3.85 3.32 18.6 1 1 4
#> 4 Hornet 4 Dr… 21.4 6 258 110 3.08 4.22 19.4 1 0 3
#> 5 Hornet Spor… 18.7 8 360 175 3.15 4.44 17.0 0 0 3
#> 6 Valiant 18.1 6 225 105 2.76 4.46 20.2 1 0 3
#> # ℹ 2 more variables: carb <dbl>, .fitted <dbl>
相關用法
- R broom augment.nls 使用來自 nls 對象的信息增強數據
- R broom augment.betamfx 使用來自 betamfx 對象的信息增強數據
- R broom augment.robustbase.glmrob 使用來自 glmrob 對象的信息增強數據
- R broom augment.rlm 使用來自 rlm 對象的信息增強數據
- R broom augment.htest 使用來自(n)個 htest 對象的信息來增強數據
- R broom augment.clm 使用來自 clm 對象的信息增強數據
- R broom augment.speedlm 使用來自 speedlm 對象的信息增強數據
- R broom augment.felm 使用來自 (n) 個 felm 對象的信息來增強數據
- R broom augment.smooth.spline 整理一個(n)smooth.spline對象
- R broom augment.drc 使用來自 a(n) drc 對象的信息增強數據
- R broom augment.decomposed.ts 使用來自 decomposed.ts 對象的信息增強數據
- R broom augment.poLCA 使用來自 poLCA 對象的信息增強數據
- R broom augment.lm 使用來自 (n) lm 對象的信息增強數據
- R broom augment.rqs 使用來自 (n) 個 rqs 對象的信息來增強數據
- R broom augment.polr 使用來自 (n) 個 polr 對象的信息增強數據
- R broom augment.plm 使用來自 plm 對象的信息增強數據
- R broom augment.gam 使用來自 gam 對象的信息增強數據
- R broom augment.fixest 使用來自(n)個最固定對象的信息來增強數據
- R broom augment.survreg 使用來自 survreg 對象的信息增強數據
- R broom augment.rq 使用來自 a(n) rq 對象的信息增強數據
- R broom augment.Mclust 使用來自 Mclust 對象的信息增強數據
- R broom augment.robustbase.lmrob 使用來自 lmrob 對象的信息增強數據
- R broom augment.lmRob 使用來自 lmRob 對象的信息增強數據
- R broom augment.mlogit 使用來自 mlogit 對象的信息增強數據
- R broom augment.betareg 使用來自 betareg 對象的信息增強數據
注:本文由純淨天空篩選整理自等大神的英文原創作品 Tidy a(n) nlrq object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。