Dear all,

I am trying to do weighted regression using lm function in R. However, I have a 
question why the results from


1)      lm(formula = Y~aX, weight = w)

2)      lm(formula = wY~waX)

are different. Aren't they supposed to have the exactly same result?


Below are the R code to see difference in regression results

MatY <- c(0.15,0.42,0.31,0.22)
MatX <- rbind(c(1,0,0),c(0,1,0),c(1,0,0),c(0,0,1))
Data <- data.frame(cbind(MatY,MatX))
colnames(Data)[2]<-paste("IndSub1")
colnames(Data)[3]<-paste("IndSub2")
colnames(Data)[4]<-paste("IndSub3")
Weight <- c(0.1,0.4,0.3,0.2)

Result<- lm(formula = MatY~IndSub1+IndSub2+IndSub3-1, data = Data, weight = 
Weight)
summary(Result)

Data2 <- Data*Weight

Result2<- lm(formula = MatY~IndSub1+IndSub2+IndSub3-1, data = Data2)
summary(Result2)







Best Regards,
Suphajak Ngamlak
Asset Management (Hedge Fund)
Phatra Securities Public Company Limited
Tel: (66)2-305-9179
Email: supha...@phatrasecurities.com


  
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  If you have received this e-mail in error or are not the intended recipient, 
please immediately notify the sender and delete this message.
  Any use, distribution or copying of this email other than by the intended 
recipient is strictly prohibited. Click 
here<http://www.phatrasecurities.com/en/email-disclaimers.html> for additional 
e-mail disclaimers.    
www.phatrasecurities.com/en/email-disclaimers.html<http://www.phatrasecurities.com/en/email-disclaimers.html>
  
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to