2

I would like to fit a logistic regression model in R. The data collection process results in an un-balanced amount of events and non-events. I could re-sample from the data to re-create the original prevalance of the events, but I would rather use all the data.

The glm() function in R does not use weights as sampling weights, but uses weights as an integer number of trials. From the help page "when the elements of weights are positive integers w_i, that each response y_i is the mean of w_i unit-weight observations". See also this question, Case weighted logistic regression, for more on smapling vs trial weights.

Is there an R package to compute a sampling weighted MLE, or what are other options?

Chris
  • 625
  • 2
    What do you mean by "R does not use weights to modify the MLE"? If you use the options of weights for glm in R , then all the estimations will be adjusted taking into account the weights you specify. – Stat Nov 11 '13 at 21:18
  • 1
    re-worded that to make the subtle difference in type of weights more clear. – Chris Nov 12 '13 at 14:55

1 Answers1

2

Sampling weights in logistic regression are implemented by svyglm from the survey package (setting the weights is done by using svydesign to define a design object, which svyglm takes as an argument)

dzeltzer
  • 141