thanks a lot, it works

On Thu, Jul 5, 2012 at 11:40 AM, Thomas Lumley-2 [via R] <
ml-node+s789695n4635453h94@n4.nabble.com> wrote:

> On Thu, Jul 5, 2012 at 11:40 AM, jacquesliu <[hidden email]<http://user/SendEmail.jtp?type=node&node=4635453&i=0>>
> wrote:
>
> > I was asked to do a WLS estimation, so I thought of lm() with weights
> like
> > wls=lm(Y~X-1,weight=INC)
> >
> > however, it gives different result as below code, which use the formula
> of
> > WLS
> > y<-Y*INC^-0.5
> > x<-X*INC^-0.5
> > wls=lm(y~x-1)
> >
> > Can anybody explain to me why the first code can not give the right
> answer?
>
> The two examples are using the opposite weights.  To replicate the
> answer from the second approach with lm, use weight=INC^-1
>
> In lm(), observations with high weights have more, um, weight. They
> influence the results more than observations with low weight.  Your
> code does the opposite.
>
>    -thomas
> --
> Thomas Lumley
> Professor of Biostatistics
> University of Auckland
>
> ______________________________________________
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4635453&i=1>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.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://r.789695.n4.nabble.com/a-problem-about-WLS-tp4635446p4635453.html
>  To unsubscribe from a problem about WLS, click here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4635446&code=amFjcXVlc2xpdUBnbWFpbC5jb218NDYzNTQ0NnwxNTkzNzg0MjQx>
> .
> NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Liu,Jacques


--
View this message in context: http://r.789695.n4.nabble.com/a-problem-about-WLS-tp4635446p4635523.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

