Log PDF for the Skew-t distribution

    Parameters
    ----------
    x : np.array
        random variables

    shape : float
        The degrees of freedom for the skew-t distribution

    loc : np.array
        The location parameter for the skew-t distribution

    scale : float
        The scale of the distribution

    skewness : float
        Skewness parameter (if 1, no skewness, if > 1, +ve skew, if < 1, -ve skew)

def logpdf(x, shape, loc=0.0, scale=1.0, skewness=1.0):
    """
    Log PDF for the Skew-t distribution

    Parameters
    ----------
    x : np.array
        random variables

    shape : float
        The degrees of freedom for the skew-t distribution

    loc : np.array
        The location parameter for the skew-t distribution

    scale : float
        The scale of the distribution

    skewness : float
        Skewness parameter (if 1, no skewness, if > 1, +ve skew, if < 1, -ve skew)

    """
    m1 = (np.sqrt(shape)*sp.gamma((shape-1.0)/2.0))/(np.sqrt(np.pi)*sp.gamma(shape/2.0))
    loc = loc + (skewness - (1.0/skewness))*scale*m1
    result = np.zeros(x.shape[0])
    result[x-loc<0] = np.log(2.0) - np.log(skewness + 1.0/skewness) + ss.t.logpdf(x=skewness*x[(x-loc) < 0], loc=loc[(x-loc) < 0]*skewness,df=shape, scale=scale[(x-loc) < 0])
    result[x-loc>=0] = np.log(2.0) - np.log(skewness + 1.0/skewness) + ss.t.logpdf(x=x[(x-loc) >= 0]/skewness, loc=loc[(x-loc) >= 0]/skewness,df=shape, scale=scale[(x-loc) >= 0])
    return result