从 R 中的黄土回归结果中提取残差标准误差
Extract Residual Standard error from loess regression results in R
我正在尝试从黄土回归模型的输出摘要中提取残差标准误差。
> summary(fit.loess[[i]])
Call:
loess(formula = dfcpm[, ncol(dfcpm)] ~ dfcpm[, i], data = dfcpm,
span = 0.5, degree = 1, normalize = FALSE, family = "gaussian")
Number of Observations: 88
Equivalent Number of Parameters: 4.7
Residual Standard Error: 21.7
Trace of smoother matrix: 5.53 (exact)
Control settings:
span : 0.5
degree : 1
family : gaussian
surface : interpolate cell = 0.2
normalize: FALSE
parametric: FALSE
drop.square: FALSE
现在我想提取这个模型的残差标准误差。我该如何提取它?我在模型对象的任何地方都找不到这个值 (即 21.7)。
> names(fit.loess[[i]])
[1] "n" "fitted" "residuals" "enp" "s" "one.delta" "two.delta" "trace.hat"
[9] "divisor" "robust" "pars" "kd" "call" "terms" "xnames" "x"
[17] "y" "weights"
它是 loess
中 return 中的 s
元素。
> lo <- loess(mpg ~ wt, data=mtcars)
> print(lo)
#Call:
#loess(formula = mpg ~ wt, data = mtcars)
#
#Number of Observations: 32
#Equivalent Number of Parameters: 5
#Residual Standard Error: 2.711
> lo$s
#[1] 2.711351
我正在尝试从黄土回归模型的输出摘要中提取残差标准误差。
> summary(fit.loess[[i]])
Call:
loess(formula = dfcpm[, ncol(dfcpm)] ~ dfcpm[, i], data = dfcpm,
span = 0.5, degree = 1, normalize = FALSE, family = "gaussian")
Number of Observations: 88
Equivalent Number of Parameters: 4.7
Residual Standard Error: 21.7
Trace of smoother matrix: 5.53 (exact)
Control settings:
span : 0.5
degree : 1
family : gaussian
surface : interpolate cell = 0.2
normalize: FALSE
parametric: FALSE
drop.square: FALSE
现在我想提取这个模型的残差标准误差。我该如何提取它?我在模型对象的任何地方都找不到这个值 (即 21.7)。
> names(fit.loess[[i]])
[1] "n" "fitted" "residuals" "enp" "s" "one.delta" "two.delta" "trace.hat"
[9] "divisor" "robust" "pars" "kd" "call" "terms" "xnames" "x"
[17] "y" "weights"
它是 loess
中 return 中的 s
元素。
> lo <- loess(mpg ~ wt, data=mtcars)
> print(lo)
#Call:
#loess(formula = mpg ~ wt, data = mtcars)
#
#Number of Observations: 32
#Equivalent Number of Parameters: 5
#Residual Standard Error: 2.711
> lo$s
#[1] 2.711351