Announcement

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

  • multiple regression - r(2000) error message

    Hi everyone,

    I am new here and quite new to Stata (student) so thank you upfront for your help.

    I am doing a study on video game spending and I tried to run the following regression:

    reg payamount gend ag occup educ educp love leish watch gamestart gamecount gamehour gamecat watchhour watchtime

    I got the r(2000) message error so I tried to regress every single variable to see where the problem came from. I have categorical variables (multiple categories) and categories with only 2 options like gend (gender) or "watch", some of the variables are numerical.

    The problem seems to come from the "watch" variable, which displays yes/no values but I already use the command: encode to make it a numerical variable.

    So I don't understand why the "watch" command doesn't work while the "gend" does. Could anyone please help me?

    Sebastian

  • #2
    Sebastian:
    welcome to this forum.
    As per FAQ, posting an example/excerpt of your data via -dataex- can help enormously interested listers to reply positively.
    That said, it may well be that you have missing values in your dataset in addition to the -string- issue..
    As an aside, whenever you have a categorical variable, I would recommend to assign each level a number (say 0=no; 1=yes) and then -label- the variable.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo, thank you for your quick answer and advice, where is dataex? (I am not sure where to find it..)
      Yes, I do have missing values for some of the variables although I don't know how I am supposed to deal with those, I saw in a post I could do the command count if !missing telling me how many of them but I am note sure how I should handle that.
      I did assign number to my values, for example in the variable "watch" (yes=1 and no=2)

      Comment


      • #4
        Hi Sebastian,
        Please type the following command and provide the information that it gives you

        Code:
        describe payamount gend ag occup educ educp love leish watch gamestart gamecount gamehour gamecat watchhour watchtime
        Also, -dataex- should be available if you have stata15. In case you have older versions, just install it (ssc install dataex)
        Fernando

        Comment


        • #5
          Sebastian:
          1) assuming you're using the last Stata release (15), type -help dataex- and read the (really simple) instructions on how to use it. If you're using an older Stata release (and if that were the case you're kindly requested to tell the list, as some of the most recent commands may not be available if your Stata release is "too old";
          2) to deal with missing values, see -mi- entry in Stata .pdf manual (in the light of what above, if your Stata release is "too old you may not have access to that part of the .pdf manual). That said, left to their own devices, missing values are simply omitted by Stata via listwise deletion;
          3) whenever you include a categorical variable in a regression model, Stata re-classifies its level from 0 onwards, no matter how the variable was originally arranged. However, it's a good habit to follow the same approach when you assign a given number to a given level of your categorical variable.

          PS: crossed in the cyberspace with Fernando's helpful advice.
          Last edited by Carlo Lazzaro; 24 Jan 2019, 11:23.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Dear Fernando,

            Thanks for joining the discussion, here is what shows up for describe:

            describe payamount gend ag occup educ educp love leish watch gamestart gamecount gamehour gamecat watchhour watchtime

            storage display value
            variable name type format label variable label
            ---------------------------------------------------------------------------------------------------------------------------
            payamount int %8.0g Amount in CHF paid for video games accessories this last 3 years
            gend long %8.0g gend Gender
            ag long %8.0g ag Age
            occup long %40.0g occup Occupation
            educ long %54.0g educ Highest level of education achieved
            educp long %54.0g educp Highest level of education achieved by participants' mother or father
            love long %17.0g love Current relationship status
            leish byte %8.0g Average number of hours available for leisure's activities per day
            watch long %8.0g watch Participant watches other people play videogames online
            gamestart byte %8.0g how many years ago did the players started playing video games
            gamecount byte %8.0g how many different games the participant plays per week
            gamehour byte %8.0g how many hours participant play video game per week
            gamecat long %38.0g gamecat category of video games they play most
            watchhour float %9.0g how many hours per week the participant watches other people playing video
            game
            watchtime long %15.0g watchtime
            how often the participant watches other people streaming video games


            As for the dataex I found how to do it, here is what I got for the variables:

            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input int payamount long(gend ag occup educ educp love) byte leish long watch byte(gamestart gamecount gamehour) long gamecat float watchhour long watchtime
            1500 2 1 1 5 5 4  2 . 12 3 10 1  3 4
               . 2 1 1 5 4 2  2 .  6 2  8 6  1 2
               . 2 1 5 5 6 2  2 . 10 3  2 3  2 2
               . 1 1 5 6 5 4  1 .  . .  . .  . .
               . 1 1 3 5 2 2  6 1  . .  . .  . .
            3000 2 2 3 5 5 2  2 . 10 2  4 1 .1 2
               . 2 1 5 6 2 4  3 .  5 3  2 1  4 1
               . 2 1 1 5 5 2  4 .  . .  . .  . .
            1000 2 1 1 6 5 4 18 .  8 5 10 1 10 4
               . 2 1 5 6 2 2  6 2  . .  . .  . .
               . 2 1 5 5 2 4  3 .  2 2  7 1  . 3
               . 1 1 5 5 2 4  8 2  . .  . .  . .
               . 1 1 5 5 5 4  5 .  . .  . .  . .
               . 1 1 1 5 6 4  8 2  . .  . .  . .
               . 2 1 3 5 6 2  5 2  . .  . .  . .
               . 1 1 1 5 6 2  5 1  . .  . .  . .
               . 2 2 1 2 1 2  3 2  . .  . .  . .
               . 2 2 1 2 2 2  2 1  . .  . .  . .
            2000 2 1 5 5 2 4  5 .  8 3  6 1 10 1
               . 2 1 3 5 5 4  4 . 10 2  0 1  . 3
            end
            label values gend gend
            label def gend 1 "Female", modify
            label def gend 2 "Male", modify
            label values ag ag
            label def ag 1 "16-25", modify
            label def ag 2 "26-35", modify
            label values occup occup
            label def occup 1 "Employed full time", modify
            label def occup 3 "Partially employed and partially student", modify
            label def occup 5 "Student full time", modify
            label values educ educ
            label def educ 2 "Graduate degree (Graduate degree (master))", modify
            label def educ 5 "Post-mandatory school diploma", modify
            label def educ 6 "Undergraduate degree (Undergraduate degree (bachelor))", modify
            label values educp educp
            label def educp 1 "Doctoral degree (Ph.D.)", modify
            label def educp 2 "Graduate degree (Graduate degree (master))", modify
            label def educp 4 "Mandatory school", modify
            label def educp 5 "Post-mandatory school diploma", modify
            label def educp 6 "Undergraduate degree (Undergraduate degree (bachelor))", modify
            label values love love
            label def love 2 "In a relationship", modify
            label def love 4 "Single", modify
            label values watch watch
            label def watch 1 "No", modify
            label def watch 2 "Yes", modify
            label values gamecat gamecat
            label def gamecat 1 `""First-person-shooter" games (FPS)"', modify
            label def gamecat 3 "Multiplayer online battle arena (MOBA)", modify
            label def gamecat 6 "Sports games", modify
            label values watchtime watchtime
            label def watchtime 1 "Always", modify
            label def watchtime 2 "Couple of times", modify
            label def watchtime 3 "Never", modify
            label def watchtime 4 "Often", modify

            Carlo:
            1)Thank you again for your help, I have the 15 version indeed so I was able to use the dataex.
            2) I had a look at the Stata pdf manual, there are many mi types of command I am a bit lost with what exactly I should use in my case.
            3) I gave a value to the categorical variables by using the encode command.

            Thank you both for your help.

            Comment


            • #7
              Sebastian:
              the explanation is trivial.
              For each non-missing value in the regressand, -watch- is missing.
              As listwise deletion rules out observations with missing values in any of the variables, you end up with no observations.

              Type -help mi_intro_substantive- to eneter the wonderful (and sometimes tricky) -mi- world.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Thank you Carlo, I understood the root of my problem, in fact my independent variable (payamount), also has missing values so I should drop respondent with the missing values for my analysis.

                best regards,

                Sebastian

                Comment


                • #9
                  I woundnt do that just yet.
                  It seems to me that you have some other features in your data that you have either not explored, or not shown to us. It may be, for example, that you have household level data, and payment is assigned only the the head of the household. Perhaps you need to first go to the dataset manual (survey report, questionnaire or similar) and figure out why the information is missing.
                  Fernando

                  Comment


                  • #10
                    Sebastian:
                    I do agree with Fernando. Dropping missing values just because they're missing (ie, without investigating their mechanism and model) is methodologically poor, as you will end up with a subsample that, often, is nothing to do with the original one.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      Dear both,

                      In my survey, some people were responded that they do not play video games and this led to the missing values in the variable "payamount" which is the amount they spent on video games. If I am trying to analyse on what factors do the amount the players pay depends shouldn't I just drop the people with missing values for this specific analysis?

                      Kind regards,

                      Sebastian

                      Comment


                      • #12
                        I do not think so.
                        First, there is still the question of why "watch" is missing when "payamount" is not and viceversa.
                        Second. This seems a classic case of sample selection. So perhaps you should take a look into -heckman-
                        Fernando

                        Comment


                        • #13
                          Sebastian.
                          again, I do agree with Fernando.
                          An exit strategy to avoid -heckman- would rest in the inclusion criteria of the study you're working on, that is including in the data analysis video games players only (but, as per your original post, it does not seem the case).
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment

                          Working...
                          X