[R] Need to find most likely betas
Pierre Lapointe
pierrelap at gmail.com
Mon Feb 19 15:58:31 CET 2007
Hello,
I have a particular situation where a single "wrong" observation is
impacting the results of a traditional regression to the point that
betas become unreliable. I need a way to calculate the most likely
betas. Here's an example:
set.seed(1)
unknownbeta <- matrix(seq(100,500,100),25,5,byrow=TRUE)
x <-matrix(runif(25*5),25)
y <- rowSums(unknownbeta*x)
summary(lm(y~0+x)) #gets back the unknown betas.
#Now, let's introduce a single wrong data.
unknownbeta[25,5] <-100
y <- rowSums(unknownbeta*x)
summary(lm(y~0+x)) #every beta changes.
I need to find out what are the most likely betas in the second
example. There is no obvious way to know that row 25 has wrong input.
I would even be happy if the conclusion was that x1:x4 are 100, 200,
300 and 400 and that x5 is zero.
Thanks
More information about the R-help
mailing list