Early Stopping plot_2

Author

Blessing

Published

August 9, 2023

Early Stopping

Here, we present the results of conducting the combined 8 replicates of correlation for within-group 2 prediction (Within), cross-group prediction (Cross), and Early stopping (Early). The purpose was to validate the approach using a pork dataset. Subsequently, a plot was generated, with each color representing a different replicate.

Load the data

  • Combined_COR is a dataframe that contains rows representing Within, Cross, and Early-stopping (with 100 stops- Early_1:100) correlation as well as columns representing different replicates.
  • The values in input_string objects were obtained from analysis conducted in high-performance computing. Each object represents a different replicate.
Code
input_string <- "
0.2396108 0.2590477 0.2573625 0.2583507 0.2677442 0.2767402 0.2805783
0.2802754 0.2787195 0.2778268 0.2780625 0.2790886 0.2803728 0.2814778
0.2821785 0.2824986 0.2826576 0.2829355 0.2835292 0.2844766 0.2856636
0.2868862 0.2879238 0.2885934 0.2887765 0.2884262 0.2875626 0.2862639
0.2846539 0.2828860 0.2811263 0.2795354 0.2782524 0.2773812 0.2769799
0.2770546 0.2775594 0.2784033 0.2794636 0.2806036 0.2816929 0.2826247
0.2833291 0.2837791 0.2839892 0.2840079 0.2839058 0.2837618 0.2836496
0.2836275 0.2837313 0.2839721 0.2843376 0.2847968 0.2853068 0.2858202
0.2862918 0.2866845 0.2869728 0.2871443 0.2871995 0.2871494 0.2870123
0.2868107 0.2865670 0.2863012 0.2860285 0.2857585 0.2854951 0.2852374
0.2849810 0.2847201 0.2844489 0.2841630 0.2838607 0.2835436 0.2832162
0.2828863 0.2825634 0.2822583 0.2819820 0.2817449 0.2815556 0.2814207
0.2813441 0.2813270 0.2813677 0.2814621 0.2816036 0.2817838 0.2819931
0.2822208 0.2824560 0.2826882 0.2829072 0.2831042 0.2832719 0.2834046 
0.2834986 0.2835523"
num <- scan(text = input_string, what = numeric())

input_string2 <- "
0.4318518 0.4403455 0.4187393 0.3994601 0.3940652 0.3982467 0.4047638
0.4087035 0.4091578 0.4077961 0.4063282 0.4055033 0.4054162 0.4059395
0.4069157 0.4082207 0.4097879 0.4116118 0.4137348 0.4162203 0.4191149
0.4224027 0.4259725 0.4296134 0.4330464 0.4359806 0.4381745 0.4394841
0.4398850 0.4394652 0.4383965 0.4368931 0.4351703 0.4334106 0.4317415
0.4302262 0.4288659 0.4276117 0.4263838 0.4250925 0.4236590 0.4220322
0.4201979 0.4181821 0.4160472 0.4138829 0.4117955 0.4098948 0.4082835
0.4070474 0.4062489 0.4059232 0.4060772 0.4066906 0.4077194 0.4091010
0.4107602 0.4126153 0.4145850 0.4165929 0.4185720 0.4204670 0.4222347
0.4238434 0.4252714 0.4265045 0.4275336 0.4283533 0.4289602 0.4293524
0.4295295 0.4294939 0.4292508 0.4288104 0.4281880 0.4274049 0.4264886
0.4254721 0.4243929 0.4232919 0.4222112 0.4211923 0.4202748 0.4194940
0.4188796 0.4184548 0.4182354 0.4182292 0.4184359 0.4188474 0.4194482
0.4202164 0.4211241 0.4221393 0.4232267 0.4243489 0.4254688 0.4265496
0.4275574 0.4284614"
num2 <- scan(text = input_string2, what = numeric())

input_string3 <- "
0.3344285 0.3430335 0.3319918 0.3229055 0.3285484 0.3415687 0.3531256
0.3609336 0.3662515 0.3704145 0.3741031 0.3775873 0.3808728 0.3837590
0.3859398 0.3871262 0.3871501 0.3860333 0.3840064 0.3814629 0.3788596
0.3765991 0.3749383 0.3739511 0.3735472 0.3735315 0.3736765 0.3737829
0.3737178 0.3734264 0.3729247 0.3722803 0.3715880 0.3709451 0.3704315
0.3700970 0.3699573 0.3699974 0.3701815 0.3704639 0.3708002 0.3711553
0.3715076 0.3718498 0.3721867 0.3725299 0.3728936 0.3732894 0.3737236
0.3741956 0.3746987 0.3752215 0.3757493 0.3762662 0.3767556 0.3772008
0.3775853 0.3778928 0.3781073 0.3782147 0.3782030 0.3780640 0.3777945
0.3773969 0.3768802 0.3762597 0.3755569 0.3747985 0.3740147 0.3732385
0.3725026 0.3718385 0.3712739 0.3708315 0.3705277 0.3703716 0.3703654
0.3705044 0.3707779 0.3711702 0.3716620 0.3722319 0.3728569 0.3735139
0.3741805 0.3748351 0.3754580 0.3760311 0.3765383 0.3769661 0.3773035
0.3775426 0.3776782 0.3777088 0.3776361 0.3774652 0.3772045 0.3768652
0.3768652 0.3768652"
num3 <- scan(text = input_string3, what = numeric())

input_string4 <- "
0.2301838 0.2900746 0.3085393 0.3099474 0.3037447 0.2941311 0.2868531
0.2850660 0.2877788 0.2921569 0.2959077 0.2980332 0.2984915 0.2976617
0.2960115 0.2939518 0.2917901 0.2897449 0.2879979 0.2867372 0.2861550
0.2864041 0.2875451 0.2895162 0.2921373 0.2951435 0.2982336 0.3011239
0.3035932 0.3055129 0.3068550 0.3076796 0.3081052 0.3082723 0.3083088
0.3083044 0.3082992 0.3082853 0.3082206 0.3080483 0.3077175 0.3072000
0.3064996 0.3056532 0.3047247 0.3037934 0.3029406 0.3022369 0.3017330
0.3014540 0.3013991 0.3015442 0.3018485 0.3022614 0.3027303 0.3032072
0.3036534 0.3040424 0.3043607 0.3046064 0.3047869 0.3049153 0.3050073
0.3050777 0.3051381 0.3051951 0.3052501 0.3052988 0.3053328 0.3053405
0.3053087 0.3052243 0.3050753 0.3048522 0.3045487 0.3041622 0.3036940
0.3031496 0.3025378 0.3018711 0.3011643 0.3004344 0.2996997 0.2989787
0.2982898 0.2976502 0.2970756 0.2965794 0.2961727 0.2958637 0.2956580
0.2955588 0.2955663 0.2956789 0.2958928 0.2962023 0.2966002 0.2970779
0.2976254 0.2982317"
num4 <- scan(text = input_string4, what = numeric())

input_string5 <- "
0.3199993 0.2959304 0.2680052 0.2570730 0.2602361 0.2669460 0.2719100
0.2751023 0.2776243 0.2795771 0.2803159 0.2794131 0.2771385 0.2743217
0.2719202 0.2706064 0.2705595 0.2714990 0.2728816 0.2741334 0.2748250
0.2747507 0.2739234 0.2725175 0.2707921 0.2690213 0.2674447 0.2662387
0.2655051 0.2652713 0.2654976 0.2660925 0.2669320 0.2678823 0.2688211
0.2696550 0.2703295 0.2708303 0.2711783 0.2714190 0.2716100 0.2718088
0.2720624 0.2724008 0.2728338 0.2733511 0.2739256 0.2745182 0.2750834
0.2755748 0.2759504 0.2761762 0.2762288 0.2760964 0.2757799 0.2752913
0.2746530 0.2738956 0.2730561 0.2721754 0.2712954 0.2704577 0.2697005
0.2690570 0.2685538 0.2682099 0.2680357 0.2680333 0.2681962 0.2685109
0.2689577 0.2695122 0.2701474 0.2708347 0.2715460 0.2722549 0.2729373
0.2735728 0.2741444 0.2746391 0.2750476 0.2753639 0.2755854 0.2757119
0.2757455 0.2756905 0.2755526 0.2753389 0.2750580 0.2747191 0.2743327
0.2739097 0.2734616 0.2730000 0.2725368 0.2720833 0.2716504 0.2712478
0.2708846 0.2705679"
num5 <- scan(text = input_string5, what = numeric())

input_string6 <- "
0.2841650 0.3023990 0.2887506 0.2952681 0.3120237 0.3208670 0.3191778
0.3128132 0.3074610 0.3057455 0.3074899 0.3109992 0.3144354 0.3167480
0.3178730 0.3183237 0.3186272 0.3190035 0.3193722 0.3195394 0.3193780
0.3189070 0.3182717 0.3176718 0.3172846 0.3172110 0.3174546 0.3179313
0.3184996 0.3189996 0.3192912 0.3192811 0.3189363 0.3182837 0.3173966
0.3163752 0.3153254 0.3143408 0.3134920 0.3128232 0.3123542 0.3120870
0.3120133 0.3121209 0.3123972 0.3128305 0.3134081 0.3141133 0.3149227
0.3158039 0.3167163 0.3176132 0.3184465 0.3191714 0.3197513 0.3201614
0.3203908 0.3204426 0.3203320 0.3200840 0.3197293 0.3193014 0.3188328
0.3183533 0.3178875 0.3174550 0.3170699 0.3167413 0.3164745 0.3162718
0.3161331 0.3160570 0.3160406 0.3160803 0.3161713 0.3163077 0.3164829
0.3166888 0.3169168 0.3171578 0.3174027 0.3176426 0.3178698 0.3180779
0.3182619 0.3184188 0.3185470 0.3186466 0.3187186 0.3187647 0.3187870
0.3187873 0.3187671 0.3187273 0.3186682 0.3185895 0.3184905 0.3183706
0.3182291 0.3180657"
num6 <- scan(text = input_string6, what = numeric())

input_string7 <- "
0.3846014 0.4324586 0.4246500 0.4195546 0.4191923 0.4168005 0.4116155
0.4071129 0.4065327 0.4107214 0.4181594 0.4261751 0.4323564 0.4354344
0.4354254 0.4332304 0.4300446 0.4268717 0.4242948 0.4224900 0.4213768
0.4207875 0.4205842 0.4206996 0.4211196 0.4218372 0.4228119 0.4239525
0.4251266 0.4261891 0.4270147 0.4275228 0.4276886 0.4275393 0.4271398
0.4265745 0.4259281 0.4252728 0.4246605 0.4241223 0.4236721 0.4233126
0.4230419 0.4228576 0.4227586 0.4227449 0.4228155 0.4229662 0.4231877
0.4234655 0.4237806 0.4241115 0.4244368 0.4247374 0.4249982 0.4252086
0.4253628 0.4254586 0.4254972 0.4254815 0.4254159 0.4253053 0.4251552
0.4249708 0.4247577 0.4245216 0.4242689 0.4240064 0.4237419 0.4234838
0.4232414 0.4230241 0.4228414 0.4227019 0.4226128 0.4225796 0.4226051
0.4226895 0.4228301 0.4230215 0.4232559 0.4235237 0.4238140 0.4241154
0.4244167 0.4247072 0.4249777 0.4252205 0.4254297 0.4256014 0.4257334
0.4258254 0.4258786 0.4258955 0.4258796 0.4258351 0.4257669 0.4256797
0.4255785 0.4254678"
num7 <- scan(text = input_string7, what = numeric())

input_string8 <- "
0.3487344 0.3864563 0.3899368 0.3897821 0.3895765 0.3898302 0.3909696
0.3940122 0.3986413 0.4029252 0.4049612 0.4040907 0.4008687 0.3964977
0.3922813 0.3891967 0.3876452 0.3874627 0.3881474 0.3891438 0.3900375
0.3906184 0.3908508 0.3908095 0.3906191 0.3904104 0.3902977 0.3903674
0.3906729 0.3912334 0.3920342 0.3930323 0.3941633 0.3953506 0.3965136
0.3975745 0.3984642 0.3991274 0.3995256 0.3996401 0.3994727 0.3990450
0.3983966 0.3975821 0.3966667 0.3957204 0.3948119 0.3940026 0.3933411
0.3928594 0.3925719 0.3924750 0.3925509 0.3927712 0.3931025 0.3935109
0.3939665 0.3944459 0.3949334 0.3954207 0.3959053 0.3963885 0.3968726
0.3973597 0.3978491 0.3983367 0.3988147 0.3992724 0.3996966 0.4000733
0.4003892 0.4006331 0.4007967 0.4008758 0.4008699 0.4007822 0.4006193
0.4003898 0.4001036 0.3997715 0.3994035 0.3990091 0.3985966 0.3981730
0.3977444 0.3973159 0.3968922 0.3964780 0.3960780 0.3956971 0.3953408
0.3950147 0.3947245 0.3944755 0.3942723 0.3941183 0.3940159 0.3939654
0.3939658 0.3940140"
num8 <- scan(text = input_string8, what = numeric())

#Combine the `num` objects with the within and cross group correlation into a dataframe
Combined_COR <- data.frame(COR.1 = c(0.2834851, 0.332359, num),
                           COR.2 = c(0.4285078, 0.2036959, num2),
                           COR.3 = c(0.3768652, 0.3673465, num3),
                           COR.4 = c(0.3057369, 0.1346875, num4),
                           COR.5 = c(0.2698344, 0.29587, num5),
                           COR.6 = c(0.3176768, 0.1590856, num6),
                           COR.7 = c(0.4250093, 0.2468838, num7),
                           COR.8 = c(0.3958681, 0.3383764, num8)
)
dim(Combined_COR)
[1] 102   8
Code
row.names(Combined_COR)= c("Within", "Cross", paste0("Early_", 1:length(num)))

head(Combined_COR)
            COR.1     COR.2     COR.3     COR.4     COR.5     COR.6     COR.7
Within  0.2834851 0.4285078 0.3768652 0.3057369 0.2698344 0.3176768 0.4250093
Cross   0.3323590 0.2036959 0.3673465 0.1346875 0.2958700 0.1590856 0.2468838
Early_1 0.2396108 0.4318518 0.3344285 0.2301838 0.3199993 0.2841650 0.3846014
Early_2 0.2590477 0.4403455 0.3430335 0.2900746 0.2959304 0.3023990 0.4324586
Early_3 0.2573625 0.4187393 0.3319918 0.3085393 0.2680052 0.2887506 0.4246500
Early_4 0.2583507 0.3994601 0.3229055 0.3099474 0.2570730 0.2952681 0.4195546
            COR.8
Within  0.3958681
Cross   0.3383764
Early_1 0.3487344
Early_2 0.3864563
Early_3 0.3899368
Early_4 0.3897821

Plotting result

Figure 1 Relationship between each parameter (* legend only shows the plot character since each color represents different replicate)

Code
plot(1:100, type = "n", xlim = c(1, 100), ylim = c(0.12, 0.55), xlab = "Index", ylab = "COR") %>%
  {invisible(lapply(seq_len(ncol(Combined_COR)), function(i) points(1:100, Combined_COR[, i][-c(1, 2)], col = i)))}

abline(h=Combined_COR[1,], col=1:8, lty= 2, lwd=1.5)
abline(h=Combined_COR[2,], col=1:8, lty="solid", lwd=1.5)

legend("topright", legend = c("Within","Cross", "Early"), pch= c("¦","|", "o"))

Figure 1: Correlation Plot for Commercial Population