title: AR out of sample forecast Python Statsmodels
body: <p>I want to use parameters from a training model to predict values on a test model using statsmodels.</p>
  
  <p>My code:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import statsmodels.api as sm
  
  #Generate data
  index = pd.date_range('2000-1-1', periods=200, freq='M')
  df = pd.DataFrame({'data':np.random.random(200)}, index=index)
  df_train = df[df.index &lt; df.index[100]]
  df_test = df
  
  #Set up model
  mod_train = sm.tsa.AR(df_train)
  res_train = mod_train.fit(max_lag=20,trend='nc')
  params_train = res_train.params
  mod_test = sm.tsa.AR(df_test)
  
  #Use parameters to predict test data
  mod_test.predict(params_train,start = df.index[100],dynamic=False)
  </code></pre>
  
  <p>The Error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-309-a6eb40a5ff54&gt; in &lt;module&gt;()
        9 params_train = res_train.params
       10 mod_test = sm.tsa.AR(df_test)
  ---&gt; 11 mod_test.predict(params_train,start = df.index[100],dynamic=False)
  
  C:\Anaconda\lib\site-packages\statsmodels\tsa\ar_model.pyc in predict(self, params, start, end, dynamic)
      198             raise ValueError("end is before start")
      199 
  --&gt; 200         k_ar = self.k_ar
      201         k_trend = self.k_trend
      202         method = self.method
  
  AttributeError: 'AR' object has no attribute 'k_ar'
  </code></pre>
  
  <p>Can somebody please suggest a workaround? I'm open to other modules too.  Thanks!</p>