1
假設我做這個創造我的GAM模型:提取GAM模型對象
a <- runif(10)
b <- runif(10)
gm <- gam(a ~ ns(b, df=2))
plot(gm, all.terms=T, shade=T)
我需要的是能夠訪問的gm
的元素,在什麼爲了獲得包含以紅色突出顯示的點的列表或數據框。
通過查看summary(gm)
和names(gm)
的輸出,我無法找到包含此類數據的字段。
> summary(gm)
Family: gaussian
Link function: identity
Formula:
a ~ ns(b, df = 2)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.5390 0.1524 3.536 0.00952 **
ns(b, df = 2)1 0.4935 0.4242 1.163 0.28284
ns(b, df = 2)2 -0.2203 0.2603 -0.846 0.42529
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
R-sq.(adj) = -0.0585 Deviance explained = 17.7%
GCV = 0.077126 Scale est. = 0.053988 n = 10
和
> names(gm)
[1] "coefficients" "residuals" "fitted.values" "family" "linear.predictors"
[6] "deviance" "null.deviance" "iter" "weights" "prior.weights"
[11] "df.null" "y" "converged" "sig2" "edf"
[16] "edf1" "hat" "R" "boundary" "sp"
[21] "nsdf" "Ve" "Vp" "rV" "mgcv.conv"
[26] "gcv.ubre" "aic" "rank" "gcv.ubre.dev" "scale.estimated"
[31] "method" "smooth" "formula" "var.summary" "cmX"
[36] "model" "control" "terms" "pred.formula" "pterms"
[41] "assign" "xlevels" "offset" "df.residual" "min.edf"
[46] "optimizer" "call"
偉大的方向。但我仍然無法重現以紅色突出顯示的功能 – ruggfrancesco