title: How to get Difference-in-Differences regression equation from statsmodels (python) using Weighted Least Squares regression
body: <p>I am pretty poor in statistics, but still need to use statsmodels to run a Difference-in-Difference (DID) regression using Weighted Least Squares (WLS). I know how to run the WLS regression, but I am unsure how my OLS regression equation changes when I run the WLS regression where I have added weights to each observation. 
  My question is: how has my (DID) OLS regression equation changed by adding weights and by running the WLS analysis?</p>
  
  <p>I will explain (in detail) what I did and I hope that someone is willing to help me! Thanks in advance.</p>
  
  <p>In this DID design, there are two groups (g = 1,2) observed in two time periods (t = 1,2). In the second time period, only the second group is exposed to the treatment condition. In this case, the g1 is the control group and g2 is the intervention group. Let Ig =1 (where the group is g2) be a dummy variable indicating observations on the intervention group.
  The chance for an older adult to fall (number of fall incidents / number of elderly living in a certain region) (dependent variable) are known for year t1 (pre intervention) and year t2 (post intervention). The dummy variable Pt = 1 (where the time period is t2) indicates observations from the second period.
  The treatment variable is the product of Ig and Pt. This dummy variable is 1 only for an observation in the intervention group and in period t2. </p>
  
  <p>I am running a regression to estimate the effect of a certain program (in t2) that reduces fall incidents of elderly. There are 15 regions from which 5 regions are in the intervention group and 10 regions in the control group over only two years.</p>
  
  <p>The following equation is used:
  Y_gt=x_0+x_1*I_g+ x_2*P_t+ x_3*(I_g*P_t )+ ∈_gt</p>
  
  <p>The coefficient x_3 provides the Difference-in-Difference estimate.</p>
  
  <p>There is also data on how many elderly are living in these regions. I want to add weights to these regions using the elderly population in those areas: to make sure that the regions with a high elderly population contribute more to the regression coefficients. Here is the full table containing all the information to run the DID regression. So the first is my dependent variable, the middle 3 are my independent variables and the last are the weights:</p>
  
  <pre><code>array([[0.018734177,  0,  0,  0, 1975],
     [0.01827957,  0,  0,  0, 930],
     [0.018181818,  0,  0,  0, 1375],
     [0.019463087,  1,  0,  0, 1490],
     [0.03028169,  1,  0,  0, 1420],
     [0.034146341,  1,  0,  0, 820],
     [0.023076923,  1,  0,  0, 1300],
     [0.021658986,  1,  0,  0, 2170],
     [0.018099548,  0,  0,  0, 1105],
     [0.022801303,  0,  0,  0, 1535],
     [0.015625,  0,  0,  0,  640],
     [0.026737968,  0,  0,  0, 935],
     [0.017518248,  0,  0,  0, 685],
     [0.021374046,  0,  0,  0, 655],
     [0.015859031,  0,  0,  0, 1135],
     [0.01980198,  0,  1,  0, 2020],
     [0.014507772,  0,  1,  0, 965],
     [0.019928826,  0,  1,  0, 1405],
     [0.015189873,  1,  1,  1, 1580],
     [0.021678322,  1,  1,  1, 1430],
     [0.020606061,  1,  1,  1, 825],
     [0.020454545,  1,  1,  1, 1320],
     [0.017155756,  1,  1,  1, 2215],
     [0.018181818,  0,  1,  0, 1155],
     [0.028289474,  0,  1,  0, 1520],
     [0.0144,  0,  1,  0, 625],
     [0.024309392,  0,  1,  0, 905],
     [0.009859155,  0,  1,  0, 710],
     [0.016058394,  0,  1,  0, 685],
     [0.016450216,  0,  1,  0, 1155]], dtype=int64)
  </code></pre>
  
  <p>I used statsmodels to get this done. I used the following code:</p>
  
  <pre><code>y = Pivot_DID_Analysis_65_75.values[:,0]
  x = Pivot_DID_Analysis_65_75.values[:,1:4]
  Pop_65_75 = Pivot_DID_Analysis_65_75.values[:,4]
  x, y = np.array(x), np.array(y)
  x = sm.add_constant(x)
  model = sm.WLS(y, x, weights=Pop_65_75)
  results = model.fit()
  
  print(results.summary())
  </code></pre>
  
  <p>This gives me the wanted WLS regression results (at least, that is what I think). However, I do not know how my equation has been changed by adding the weights (the population) and the fact that I used statsmodels WLS.</p>
  
  <p>My question is: how has my (DID) OLS regression equation changed by adding the weights and by running the WLS analysis described above?</p>