[R] a Weighted Least Square Model for a Binary Outcome

Vivian Zhuang statinfo88 at gmail.com
Wed Jun 29 17:41:06 CEST 2011


Hi Daniel,

Thanks for your reply. The weight is dependent on the estimated E(Y).
In other words, I need R to estimate the beta coefficients and weights
simultaneously, like what is performed in gls(). However, the weight
form allowed in gls() is different from what I want.

In SPSS, we can simply use the code of 'COMPUTE WGT = 1/(yhat * (1 -
yhat))'. But I do not know how to do it in R. I tried yhat but R did
not recognize it.

Best Regards,
Vivian



On Tue, Jun 28, 2011 at 10:18 PM, Daniel Malter <daniel at umd.edu> wrote:
> You can specify the weights=... argument in the lm() function as vector of
> weights, one for each observation. Should that not do what your are trying
> to do?
>
> HTH,
> Daniel
>
> --
> View this message in context: http://r.789695.n4.nabble.com/a-Weighted-Least-Square-Model-for-a-Binary-Outcome-tp3631551p3631834.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list