[R] lqs function for S-estimator

peter dalgaard pdalgd at gmail.com
Wed Mar 18 16:38:45 CET 2015


On 18 Mar 2015, at 15:11 , Annalisa Orenti <annalisaorenti at libero.it> wrote:

> Dear R-Users,
> I need to fit a regression by means of S-estimator, but I found an 
> inconsistency in lqs function in MASS package.
> When recalling coefficient estimates two discordant answers are obtained by 
> coef() function and by $coef object:
> As an example I report here the results of fitting regression S-estimator on 
> stackloss data:
> 
> library(MASS)
> Sestim<-lqs(stack.loss ~ Air.Flow + Water.Temp + Acid.Conc., data = stackloss, 
> method = "S")
> coef(Sestim)
> (Intercept)            Air.Flow   Water.Temp   Acid.Conc. 
> -35.37610619   0.82522124   0.44247788  -0.07964602 
> Sestim$coef
>                           Air.Flow   Water.Temp   Acid.Conc. 
> -36.92530315   0.84957479   0.43047554  -0.07354065 
> 
> Do you have any suggestions?


The immediate reason is that Sestim contains both $coef and $coefficients and coef() extracts the latter. 

Why this is so escapes me. It looks like it might be a blunder, but the package author isn't usually prone to blundering...

-pd

> Thank you for your help.
> Best regards.
> Annalisa
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list