title: What is the correct way to use weights in a logistic regression in R?
body: <p>My data includes survey data of car buyers. My data has a weight column that i used in SPSS to get sample sizes. Weight column is affected by demographic factors &amp; vehicle sales. Now i am trying to put together a logistic regression model for a car segment which includes a few vehicles. I want to use the weight column in the logistic regression model &amp; i tried to do so using "weights" in glm function. But the results are horrific. Deviances are too high, McFadden Rsquare too low. My dependent variable is binary, independent variables are on 1 to 5 scale. Weight column is numerical, ranging from 32 to 197. Could that be a reason that results are poor? Do i need to have values in weight column below 1?  </p>
  
  <p>Format of input file to R is -</p>
  
  <pre><code>WGT output I1 I2 I3 I4 I5
  67   1      1  3  1  5  4
  </code></pre>
  
  <p>I1, I2, I3 being independent variables</p>
  
  <pre><code>logr&lt;-glm(output~1,data=data1,weights=WGT,family="binomial")
  
  logrstep&lt;-step(logr,direction = "both",scope = formula(data1))\
  
  logr1&lt;-glm(output~ (formula from final iteration),weights = WGT,data=data1,family="binomial")
  
  hl &lt;- hoslem.test(data1$output,fitted(logr1),g=10)
  </code></pre>
  
  <p>I want a logistic regression model with better accuracy &amp; gain a better understanding of using weights with logistic regression</p>