Substitutes and Complements
Telling gross substitutes from complements by the sign of the cross-price effect, and computing a cross-price elasticity.
You buy two products from a sports centre, Class X and Class Y, and spend the rest of your money on other goods. Your utility is U = ufunc, where x is the number of units of Class X, y the number of units of Class Y and z the dollars left for other goods. The prices are $px for Class X and $py for Class Y. Quantities are continuous, and income is large enough that x, y and z are all positive at the optimum, before and after a small price change. Judging by how the quantity of one product demanded responds to the price of the other, are Class X and Class Y substitutes or complements for this consumer?
Use it
from datasets import load_dataset
ds = load_dataset("narunraman/steer_me", "substitutes_complements")curl "https://steer-benchmark.cs.ubc.ca/api/sample?element_name=substitutes_complements&n=5&seed=42"
See the Reference for the parameters.