writes R file for bootstrap diagnostic plots