title: Candidate for Removal in GAM based on p-value and 0 function
body: <p>I am trying to determine which predictor variables can be removed from a GAM, based on approx. p-values, and by looking at the extent to which the confidence band for an estimated term includes a zero function.
  I have a summary that shows every smooth function to be statistically significant:</p>
  <pre class="lang-r prettyprint-override"><code>Family: poisson 
  Link function: log 
  
  Formula:
  daily_confirmed_cases ~ s(tests, k = 18) + s(vaccines, k = 18) + 
      s(people_fully_vaccinated, k = 18) + s(hosp) + s(icu) + s(ndate, 
      k = 18)
  
  Parametric coefficients:
              Estimate Std. Error z value Pr(&gt;|z|)    
  (Intercept) 7.405421   0.001489    4973   &lt;2e-16 ***
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  
  Approximate significance of smooth terms:
                                edf Ref.df Chi.sq p-value    
  s(tests)                   16.793  16.98  14075  &lt;2e-16 ***
  s(vaccines)                16.982  17.00   9744  &lt;2e-16 ***
  s(people_fully_vaccinated) 16.923  17.00   7337  &lt;2e-16 ***
  s(hosp)                     8.988   9.00   6893  &lt;2e-16 ***
  s(icu)                      8.985   9.00   7246  &lt;2e-16 ***
  s(ndate)                   16.673  16.96  11156  &lt;2e-16 ***
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  
  R-sq.(adj) =  0.965   Deviance explained = 97.7%
  -ML =  19761  Scale est. = 1         n = 460
  </code></pre>
  <p>but the plots of two of the smooth terms essentially only contain  the zero function:</p>
  <p><img src="https://i.stack.imgur.com/oetgg.png" alt="enter image description here" /></p>
  <p><img src="https://i.stack.imgur.com/sPwYF.png" alt="enter image description here" /></p>
  <p>so I made a model to remove those terms, but the anova test said removing just either  one or increased the deviance, compared to the original model.</p>
  <pre><code>Analysis of Deviance Table
  
  Model 1: daily_confirmed_cases ~ s(tests, k = 18) + s(vaccines, k = 18) + 
      s(people_fully_vaccinated, k = 18) + s(hosp) + s(icu) + s(ndate, 
      k = 18)
  Model 2: daily_confirmed_cases ~ s(tests, k = 18) + s(vaccines, k = 18) + 
      s(people_fully_vaccinated, k = 18) + s(icu) + s(ndate, k = 18)
  Model 3: daily_confirmed_cases ~ s(tests, k = 18) + s(vaccines, k = 18) + 
      s(people_fully_vaccinated, k = 18) + s(hosp) + s(ndate, k = 18)
  Model 4: daily_confirmed_cases ~ s(tests, k = 18) + s(vaccines, k = 18) + 
      s(people_fully_vaccinated, k = 18) + s(ndate, k = 18)
    Resid. Df Resid. Dev         Df Deviance
  1    372.93      38113                    
  2    381.92      44970 -8.9882474  -6857.2
  3    381.92      45328 -0.0011262   -357.7
  4    390.92      51696 -9.0004878  -6368.8
  </code></pre>
  <p>Therefore,  I should stick to the original model with icu and hospital smooth therms included correct?</p>