hi guys and gals ... How are you all ...
i have to do something in robust regression by R programm , and i have some
problems as following:
*the first :*
suppose
w(r) =1/(1 r^2) and r <- c(7.01,2.07,7.061,5.607,8.502,54.909,12.222)
and i want to exclude some values from r so that (abs(r)>4.9 )...
after ,i want to used (w) to get on coefficients beta0 and beta1 (B1 <-
(sum(w*y*x)-sum(w*y)*sum(w*x))/(sum(w*(x^2))-(sum(w*x))^2/sum(w))
-------------------- B0 <- (sum(w*y)-B1*sum(x*w))/sum(w).
this process must to repeat it until (w) be 0.001 ( tolerance <- 0.001)
How can i get on this in one program?
- i tried to do it by "if -else , repeat and while "-
*the second:*
in simple robust regression we have two way to fit the model
1- rlm(formula, data, weights, ..., subset, na.action,
method = c("M", "MM", "model.frame"),
wt.method = c("inv.var", "case"),
model = TRUE, x.ret = TRUE, y.ret = FALSE, contrasts = NULL)
2- rlm(x, y, weights, ..., w = rep(1, nrow(x)),
init = "ls", psi = psi.huber,
scale.est = c("MAD", "Huber", "proposal 2"),
k2 = 1.345,
method = c("M", "MM"), wt.method =
c("inv.var", "case"),
maxit = 20, acc = 1e-4, test.vec = "resid", lqs.control = NULL)
psi.huber(u, k = 1.345, deriv = 0)
psi.hampel(u, a = 2, b = 4, c = 8, deriv = 0)
psi.bisquare(u, c = 4.685, deriv = 0)
and all these ways works by default function as psi.huber and i want to add
new psi ( psi.a=r/(1+(r/k)^2)) ,k=1.345 and get on new coefficients to the
model, and, Is all the arguments are necessary ? " i want short code"
again ... *how can i do this ... *
thanks in advance ...
/my best wishes.../
-----
We are all like the bright moon, we still have our darker side
--
View this message in context:
http://r.789695.n4.nabble.com/help-in-M-estimator-by-R-tp4650485.html
Sent from the R help mailing list archive at Nabble.com.