Endogenous Prices Demand Model in R