tests/sensitivity/test_msm_sensitivity.py
def simulate_moment_contributions(params, x, y):
    """Calculate moment contributions for example from Honore, DePaula, Jorgensen."""

    y_estimated = x.to_numpy() @ (params["value"].to_numpy())

    x_np = x.T.to_numpy()

    residual = y.T.to_numpy() - stats.norm.cdf(y_estimated)

    mom_value = []

    length = len(x_np)

    for i in range(length):
        for j in range(i, length):
            moment = residual * x_np[i] * x_np[j]
            mom_value.append(moment)

    mom_value = np.stack(mom_value, axis=1)[0]
    mom_value = pd.DataFrame(data=mom_value)

    return mom_value
Calculate moment contributions for example from Honore, DePaula, Jorgensen.
Calculate moment contributions for example from Honore, DePaula, Jorgensen.
Calculate moment contributions for example from Honore DePaula Jorgensen .
def simulate_moment_contributions(params, x, y):
    y_estimated = x.to_numpy() @ (params["value"].to_numpy())
    x_np = x.T.to_numpy()
    residual = y.T.to_numpy() - stats.norm.cdf(y_estimated)
    mom_value = []
    length = len(x_np)
    for i in range(length):
        for j in range(i, length):
            moment = residual * x_np[i] * x_np[j]
            mom_value.append(moment)
    mom_value = np.stack(mom_value, axis=1)[0]
    mom_value = pd.DataFrame(data=mom_value)
    return mom_value
def simulate_moment_contributions ( params , x , y ) : y_estimated = x . to_numpy ( ) @ ( params [ "value" ] . to_numpy ( ) ) x_np = x . T . to_numpy ( ) residual = y . T . to_numpy ( ) - stats . norm . cdf ( y_estimated ) mom_value = [ ] length = len ( x_np ) for i in range ( length ) : for j in range ( i , length ) : moment = residual * x_np [ i ] * x_np [ j ] mom_value . append ( moment ) mom_value = np . stack ( mom_value , axis = 1 ) [ 0 ] mom_value = pd . DataFrame ( data = mom_value ) return mom_value
Calculate moment contributions for example from Honore, DePaula, Jorgensen.
Calculate moment contributions for example from Honore DePaula Jorgensen .
"""Calculate moment contributions for example from Honore, DePaula, Jorgensen."""
params
x
y