Announcement

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

  • no observations in stata

    Dear all

    I am doing a dissertation using stata 13 to investigate if critics affect box office in film industry. first i divide views' rating in bands.


    . egen raveragek=cut(raverage),group(4) label
    (584086 missing values generated)

    .
    . tabulate raveragek

    raveragek | Freq. Percent Cum.
    ------------+-----------------------------------
    0- | 13,534 23.95 23.95
    6.2- | 14,444 25.56 49.52
    7.1- | 14,018 24.81 74.33
    7.8- | 14,507 25.67 100.00
    ------------+-----------------------------------
    Total | 56,503 100.00

    .
    . gen raverage_low=raverage if (raverage<=6.2)
    (625824 missing values generated)

    .
    . gen raverage_mid=raverage if (raverage>6.2)&(raverage<=7.1)
    (625615 missing values generated)

    .
    . gen raverage_upper=raverage if (raverage>7.1)&(raverage<=7.8)
    (628332 missing values generated)

    .
    . gen raverage_up=raverage if (raverage>7.8)&(raverage<=10)
    (626087 missing values generated)

    then i want to put it in panel data. so

    tsset title_numeric week
    panel variable: title_numeric (strongly balanced)
    time variable: week, 2 to 56
    delta: 1 unit

    however there is a problem when i run

    xtreg Total_BO raverage_low raverage_mid raverage_upper raverage_up, fe robust

    it shows no observations. when i track the problem it shows too many variables specified.

    super thanks someone can help me!

    regards

  • #2
    yang:
    whenever (as with your dataset) Stata finds out a missing value in any predictors, drops the corresponding observation via listwise deletion.
    That's why you ended up with no observation at all.
    You have far too many missing values to perform any regression and, probably, any valid inference on your dataset.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      yang:
      whenever (as with your dataset) Stata finds out a missing value in any predictors, drops the corresponding observation via listwise deletion.
      That's why you ended up with no observation at all.
      You have far too many missing values to perform any regression and, probably, any valid inference on your dataset.
      Thanks for your reply. the original dataset is fine, which is from my professor. i think probably is because when i try to divide the variable "raverage" into four groups. then the dataset got some wrong. Can you help me check if the command for dividing the raverage into groups is correct.

      if it is correct, how can i solve this problem i posed.

      thank you very much

      Comment


      • #4
        yang:
        you should divide rverage in categories and rely on -fvvarlist- for creating categorical variables:
        Code:
        g cat_reverage=1 if reverage<=6.2
        replace cat_reverage=2  if reverage>6.2 & raverage<=7.8
        replace cat_reverage=3  if reverage>7.8 & raverage<=10
        label define cat_reverage 1 "low" 2 "mid" 3 "upper" 4 "up"
        label val cat_reverage cat_reverage
        xtreg Total_BO i.cat_reverage, fe robust
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Not to take away from Carlo's excellent advice, but for your further information, the specific problem in the code you shared creating four raverage_ variables is that
          Code:
          gen raverage_low=raverage if (raverage<=6.2)
          will generate a missing value if raverage>6.2. Similarly each of your other three raverage_ variables will be missing when they are not in the range specified. So for each observation, three of the four generated raverage_ variables were missing, and so the observation was dropped from the regression, leaving no observations!

          Comment


          • #6
            Originally posted by Carlo Lazzaro View Post
            yang:
            you should divide rverage in categories and rely on -fvvarlist- for creating categorical variables:
            Code:
            g cat_reverage=1 if reverage<=6.2
            replace cat_reverage=2 if reverage>6.2 & raverage<=7.8
            replace cat_reverage=3 if reverage>7.8 & raverage<=10
            label define cat_reverage 1 "low" 2 "mid" 3 "upper" 4 "up"
            label val cat_reverage cat_reverage
            xtreg Total_BO i.cat_reverage, fe robust
            thank you very much for your help. it really.....helps!!!!! you are a genius!!

            Comment

            Working...
            X