Location estimation and collective inference in indoor spaces using smartphones