function(x, n, p, print.it = F) { # # C. Croux (Brussels, Belgium) and P. Filzmoser (Vienna, Austria) # # calculating the weights for Weighted L1-Regression ("wl1fit") (without regression) # # REMARK: "cov.mve" should be the corrected version of Splus(>)4.0 # x <- as.data.frame(x) if(p == 1) { rob <- list(center = 0, cov = 1) rob$center <- median(x) rob$cov <- mad(x)^2 } else rob <- cov.mve(x, print.it = F) x <- as.matrix(x) robdist2 <- mahalanobis(x, rob$center, rob$cov) # weight <- p/robdist2 weight <- qchisq(0.95, p)/robdist2 weight <- apply(cbind(1, weight), 1, min) weight }