Announcement

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

  • "bys industry fyear: asreg var1 var2 var3, fit" create variables having no values (missing)

    the industry is a two digit number of sic (numerical), fyear is the financial year.
    I use "bys industry fyear: asreg var1 var2 var3, fit", and the resulted "_Nobs; _R2; _adjR2; _b_var2; _b_var3; _b_cons _fitted; _residuals" all have no values (missing values in all variables). But when I do not add "bys industry fyear" and only use the asreg function, then the created variables have values. I do not know how to solve this problem
    Thanks



  • #2
    How many observations do you have for each industry, year pair? Perhaps you have this problem:

    Code:
    . webuse grunfeld
    
    . bysort company year : regress mvalue invest kstock
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1935
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1936
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1937
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1938
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1939
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1940
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1941
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1942
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1943
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1944
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1945
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1946
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1947
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1948
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1949
    insufficient observations
    
    ---------------------------------------------------------------------------------------------------------------
    -> company = 1, year = 1950
    insufficient observations
    Trying to fit a plane in 4 dimensions won't work if you have (as here) just one data point in each regression and in fact you need a lot more than one for a good result.

    Comment


    • #3
      Thanks, the code is conducted on a sample data with only 200 observations, I will increase the sample size significantly and see what happened.

      Comment


      • #4
        Why is this necessary?
        Code:
         bys industry fyear

        Comment

        Working...
        X