BACIocc.r and dynamicOcc.r contain R code used to simulate treatment effects on local survival, and models fitted with the R package unmarked 0.9-2 (Fiske and Chandler 2011). BACIocc.r contains code for simulating occupancy data (detection/non-detection) using a Before-After Control-Impact framework, and dynamicOcc.r contains code for dynamic occupancy model fitting. dynamicOcc.r cannot be run independently, but only in conjunction with BACIocc.r, where all variables are declared initialized. Variable definitions and other detailed explanations are embedded in the R code.