title: How to use sample weights in GAM (mgcv) on survey data for Logit regression?
body: <p>I'm interesting in performing a GAM regression on data from a national wide survey which presents sample weights. I read with interest this  <a href="https://stylizeddata.com/how-to-use-survey-weights-in-r/" rel="nofollow noreferrer">post</a>. 
  I selected my vars of interest generating a DF:</p>
  
  <pre><code>nhanesAnalysis &lt;- nhanesDemo %&gt;%
                      select(fpl,
                             age,
                             gender,
                             persWeight,
                             psu,
                             strata)
  </code></pre>
  
  <p>Than, for what I understood, I generated a weighted DF with the following code:</p>
  
  <pre><code>library(survey)    
  nhanesDesign &lt;- svydesign(    id      = ~psu,
                                strata  = ~strata,
                                weights = ~persWeight,
                                nest    = TRUE,
                                data    = nhanesAnalysis)
  </code></pre>
  
  <p>Let's say that I would select only subjects with <code>age≥30</code>:</p>
  
  <pre><code>ageDesign &lt;- subset(nhanesDesign, age &gt;= 30)
  </code></pre>
  
  <p>Now, I would fit a GAM model (<code>fpl ~ s(age) + gender</code>) with <code>mgcv package</code>. Is it possible to do so with the <code>weights</code> argument or using <code>svydesign</code> object <code>ageDesign</code> ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I was wondering if is it correct to extrapolate computed weights from the an <code>svyglm</code> object and use it for <code>weights</code> argument in GAM. </p>