我如何使用R中的robustbase软件包的ltsReg来预测值?

问题描述 投票:0回答:1

统计预测功能未读取“ lts”方法。我知道软件包MASS具有称为lqs(使用方法lts)的功能,以便运行稳健的回归和预测,但是从MASS获得的参数与ltsReg不同。我应该使用哪一个?难道我做错了什么?

我一直在使用ltsReg,以检测异常值并研究线性方法与鲁棒方法之间的差异,这一直很好。因此,与继续在MASS lqs函数中重新开始所有工作相比,最好继续工作并找到一种使用ltsReg进行预测的方法。

data(coleman)
fool.1 <- ltsReg(Y ~ ., data = coleman)
summary(fool.1)`
Call:
ltsReg.formula(formula = Y ~ ., data = coleman)

Residuals (from reweighted LS):
    Min      1Q  Median      3Q     Max 
-1.2155 -0.3887  0.0000  0.3056  0.9845 

Coefficients:
          Estimate Std. Error t value Pr(>|t|)    
Intercept 29.75772    5.53224   5.379 0.000166 ***
salaryP   -1.69854    0.46602  -3.645 0.003358 ** 
fatherWc   0.08512    0.02079   4.093 0.001490 ** 
sstatus    0.66617    0.03824  17.423 6.94e-10 ***
teacherSc  1.18400    0.16425   7.208 1.07e-05 ***
motherLev -4.06675    0.84867  -4.792 0.000440 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.7824 on 12 degrees of freedom
Multiple R-Squared: 0.9883, Adjusted R-squared: 0.9835 
F-statistic: 203.2 on 5 and 12 DF,  p-value: 3.654e-11
here

fool.2 <- lqs(Y ~ ., data = coleman, method = "lts)
fool.2$coefficients




(Intercept)     salaryP    fatherWc     sstatus   teacherSc   motherLev 
20.45608974 -0.03680888  0.04687359  0.61946444  0.81382027 -1.52285563
r linear-regression regression-testing
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.