I am trying to run a regression in R. My variables are as follows:

  • member_id: the id number for each MP
  • year: the year (this runs from 1997-2010)
  • isFemale: 1 for male, 2 for female
  • party: what party they are in
  • Leadership: TRUE if they hold a ministerial position in government or opposition, FALSE if not
  • days_in_house: how many days they have been an MP
  • n_Edu: number of interjections made about education per member in the given year

I want to use debate participation in education (n_Edu) as my dependent variable, and the independent variables are isFemale, party, Leadership, days_in_house. I want to run this for each year.

    member_id year isFemale                     party Leadership days_in_house n_Edu 
 1:       386 1997        1              Conservative      FALSE          6579     0  
 2:        37 1997        1                    Labour      FALSE          6579     0 
 3:        47 1997        1                    Labour       TRUE          5081     0  
 4:       408 1997        1              Conservative       TRUE          6579     4  
 5:        15 1997        1          Liberal Democrat      FALSE          5081     0  
 6:       191 1997        2   Scottish National Party      FALSE          3618    45  
 7:       605 1997        1     Ulster Unionist Party      FALSE          2547     0  
 8:       471 1997        1 Democratic Unionist Party      FALSE          6579     0  
 9:       111 1997        1              Conservative      FALSE          5088    53  
10:       187 1997        1              Conservative      FALSE          6586     0  

I am not sure what type of regression I should be running, especially as I want to run it for each year from 1997-2010.

  • 1
    $\begingroup$ I would recommend you start by formulating the question of interest. A few key considerations: are you trying to predict your dependent variable using the set of independent variables or are you interested in the causal effect of one of your independent variables? Are you asking "How much...?" or "Whether?" which would speak to whether any of your variables need to be transformed. Finally, is there a reason you're looking to run a set of cross-sectional regressions or would you benefit from exploiting the time dimension of the panel dataset and want to run one single regression? $\endgroup$ Jul 19, 2020 at 18:16
  • $\begingroup$ I am looking at the causal effect of gender (isFemale) on the participation rate in the debate per member per year and want to see what affect the other independent variables also have on their participation (if any). I want to be able to see any changes that occur over the time period (1997 - 2010), so I am not sure if this requires me to run cross-sectional regressions or if I can run a single regression? $\endgroup$
    – Amy
    Jul 19, 2020 at 18:24

1 Answer 1


It depends on your data structure, but you're in poisson regression world. Here's a link that may help narrow down whether you should use a poisson, negative binomial, or even a zero-inflated model https://stats.idre.ucla.edu/stata/seminars/regression-models-with-count-data/. The basic difference between them are as follows:

  • Poisson - Used on count data, but assumes the variance equals the mean
  • Negative binomial - also used on count data, but is less restrictive with respect to the mean & variance
  • zero-inflated - when your data has a large amount of zero counts (I believe you can do zero-inflated poisson or neg-binom).

With respect to how to code it in r: for poisson you can use the glm function and specify family = poisson; for negative binomial, use the glm.nb function in the MASS package; and for zero-inflated, use the zeroinfl function in pscl package.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.