[R] least median squares
Gabor Grothendieck
ggrothendieck at gmail.com
Sun Oct 22 07:09:37 CEST 2006
Try this using builtin data set BOD:
medsq <- function(p, DF) median((p[1] + p[2] * DF[[1]] - DF[[2]])^2)
init <- coef(lm(demand ~ Time, BOD))
optim(init, medsq, DF = BOD)
library(MASS)
lqs(demand ~ Time, BOD, method = "lms")
On 10/22/06, Pedro Mardones <mardones.p at gmail.com> wrote:
> Does anyone can provide a code to implement least median squares
> regression in R (not using the lqs function or calling C functions)?
> Reason: teaching/learning purposes
> Thanks
> PM
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> 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.
>
More information about the R-help
mailing list