Should data be split into test / training prior to descriptive statistics being carried out on it?












3












$begingroup$


I have a data set that I have added to and plan to carry out some modelling with. I'm wondering whether I should split the data into test / training prior to carrying out the modelling, or if I should write the descriptive section out first then split into test/training for the modelling part.



The descriptive stuff is going to be things like percentiles, some $chi^2$ between different levels, basics like this.



The data is mainly categorical, there are around 700 rows and 30 columns.
I'm planning to carry out logistic regression and (probably) a decision tree.










share|cite|improve this question









$endgroup$

















    3












    $begingroup$


    I have a data set that I have added to and plan to carry out some modelling with. I'm wondering whether I should split the data into test / training prior to carrying out the modelling, or if I should write the descriptive section out first then split into test/training for the modelling part.



    The descriptive stuff is going to be things like percentiles, some $chi^2$ between different levels, basics like this.



    The data is mainly categorical, there are around 700 rows and 30 columns.
    I'm planning to carry out logistic regression and (probably) a decision tree.










    share|cite|improve this question









    $endgroup$















      3












      3








      3





      $begingroup$


      I have a data set that I have added to and plan to carry out some modelling with. I'm wondering whether I should split the data into test / training prior to carrying out the modelling, or if I should write the descriptive section out first then split into test/training for the modelling part.



      The descriptive stuff is going to be things like percentiles, some $chi^2$ between different levels, basics like this.



      The data is mainly categorical, there are around 700 rows and 30 columns.
      I'm planning to carry out logistic regression and (probably) a decision tree.










      share|cite|improve this question









      $endgroup$




      I have a data set that I have added to and plan to carry out some modelling with. I'm wondering whether I should split the data into test / training prior to carrying out the modelling, or if I should write the descriptive section out first then split into test/training for the modelling part.



      The descriptive stuff is going to be things like percentiles, some $chi^2$ between different levels, basics like this.



      The data is mainly categorical, there are around 700 rows and 30 columns.
      I'm planning to carry out logistic regression and (probably) a decision tree.







      categorical-data dataset descriptive-statistics






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 25 '18 at 21:07









      baxxbaxx

      265111




      265111






















          1 Answer
          1






          active

          oldest

          votes


















          4












          $begingroup$

          Data splitting often requires a sample size exceeding 20,000 to work properly, i.e., to be stable. Otherwise re-splitting the data will result in arbitrary changes of the model and also of the validation stats. And note that decision trees are not competitive with logistic regression. The bootstrap or repeated cross-validation are preferred. See my RMS book and course notes.



          In terms of what you can do before model validation, anything that is masked to Y is fair game. So you can do descriptive statistics that do not examine associations between X and Y.






          share|cite|improve this answer









          $endgroup$









          • 4




            $begingroup$
            Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
            $endgroup$
            – baxx
            Dec 25 '18 at 21:36










          • $begingroup$
            What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
            $endgroup$
            – Jon
            Dec 26 '18 at 2:33






          • 1




            $begingroup$
            @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
            $endgroup$
            – baxx
            Dec 26 '18 at 23:06






          • 1




            $begingroup$
            Tell me the nature of the contradiction and what is unclear about the notes.
            $endgroup$
            – Frank Harrell
            Dec 26 '18 at 23:08






          • 1




            $begingroup$
            In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
            $endgroup$
            – baxx
            Dec 27 '18 at 12:44











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "65"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f384454%2fshould-data-be-split-into-test-training-prior-to-descriptive-statistics-being%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4












          $begingroup$

          Data splitting often requires a sample size exceeding 20,000 to work properly, i.e., to be stable. Otherwise re-splitting the data will result in arbitrary changes of the model and also of the validation stats. And note that decision trees are not competitive with logistic regression. The bootstrap or repeated cross-validation are preferred. See my RMS book and course notes.



          In terms of what you can do before model validation, anything that is masked to Y is fair game. So you can do descriptive statistics that do not examine associations between X and Y.






          share|cite|improve this answer









          $endgroup$









          • 4




            $begingroup$
            Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
            $endgroup$
            – baxx
            Dec 25 '18 at 21:36










          • $begingroup$
            What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
            $endgroup$
            – Jon
            Dec 26 '18 at 2:33






          • 1




            $begingroup$
            @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
            $endgroup$
            – baxx
            Dec 26 '18 at 23:06






          • 1




            $begingroup$
            Tell me the nature of the contradiction and what is unclear about the notes.
            $endgroup$
            – Frank Harrell
            Dec 26 '18 at 23:08






          • 1




            $begingroup$
            In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
            $endgroup$
            – baxx
            Dec 27 '18 at 12:44
















          4












          $begingroup$

          Data splitting often requires a sample size exceeding 20,000 to work properly, i.e., to be stable. Otherwise re-splitting the data will result in arbitrary changes of the model and also of the validation stats. And note that decision trees are not competitive with logistic regression. The bootstrap or repeated cross-validation are preferred. See my RMS book and course notes.



          In terms of what you can do before model validation, anything that is masked to Y is fair game. So you can do descriptive statistics that do not examine associations between X and Y.






          share|cite|improve this answer









          $endgroup$









          • 4




            $begingroup$
            Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
            $endgroup$
            – baxx
            Dec 25 '18 at 21:36










          • $begingroup$
            What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
            $endgroup$
            – Jon
            Dec 26 '18 at 2:33






          • 1




            $begingroup$
            @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
            $endgroup$
            – baxx
            Dec 26 '18 at 23:06






          • 1




            $begingroup$
            Tell me the nature of the contradiction and what is unclear about the notes.
            $endgroup$
            – Frank Harrell
            Dec 26 '18 at 23:08






          • 1




            $begingroup$
            In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
            $endgroup$
            – baxx
            Dec 27 '18 at 12:44














          4












          4








          4





          $begingroup$

          Data splitting often requires a sample size exceeding 20,000 to work properly, i.e., to be stable. Otherwise re-splitting the data will result in arbitrary changes of the model and also of the validation stats. And note that decision trees are not competitive with logistic regression. The bootstrap or repeated cross-validation are preferred. See my RMS book and course notes.



          In terms of what you can do before model validation, anything that is masked to Y is fair game. So you can do descriptive statistics that do not examine associations between X and Y.






          share|cite|improve this answer









          $endgroup$



          Data splitting often requires a sample size exceeding 20,000 to work properly, i.e., to be stable. Otherwise re-splitting the data will result in arbitrary changes of the model and also of the validation stats. And note that decision trees are not competitive with logistic regression. The bootstrap or repeated cross-validation are preferred. See my RMS book and course notes.



          In terms of what you can do before model validation, anything that is masked to Y is fair game. So you can do descriptive statistics that do not examine associations between X and Y.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 25 '18 at 21:29









          Frank HarrellFrank Harrell

          55.4k3108244




          55.4k3108244








          • 4




            $begingroup$
            Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
            $endgroup$
            – baxx
            Dec 25 '18 at 21:36










          • $begingroup$
            What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
            $endgroup$
            – Jon
            Dec 26 '18 at 2:33






          • 1




            $begingroup$
            @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
            $endgroup$
            – baxx
            Dec 26 '18 at 23:06






          • 1




            $begingroup$
            Tell me the nature of the contradiction and what is unclear about the notes.
            $endgroup$
            – Frank Harrell
            Dec 26 '18 at 23:08






          • 1




            $begingroup$
            In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
            $endgroup$
            – baxx
            Dec 27 '18 at 12:44














          • 4




            $begingroup$
            Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
            $endgroup$
            – baxx
            Dec 25 '18 at 21:36










          • $begingroup$
            What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
            $endgroup$
            – Jon
            Dec 26 '18 at 2:33






          • 1




            $begingroup$
            @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
            $endgroup$
            – baxx
            Dec 26 '18 at 23:06






          • 1




            $begingroup$
            Tell me the nature of the contradiction and what is unclear about the notes.
            $endgroup$
            – Frank Harrell
            Dec 26 '18 at 23:08






          • 1




            $begingroup$
            In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
            $endgroup$
            – baxx
            Dec 27 '18 at 12:44








          4




          4




          $begingroup$
          Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
          $endgroup$
          – baxx
          Dec 25 '18 at 21:36




          $begingroup$
          Thank's Frank. So here you're suggesting suggesting that test/training with 700 rows is pointless? In your course notes though (Data splitting, 5.3.3 from : hbiostat.org/doc/rms.pdf) you give an example of a dataset with 300 elements, where the training is 200 and the test is 100. I'm still not too sure whether, in this example, you would carry out descriptive statistics on the data prior to splitting or not.
          $endgroup$
          – baxx
          Dec 25 '18 at 21:36












          $begingroup$
          What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
          $endgroup$
          – Jon
          Dec 26 '18 at 2:33




          $begingroup$
          What empirical evidence do you have to support the “20,000” sample size requirement? That seems a bit arbitrary.
          $endgroup$
          – Jon
          Dec 26 '18 at 2:33




          1




          1




          $begingroup$
          @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
          $endgroup$
          – baxx
          Dec 26 '18 at 23:06




          $begingroup$
          @FrankHarrell I didn't find it clear, and the notes that you linked seemed to contradict what you've written in your original post (to me).
          $endgroup$
          – baxx
          Dec 26 '18 at 23:06




          1




          1




          $begingroup$
          Tell me the nature of the contradiction and what is unclear about the notes.
          $endgroup$
          – Frank Harrell
          Dec 26 '18 at 23:08




          $begingroup$
          Tell me the nature of the contradiction and what is unclear about the notes.
          $endgroup$
          – Frank Harrell
          Dec 26 '18 at 23:08




          1




          1




          $begingroup$
          In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
          $endgroup$
          – baxx
          Dec 27 '18 at 12:44




          $begingroup$
          In the post you've mentioned 20,000 but not explained why. In the notes you have n = 300 for splitting. For myself that is contradictory in this context. I've probably missed something, but I'm not experienced. In the explanation about whether or not descriptives can be done you mention about anything 'masked to Y', I'm not familiar with this expression. Are you saying that anything which isn't ultimately used in the model can be used in the descriptives?
          $endgroup$
          – baxx
          Dec 27 '18 at 12:44


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Cross Validated!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f384454%2fshould-data-be-split-into-test-training-prior-to-descriptive-statistics-being%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen