CHICAGO — When federal officials studied housing discrimination based on race, the setup was simple: They sent in testers of different backgrounds and gauged how landlords and real estate agents treated people of color compared with whites. As the government prepares a first-ever study of housing discrimination against gays, however, the issue is more complex.