Please help me to find the reason when applied this program gave me the same result for
b1,b2,b3 for all (BS,BIAS, RMSE , and SE) 
I want to compare between these beta's 

tq.


################## Ridge MM      ##################

  rm(list=ls())
  library(MASS)
  library(mvoutlier)
  library(robustbase)
  library(car)
  library(quantreg)
  n<-100 
  r<-0.95
  R<-10
  p<-3
  B<-matrix(c(1,1,1,1),p+1,1)
  n.out<-round(0.10*n) 
  SUM.MMR.BS<-c(0,0,0,0)   # MM    ridge
  SUM.MMR.MSE<-c(0,0,0,0)
  set.seed(n)
  b0=matrix(nrow=10,ncol=1)
  b1=matrix(nrow=10,ncol=1)
  b2=matrix(nrow=10,ncol=1)
  b3=matrix(nrow=10,ncol=1)
  for (i in 1:R){
  z11<-rnorm(n,0,1)
  z22<-rnorm(n,0,1)
  z33<-rnorm(n,0,1)
  z44<-rnorm(n,0,1)
  x1<-(1-r)*z11+sqrt(r)*z44
  #x1[1:n.out]<-100
  x2<-(1-r)*z22+sqrt(r)*z44
  #x2[1:n.out]<-100
  x3<-(1-r)*z33+sqrt(r)*z44
  #x3[1:n.out]<-100
  x<-as.matrix(data.frame(x1,x2,x3))
  e<-rnorm(n,0,1)
  #e<-rcauchy(n,0,1)
  #e<-rt(n,3)
  e[1:n.out]<-100
  y<-1+x1+x2+x3+e
  data<-data.frame(y,x1,x2,x3)
  MM<- rlm(y~.,data,psi=psi.bisquare,method="MM",k2=4.685)
   beta<-as.matrix(coef(MM))  
   stand<-function(x){(x-mean(x))/sd(x)*(n-1)^-0.5}
     x11<-stand(x1)
     x22<-stand(x2)
     x33<-stand(x3)
  X<-as.matrix(data.frame(1,x11,x22,x33))
  y1<-stand(y)
  data1<-data.frame(y1,x11,x22,x33)
  cell<-data1
  y<-cell[,1]
  x1<-cell[,2]
  x2<-cell[,3]
  x3<-cell[,4]
 data2<-data.frame(y,x1,x2,x3)}
###################### MM ridge ####################
  b.MM<- rlm(y~.,data,psi=psi.bisquare,method="MM",k2=4.685)$coef
  eMM<-rlm(y~.,data,psi=psi.bisquare,method="MM",k2=4.685)$residuals
  sMM<-sum(eMM^2)/(n-p-1)
  B.MM<-as.matrix(b.MM)
  kMM<-4*sMM^2/t(b.MM)%*%b.MM   
  kMM<-c(kMM)
  II<-diag(x = 1, nrow=p+1, ncol=p+1)
  KMM<-II*kMM
  MMR.BS<-solve(t(X)%*%X+KMM)%*%t(X)%*%X%*%b.MM
  SUM.MMR.BS<-SUM.MMR.BS+MMR.BS
  SUM.MMR.MSE<-SUM.MMR.MSE+(MMR.BS-1)^2
##############################################  
 #Bias,RMSE and SE for MMR
 
 MMR.AVE<-SUM.MMR.BS/R
 MMR.MSE<-SUM.MMR.MSE/R
 MMR.BIAS<-MMR.AVE-1
 MMR.RMSE<-sqrt(MMR.MSE)
 MMR.SE<-abs(MMR.MSE-MMR.BIAS^2)^0.5
  
 MMR.output<-cbind(MMR.BS,MMR.BIAS,MMR.RMSE,MMR.SE) 
 MMR.output

                  BS             BIAS            RMSE        SE    
x11    9.359232e-06 -0.9999991 0.3162248 0.9486833
x22   9.324826e-06 -0.9999991 0.3162248 0.9486833
x33   9.311783e-06 -0.9999991 0.3162248 0.9486833



 
Kafi Dano Pati 
Ph.D candidate ( mathematics/statistics) 
Department of mathematical Science/ faculty of Science 
University Technology Malaysia 
81310 UTM, Johor Bahru, Johor, Malaysia 
IC. NO. 201202F10234 
Matric No. PS113113 
HP. No.  00601117517559
E-mail: kafi_dano@yahoo.com 
supervisor- Assoc. Prof. Robiah Binti Adnan 
	[[alternative HTML version deleted]]

