R codes to generate figure.4
Figure 4