Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with 1 group found, 2 required r(420) error

    I tried running ttest on my DV (whosefault) and the IV (successcond) but for some reason, Stata tells me there is only 1 group found:

    Code:
    . ttest whosefault, by(successcond)
    1 group found, 2 required
    r(420);
    I tried recoding the IV from 0 and 1 to 2 and 3, I've tried updating my Stata, I've also tried recoding the variable in Excel then import it to Stata and none of it works. I've checked and this variable is identified as byte and not string. I have another IV which is coded in exactly the same way (0, 1) and it works though. I've tried this exact same code on another data set and it worked as well. I have no idea what i'm doing wrong!

    Please advice.

  • #2
    It sounds like there is something wrong with the data, particularly with variable successcond. But since you don't show any example data, that's just a guess, and not very specific at that.

    If you want a more helpful response, post back showing an example of your data, an example that reproduces the problem you are having. Be sure to use the -dataex- command to do that. If you are running version 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment


    • #3
      Thanks Clyde! Is this what you meant?

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input byte successcond
      1
      1
      0
      1
      0
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      0
      0
      1
      1
      0
      0
      1
      1
      0
      0
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      1
      end

      Comment


      • #4
        Oh! I found what the problem is! There was a problem with the data of the DV, not the IV. I'm sorry but thanks for your help!

        Comment

        Working...
        X