Essays in the economics of caste and religion