On 18/03/2015 15:38, peter dalgaard wrote:
On 18 Mar 2015, at 15:11 , Annalisa Orenti <annalisaore...@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...
It is a side-effect of changes in R since the code was written (for S).
Use Sestim$coef until MASS is updated (which will be before 3.2.0 is
released).
-pd
Thank you for your help.
Best regards.
Annalisa
______________________________________________
R-help@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.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK
______________________________________________
R-help@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.