R codes for statistical analysis