title: Replicating restricted s.level from rucm in Python's statsmodels
body: <p>I've created a Unobserved Components Model in R using the <a href="https://cran.r-project.org/web/packages/rucm/rucm.pdf" rel="nofollow noreferrer">rucm</a> package:</p>
  <pre><code># input regression formula and extract x and y variables
  regression_formula &lt;- as.formula(paste(&quot;WebsiteVisits ~ MarketingSpend&quot;))  
  
  target_var &lt;- formula.tools::lhs(regression_formula)
  fo &lt;-
    as.formula(paste(formula.tools::lhs.vars(regression_formula), &quot; ~ &quot;, paste(
      formula.tools::rhs.vars(regression_formula), collapse = &quot; + &quot;
    )))
  
  # build unrestricted UCM
  unrestricted_mod &lt;- ucm(
    fo,
    data = final_data,
    level = TRUE,
    slope = TRUE,
    season = FALSE,
  )
  
  # build restricted UCM
  restricted_mod &lt;- ucm(
    fo,
    data = final_data,
    level = TRUE,
    level.var = .1 * mean(unrestricted_mod$vs.level),
    slope = TRUE,
    season = FALSE,
  )
  
  restricted_mod$s.level
  </code></pre>
  <p>How can I recreate this (i.e. get the exact same s.level values using the same parameters) using <a href="https://www.statsmodels.org/devel/generated/statsmodels.tsa.statespace.structural.UnobservedComponents.html" rel="nofollow noreferrer">UnobservedComponents</a> from Python's statsmodels?</p>
  <p>Current progress:</p>
  <pre><code>unrestricted_mod = UnobservedComponents(final_data['WebsiteVisits'], exog=final_data['MarketingSpend'], level=True, slope=True, seasonal=False)
  unrestricted_mod.fit().summary()
  
  # average of the unrestricted model's level (unsure if this is the same as vs.level in R)
  np.mean(unrestricted_mod.fit().level['filtered'])
  
  # now I need to input that value in a restricted model
  
  # ...but I can't seem to input a value here for stochastic_level, only boolean
  restricted_mod = UnobservedComponents(final_data['WebsiteVisits'], exog=final_data['MarketingSpend'], level = True, stochastic_level = True, slope=True, seasonal=False)
  
  </code></pre>