artificial_regressors module¶
Helpers to construct Salanié-Wolak artificial regressors.
make_K(X, shares)
¶
Build second-order Salanié-Wolak artificial regressors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
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
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
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
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 54 | |