Code for analyzing occupancy models