David Schoeman
2012-Oct-26 06:31 UTC
[R] Is there any way of weighting individual data points in a logistic regression
Dear all. Apologies if I am asking a stupid question, but I have been unable to find a solution so far. I would like to run a logistic regression in which individual data points are assigned different weights (related to my confidence in their validity). These individual observations are binary (success/failure). My intuition was to use the "weights" option in the vlm function. Something along the lines of: mod1 <- glm(success ~ beach - 1, weights = confidence, data = dat, family = binomial), where success is binary (1/0), beach is a factor and weights are either 1 (full confidence) or 0.5 (less confidence). When I ran into the "non-integer #successes in a binomial vlm!" error, and read the help files, I realised my error (in binomial glm, weights set the number of trials). It's good to know WHY my approach was wrong, but it would be better to know how to conduct my analysis correctly. Any ideas appreciated. Dave
Frank Harrell
2012-Oct-26 13:44 UTC
[R] Is there any way of weighting individual data points in a logistic regression
The lrm function in the rms package will do this. David Schoeman wrote> Dear all. Apologies if I am asking a stupid question, but I have been > unable to find a solution so far. > > I would like to run a logistic regression in which individual data points > are assigned different weights (related to my confidence in their > validity). These individual observations are binary (success/failure). My > intuition was to use the "weights" option in the vlm function. Something > along the lines of: > mod1 <- glm(success ~ beach - 1, weights = confidence, data = dat, family > = binomial), > where success is binary (1/0), beach is a factor and weights are either 1 > (full confidence) or 0.5 (less confidence). > > When I ran into the "non-integer #successes in a binomial vlm!" error, and > read the help files, I realised my error (in binomial glm, weights set the > number of trials). It's good to know WHY my approach was wrong, but it > would be better to know how to conduct my analysis correctly. > > Any ideas appreciated. > > Dave > ______________________________________________> R-help@> 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.----- Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Is-there-any-way-of-weighting-individual-data-points-in-a-logistic-regression-tp4647508p4647545.html Sent from the R help mailing list archive at Nabble.com.