def calc_adj_r2(r2, n, k):
    """ Calculate and return adjusted r2 score.
    Parameters
    ----------
    r2  :
        Original r2 score.
    n   :
        Number of points in data sample.
    k   :
        Number of variables in model, excluding the constant.
    Returns
    -------
    float
        Adjusted R2 score.
    """
    return 1 - (((1 - r2) * (n - 1)) / (n - k - 1))