title: How to use GLS in Python's statsmodel and specify a certain correlation structure: (CorARMA in R)
body: <p><strong>Summary</strong>
  I am trying to use 'statsmodels' in Python to fit a GLS model, while specifying a certain autocorrelation structure. In particular I am trying to recreate the following command from R:</p>
  <pre><code>   model_p10 &lt;- gls(flow ~ time + level + trend,   data=data,  
     correlation=corARMA(p=10,form=~time),   method=&quot;ML&quot;)
  </code></pre>
  <p><strong>Details</strong>
  I am trying to follow a (free) <a href="https://www.edx.org/course/policy-analysis-using-interrupted-time-series" rel="nofollow noreferrer">course on time series intervention analysis</a>, taught using R, but instead using Python. I can see that <a href="https://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.GLS.html" rel="nofollow noreferrer">GLS in Statsmodels</a> does accept other parameters. I am not sure what the Python equivalent of <a href="https://www.rdocumentation.org/packages/nlme/versions/3.1-157/topics/corARMA" rel="nofollow noreferrer"><code>corARMA(p=,q=)</code></a> would be or if I can feed that in to the statsmodels GLS function to recreate the code snippet above.</p>
  <p>Ideally I would like to be able to do something like the following in Python:</p>
  <pre><code>GLS(y,X, corARMA(p=,q=)).fit()
  </code></pre>
  <p>I have tried playing around with ARIMA in statsmodels, but I am not a statistician and am not sure what I am doing. For my final result I want the plot to be a straight line, and take into account auto regressive and/or moving average term.</p>