R scripts for statistical analysis