def _arma_predict_in_sample(start, end, endog, resid, k_ar, method):
 if ('mle' in method):
  fittedvalues = (endog - resid)
 else:
  fittedvalues = (endog[k_ar:] - resid)
 fv_start = start
 if ('mle' not in method):
  fv_start -= k_ar
 fv_end = min(len(fittedvalues), (end + 1))
 return fittedvalues[fv_start:fv_end]

def _arma_predict_in_sample ( start , end , endog , resid , k_ar , method ) : if ( 'mle' in method ) : fittedvalues = ( endog - resid ) else : fittedvalues = ( endog [ k_ar : ] - resid ) fv_start = start if ( 'mle' not in method ) : fv_start -= k_ar fv_end = min ( len ( fittedvalues ) , ( end + 1 ) ) return fittedvalues [ fv_start : fv_end ]
pre- and in-sample fitting for arma .