artificial_regressors module¶
Helpers to construct Salanié-Wolak artificial regressors.
make_K_and_y(X2, shares, J)
¶
Construct second-order regressors and the log-share LHS by market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients. |
required |
shares
|
ndarray
|
Observed market shares. |
required |
J
|
int
|
Number of products per market. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TwoArrays |
TwoArrays
|
|
TwoArrays
|
stacked log share ratios. |
Source code in frac_blp/artificial_regressors.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
make_T(X2, shares, J)
¶
Construct third-order regressors and the log-share LHS by market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients. |
required |
shares
|
ndarray
|
Observed market shares. |
required |
J
|
int
|
Number of products per market. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix |
Source code in frac_blp/artificial_regressors.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
make_V(X2, shares, J)
¶
Construct fourth-order regressors for the excess kurtosis by market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients. |
required |
shares
|
ndarray
|
Observed market shares. |
required |
J
|
int
|
Number of products per market. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix |
Source code in frac_blp/artificial_regressors.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
make_W(X2, shares, J)
¶
Construct fourth-order regressors for the product of variances by market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients. |
required |
shares
|
ndarray
|
Observed market shares. |
required |
J
|
int
|
Number of products per market. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix |
Source code in frac_blp/artificial_regressors.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
make_this_K(X2, shares)
¶
Build second-order Salanié-Wolak artificial regressors on one market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Product characteristics of shape |
required |
shares
|
ndarray
|
Product-level market shares of shape |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix |
Source code in frac_blp/artificial_regressors.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
make_this_T(X2, shares)
¶
Construct third-order regressors for a single market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients for a single market. |
required |
shares
|
ndarray
|
Observed market shares for the same market. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix of third-order regressors for the market. |
Source code in frac_blp/artificial_regressors.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
make_this_V(X2, shares)
¶
Construct fourth-order regressors for the excess kurtosis for a single market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients for a single market. |
required |
shares
|
ndarray
|
Observed market shares for the same market. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix of fourth-order regressors for the market. |
Source code in frac_blp/artificial_regressors.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
make_this_W(X2, shares)
¶
Construct fourth-order regressors for the products of variances for a single market.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X2
|
ndarray
|
Regressors with random coefficients for a single market. |
required |
shares
|
ndarray
|
Observed market shares for the same market. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Matrix of fourth-order regressors for the market. |
Source code in frac_blp/artificial_regressors.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |