title: Creating predict function in a Poisson regression
body: <p>I have a data-set in which I need to perform a Poisson regression analysis of how number of visits to the doctor in the two week period varies as a function of age group (i.e.&lt;30, between 30 and 50, and >50), sex and illness. Holding sex and number of illnesses constant at their mean values. </p>
  
  <p>Here is a sample of my data:</p>
  
  <pre><code> visits gender age illness
       1 female  19       1
       1 female  19       1
       1   male  19       3
       1   male  19       1
       1   male  19       2
       1 female  19       5
       1 female  19       4
       1 female  19       3
       1 female  19       2
       1   male  19       1
  </code></pre>
  
  <p>However, I do not know how to go about this as I don't know how to correctly input these groups. As I need to discover the predicted rates of visits to a doctor over a two week period for different age groups. </p>
  
  <p>I know how to input the initial equation: 
  glm(visits ~ age + gender + illness, data=DoctorVisits, family=poisson)</p>
  
  <p>But I do not know how I would go about creating the predict function. </p>