Announcement

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

  • How to solve this problem? "time variable must contain only integer values r(451)"


    Hi,

    I am trying to run panel logistic regression. It is a time series data of firms.

    The tsset results are:

    . tsset countfirm year
    panel variable: countfirm (unbalanced)
    time variable: year, 2001 to 2015
    delta: 1 unit

    After this, i declare it as a time series with these commands
    .tis year
    iis countfirm


    When i try to run fe model, I am getting this error.

    . xtset status nita,fe
    option fe not allowed
    r(198);

    When i try without fe, I am getting this error.

    . xtset status nita
    time variable must contain only integer values
    r(451);


    status is a dummy variable 0 and 1. I have a list of independent variables but i am trying to run with one variable first.
    My data do not have duplicate years and do not have any jumps in time periods. Can anyone please help? I am badly stuck.

    Regards,
    Sumaira

  • #2
    Are you perhaps confusing -xtset- with -xtreg-? You have already -tsset- your data with a panel and time variables, the results of which are entirely equivalent to having -xtset- the data with the same panel and time variables. You then have a new -xtset status nita- command and you indicate that status is a 0/1 variable. But it is very odd indeed to try to define panels with a single 0/1 variable: usually there are many more than 2 panels in a data set. And you don't say at all waht the variable nita is, but if it doesn't contain integer values, it is not suitable to be used as the time variable when -xtset-ing (nor -tsset-ing the data. The fact that you erroneously initially tried this with an -fe- option makes me think you were trying to do a fixed-effects regression. But -xtset- doesn't do that: you mean -xtreg- if that's what you want.

    Comment


    • #3
      Yes, you need variation in the dependent variable for any regression in order to determine the effects of the independent variables. Otherwise, all you know is that none of your independent variables have any effect on the dependent variable. If you omit the fixed effects, then you will have variation across the firms, or countries, or whatever it is your panels are.
      Last edited by William Lisowski; 21 Mar 2018, 18:35.

      Comment


      • #4
        You can’t use fe if there is no variation within groups. For a brief explanation, see https://www3.nd.edu/~rwilliam/xsoc73...xedEffects.pdf
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          status is a dummy variable 0 and 1. I have a list of independent variables but i am trying to run with one variable first.
          nita is a financial ratio "Net income/total assets" I have a set of 17 more ratios
          Little wonder you got an error messag when you - xtset status nita - for the first time.

          The correct command as you can check in the Stata Manual is something like:

          Code:
          . xtset panelvar timevar
          If I understood your case correctly, neither "status" is a panel variable nor "nita" is a time variable.
          Best regards,

          Marcos

          Comment

          Working...
          X