code: def fit_model(ts, maxLag=1, noIntercept=False, sc=None):
      
      assert sc != None, "Missing SparkContext"
      
      jvm = sc._jvm
      jmodel = jvm.com.cloudera.sparkts.models.Autoregression.fitModel(_py2java(sc, Vectors.dense(ts)), maxLag, noIntercept)
      return ARModel(jmodel=jmodel, sc=sc)
docs: Fits an AR(1) model to the given time series
      
      Parameters
      ----------
      ts:
          the time series to which we want to fit an autoregression model as a Numpy array
          
      Returns an ARModel