# Cross Validation Plot in R

I am relatively new to some machine learning techniques such as cross-validation alongside being quite new to R programming.

However, I am interested in replicating an out-of-sample technique used by Hothorn & Zeileis (2020).

In particular, Supplementary Manual: Section 3.3 (Figure 15) is said to be generated using an: "out-of-sample (50 times 4:1 subsampling) approach.'

I wondered if someone could post some code on how to do this type of '50 times 4:1' type cross-validation on a toy data set?

The estimation methods and performance metrics are irrelevant. Would just love to see some type of process for replicating the graph and the '50 times in 4:1' cross-validation.

Would be genuinely appreciated. This does not include cross validation but I think shows the basics of making such a plot. The key is to have a column that identifies each point so the lines can connect the points between model types.

``````library(ggplot2)
set.seed(123)
Orig <- rnorm(100,mean = 8000,sd = 100)
DF <- data.frame(ID = rep(1:100,4),
Model = rep(c("A","B","C","D"), each = 100),
Value = c(Orig, Orig-500, Orig-700, Orig-600))
ggplot(DF,aes(x = Model, y = Value)) +
geom_line(aes(group = ID),color="grey80",alpha=0.3) +
geom_boxplot() + theme_classic()
`````` Created on 2022-02-13 by the reprex package (v2.0.1)

Thank you @FJCC . This gives me a good idea of the kinda information included in the plotting. Thank you This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.
{"ft_lang_label":"__label__en","ft_lang_prob":0.9111844,"math_prob":0.92914563,"size":707,"snap":"2022-27-2022-33","text_gpt3_token_len":161,"char_repetition_ratio":0.10668563,"word_repetition_ratio":0.0,"special_character_ratio":0.23479491,"punctuation_ratio":0.10869565,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96104914,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,1,null,1,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-06-30T12:53:12Z\",\"WARC-Record-ID\":\"<urn:uuid:ed628e30-8fc4-42fc-9087-94cf8a18dc17>\",\"Content-Length\":\"27214\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:07f33bb6-277b-4621-8589-ece604a03785>\",\"WARC-Concurrent-To\":\"<urn:uuid:8313d76d-72ca-4f33-b051-1419ee792b63>\",\"WARC-IP-Address\":\"167.99.20.217\",\"WARC-Target-URI\":\"https://community.rstudio.com/t/cross-validation-plot-in-r/129120\",\"WARC-Payload-Digest\":\"sha1:N374VXQPUZSCIPLOJ33IW535JQUKRWIP\",\"WARC-Block-Digest\":\"sha1:6F2R342TYVUGDUAWE7SBAMRTTSRJJEZC\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656103821173.44_warc_CC-MAIN-20220630122857-20220630152857-00147.warc.gz\"}"}