def fit_model(y, x, yMaxLag, xMaxLag, includesOriginalX=True, noIntercept=False, sc=None):
    """
    Fit an autoregressive model with additional exogenous variables. The model predicts a value
    at time t of a dependent variable, Y, as a function of previous values of Y, and a combination
    of previous values of exogenous regressors X_i, and current values of exogenous regressors X_i.
    This is a generalization of an AR model, which is simply an ARX with no exogenous regressors.
    The fitting procedure here is the same, using least squares. Note that all lags up to the
    maxlag are included. In the case of the dependent variable the max lag is 'yMaxLag', while
    for the exogenous variables the max lag is 'xMaxLag', with which each column in the original
    matrix provided is lagged accordingly.

    Parameters
    ----------
    y:
            the dependent variable, time series as a Numpy array
    x:
            a matrix of exogenous variables as a Numpy array
    yMaxLag:
            the maximum lag order for the dependent variable
    xMaxLag:
            the maximum lag order for exogenous variables
    includesOriginalX:
            a boolean flag indicating if the non-lagged exogenous variables should
            be included. Default is true
    noIntercept:
            a boolean flag indicating if the intercept should be dropped. Default is
            false
        
    Returns an ARXModel, which is an autoregressive model with exogenous variables.
    """
    assert sc != None, "Missing SparkContext"
    
    jvm = sc._jvm
    jmodel = jvm.com.cloudera.sparkts.models.AutoregressionX.fitModel(_nparray2breezevector(sc, y.toArray()), _nparray2breezematrix(sc, x.toArray()), yMaxLag, xMaxLag, includesOriginalX, noIntercept)
    return ARXModel(jmodel=jmodel, sc=sc)
Fit an autoregressive model with additional exogenous variables. The model predicts a value
    at time t of a dependent variable, Y, as a function of previous values of Y, and a combination
    of previous values of exogenous regressors X_i, and current values of exogenous regressors X_i.
    This is a generalization of an AR model, which is simply an ARX with no exogenous regressors.
    The fitting procedure here is the same, using least squares. Note that all lags up to the
    maxlag are included. In the case of the dependent variable the max lag is 'yMaxLag', while
    for the exogenous variables the max lag is 'xMaxLag', with which each column in the original
    matrix provided is lagged accordingly.

    Parameters
    ----------
    y:
            the dependent variable, time series as a Numpy array
    x:
            a matrix of exogenous variables as a Numpy array
    yMaxLag:
            the maximum lag order for the dependent variable
    xMaxLag:
            the maximum lag order for exogenous variables
    includesOriginalX:
            a boolean flag indicating if the non-lagged exogenous variables should
            be included. Default is true
    noIntercept:
            a boolean flag indicating if the intercept should be dropped. Default is
            false
        
    Returns an ARXModel, which is an autoregressive model with exogenous variables.