Dear R-experts, I guess I have a problem with my fast function (fast tau estimator) here below. Indeed, zero errors look highly suspicious. I guess there is a bug in my R code. How could I correct my R code ?
# install.packages( "robustbase" ) # install.packages( "MASS" ) # install.packages( "quantreg" ) # install.packages( "RobPer" ) # install.packages("devtools") # install_github("kloke/hbrfit") #install.packages('http://www.stat.wmich.edu/mckean/Stat666/Pkgs/npsmReg2_0.1.1.tar.gz') #install.packages("DMwR") library(robustbase) library(MASS) library(quantreg) library(RobPer) library(hbrfit) library("devtools") library("DMwR") bmi=c(23,43,12,1,23,4,3,4,5,5,6,5,5,34,67,87,32,12,23,19) glucose=c(98,34,21,13,2,43,16,43,28,93,11,14,16,43,23,65,42,16,54,32) crp=c(56,34,42,32,1,2,54,47,67,65,38,95,45,76,67,87,35,41,34,54) newdata=data.frame(bmi,glucose,crp) reg1 <- lm( crp ~ bmi+glucose,data=newdata) DMwR::regr.eval(newdata$crp,reg1$fitted.values) reg <- lmrob( crp ~ bmi+glucose,data=newdata) DMwR::regr.eval(newdata$crp,reg$fitted.values) Huber <- rlm( crp ~ bmi+glucose,data=newdata) DMwR::regr.eval(newdata$crp,Huber$fitted.values) Tukey <- rlm( crp ~ bmi+glucose, data=newdata, psi = psi.bisquare ) DMwR::regr.eval(newdata$crp,Tukey$fitted.values) L1 <- rq( crp ~ bmi+glucose, data=newdata, tau = 0.5 ) DMwR::regr.eval(newdata$crp,L1$fitted.values) fast <- FastTau(model.matrix(~newdata$bmi+newdata$glucose),newdata$crp) DMwR::regr.eval(newdata$crp,fast$fitted.values) HBR<-hbrfit(crp ~ bmi+glucose) DMwR::regr.eval(newdata$crp,HBR$fitted.values) ______________________________________________ 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.