A linked risk group model for investigating the spread of HIV