Skip to content

choo_siow_gender_heteroskedastic module

The components of the derivative of the entropy for the Choo and Siow gender-heteroskedastic model.

We normalize the standard error for the X side at 1, and we estimate the standard error on the Y side.

e0_choo_siow_gender_heteroskedastic(muhat, additional_parameters=None)

Returns the values of the parameter-independent part \(e_0\) for the Choo and Siow gender-heteroskedastic model; we normalized \(\sigma=1\).

Parameters:

Name Type Description Default
muhat Matching

a Matching

required

Returns:

Type Description
np.ndarray

the (X,Y) matrix of the parameter-independent part

np.ndarray

of the first derivative of the entropy.

Source code in cupid_matching/choo_siow_gender_heteroskedastic.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def e0_choo_siow_gender_heteroskedastic(
    muhat: Matching, additional_parameters: list | None = None
) -> np.ndarray:
    """Returns the values of the parameter-independent part $e_0$
    for the Choo and Siow gender-heteroskedastic model; we normalized $\\sigma=1$.

    Args:
        muhat: a Matching

    Returns:
        the (X,Y) matrix of the parameter-independent part
        of the first derivative of the entropy.
    """
    muxy, mux0, *_ = muhat.unpack()
    e0_vals = -np.log(muxy / mux0.reshape((-1, 1)))
    return cast(np.ndarray, e0_vals)

e0_derivative_mu_gender_heteroskedastic(muhat, additional_parameters=None)

Returns the derivatives of the parameter-independent part \(e_0\) in \(\mu\). for the Choo and Siow gender-heteroskedastic model; we normalized \(\sigma=1\).

Parameters:

Name Type Description Default
muhat Matching

a Matching

required

Returns:

Type Description
ThreeArrays

the parameter-independent part of the hessian of the entropy

ThreeArrays

wrt \((\mu,\mu)\).

Source code in cupid_matching/choo_siow_gender_heteroskedastic.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def e0_derivative_mu_gender_heteroskedastic(
    muhat: Matching, additional_parameters: list | None = None
) -> ThreeArrays:
    """Returns the derivatives of the parameter-independent part $e_0$ in $\\mu$.
    for the Choo and Siow gender-heteroskedastic model; we normalized $\\sigma=1$.

    Args:
        muhat: a Matching

    Returns:
        the  parameter-independent part of the hessian of the entropy
        wrt $(\\mu,\\mu)$.
    """
    muxy, mux0, *_ = muhat.unpack()
    X, Y = muxy.shape
    hess_x = np.zeros((X, Y, Y))
    hess_y = np.zeros((X, Y, X))
    hess_xy = np.zeros((X, Y))
    der_logxy = 1.0 / muxy
    der_logx0 = 1.0 / mux0
    for x in range(X):
        dlogx0 = der_logx0[x]
        for y in range(Y):
            hess_x[x, y, :] = -dlogx0
            hess_xy[x, y] = -der_logxy[x, y] - dlogx0
    return hess_x, hess_y, hess_xy

e0_derivative_r_gender_heteroskedastic(muhat, additional_parameters=None)

Returns the derivatives of the parameter-independent part \(e_0\) wrt \(r\) for the Choo and Siow gender-heteroskedastic model; we normalized \(\sigma=1\).

Parameters:

Name Type Description Default
muhat Matching

a Matching

required

Returns:

Type Description
TwoArrays

the parameter-independent part of the hessian of the entropy

TwoArrays

wrt \((\mu,r)\).

Source code in cupid_matching/choo_siow_gender_heteroskedastic.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
def e0_derivative_r_gender_heteroskedastic(
    muhat: Matching, additional_parameters: list | None = None
) -> TwoArrays:
    """Returns the derivatives of the parameter-independent part $e_0$ wrt $r$
    for the Choo and Siow gender-heteroskedastic model; we normalized $\\sigma=1$.

    Args:
        muhat: a Matching

    Returns:
        the parameter-independent part of the hessian of the entropy
        wrt $(\\mu,r)$.
    """
    muxy, mux0, *_ = muhat.unpack()
    X, Y = muxy.shape
    hess_n = np.zeros((X, Y))
    hess_m = np.zeros((X, Y))
    der_logx0 = 1.0 / mux0
    for x in range(X):
        dlogx0 = der_logx0[x]
        for y in range(Y):
            hess_n[x, y] = dlogx0
    return hess_n, hess_m

e_choo_siow_gender_heteroskedastic(muhat, additional_parameters=None)

Returns the values of the parameter-dependent part \(e\) for the Choo and Siow gender-heteroskedastic model; we normalized \(\sigma=1\).

Parameters:

Name Type Description Default
muhat Matching

a Matching

required

Returns:

Type Description
np.ndarray

the (X,Y,1) array of the parameter-dependent part

np.ndarray

of the first derivative of the entropy.

Source code in cupid_matching/choo_siow_gender_heteroskedastic.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def e_choo_siow_gender_heteroskedastic(
    muhat: Matching, additional_parameters: list | None = None
) -> np.ndarray:
    """Returns the values of the parameter-dependent part  $e$
    for the Choo and Siow gender-heteroskedastic model; we normalized $\\sigma=1$.

    Args:
        muhat: a Matching

    Returns:
        the (X,Y,1) array of the parameter-dependent part
        of the first derivative of the entropy.
    """
    muxy, _, mu0y, *_ = muhat.unpack()
    X, Y = muxy.shape
    n_alpha = 1

    e_vals = np.zeros((X, Y, n_alpha))
    e_vals[:, :, 0] = -np.log(muxy / mu0y)
    return e_vals

e_derivative_mu_gender_heteroskedastic(muhat, additional_parameters=None)

Returns the derivatives of the parameter-dependent part \(e\) wrt \(\mu\) for the Choo and Siow gender-heteroskedastic model; we normalized \(\sigma_1=1\).

Parameters:

Name Type Description Default
muhat Matching

a Matching

required

Returns:

Type Description
ThreeArrays

the parameter-dependent part of the hessian of the entropy

ThreeArrays

wrt \((\mu,\mu)\).

Source code in cupid_matching/choo_siow_gender_heteroskedastic.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
def e_derivative_mu_gender_heteroskedastic(
    muhat: Matching, additional_parameters: list | None = None
) -> ThreeArrays:
    """Returns the derivatives of the parameter-dependent part $e$
     wrt $\\mu$ for the Choo and Siow gender-heteroskedastic model;
     we normalized $\\sigma_1=1$.

    Args:
        muhat: a Matching

    Returns:
        the parameter-dependent part of the hessian of the entropy
        wrt $(\\mu,\\mu)$.
    """
    muxy, _, mu0y, *_ = muhat.unpack()
    X, Y = muxy.shape

    n_alpha = 1
    hess_x = np.zeros((X, Y, Y, n_alpha))
    hess_y = np.zeros((X, Y, X, n_alpha))
    hess_xy = np.zeros((X, Y, n_alpha))
    der_logxy = 1.0 / muxy
    der_log0y = 1.0 / mu0y
    for x in range(X):
        for y in range(Y):
            dlog0y = der_log0y[y]
            hess_y[x, y, :, 0] = -dlog0y
            hess_xy[x, y, 0] = -der_logxy[x, y] - dlog0y
    return hess_x, hess_y, hess_xy

e_derivative_r_gender_heteroskedastic(muhat, additional_parameters=None)

Returns the derivatives of the parameter-dependent part \(e\) wrt \(r\) for the Choo and Siow gender-heteroskedastic model; we normalized \(\sigma_1=1\).

Parameters:

Name Type Description Default
muhat Matching

a Matching

required

Returns:

Type Description
TwoArrays

the parameter-dependent part of the hessian of the entropy

TwoArrays

wrt \((\mu,r)\)

Source code in cupid_matching/choo_siow_gender_heteroskedastic.py
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
def e_derivative_r_gender_heteroskedastic(
    muhat: Matching, additional_parameters: list | None = None
) -> TwoArrays:
    """Returns the derivatives of the parameter-dependent part $e$
     wrt $r$ for the Choo and Siow gender-heteroskedastic model;
     we normalized $\\sigma_1=1$.

    Args:
        muhat: a Matching

    Returns:
        the parameter-dependent part of the hessian of the entropy
        wrt $(\\mu,r)$
    """
    muxy, _, mu0y, *_ = muhat.unpack()
    X, Y = muxy.shape

    n_alpha = 1
    hess_n = np.zeros((X, Y, n_alpha))
    hess_m = np.zeros((X, Y, n_alpha))
    der_log0y = 1.0 / mu0y
    for x in range(X):
        for y in range(Y):
            dlog0y = der_log0y[y]
            hess_m[x, y, 0] = dlog0y
    return hess_n, hess_m