假设我通过这样做来创建我的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"
答案 0 :(得分:1)
检查utils::str
(而不是使用declare @isnot tinyint
select @isnot = 1 -- option : 0 and 1
select top 100 *
from Employee
where EmployeeID > 1
case
when @isnot = 1
then (and EmployeeName = 'Brian')
else '' -- blank
end
) - 它会为您提供对象的结构。
我认为summary
是您正在寻找的。 p>
gm$model