Announcement

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

  • Log variable

    Hi

    I am working with panel data (T = 23 and N (countries) = 22), I'd like to now when shouk i take log of variables? And if I apply the log to a variable, do I have to apply log to all variables?
    Thanks

  • #2
    Mary:
    welcome to this forum.
    Your query is far too vague to get a positive reply.
    Usually, log linear models are useful as they allow to express in percentage terms the contribution of each predictor (when adjusted for the other ones) to the variation of the regressand.
    Log-log model helps in estimating elasticity of the regressand with respect to a given predictor.
    In sum: what's your case?

    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Code:
      ssc install transint
      installs a package, which is a help file (only! no commands!), after which

      Code:
      help transint
      gives a basic if opinionated guide to transformations with detail on Stata use.

      What follows is more complicated than you may want to read -- but nevertheless is still simplified.

      Also, general warning: experienced data analysts can disagree in good faith about how often transformations are needed and helpful -- even in the same field when people look at the same data.

      You could (not should) take logarithms of any variable that is always positive

      and should think about doing that if and only if one or more of the following apply:

      1. There is a substantive or theoretical reason why logarithms are the natural or appropriate scale to work on

      2. That brings you closer to linear relationships

      3. That brings you closer to simpler relationships with time

      4. That brings you closer to symmetric distributions with approximately equal variability.

      1 to 4 is perhaps an order of importance; perversely, much of the literature stresses the opposite order, especially poorer texts or papers influenced by such.

      In particular, note that normal or Gaussian distributions are very nice if you have them, but never an essential goal.

      Almost never does logging some variables means that you should log them all. In most applications, time should be left as it comes (modulo recasting to Stata dates, which -- some details aside -- are all just translations of whatever arrives). Variables that are ever zero or negative can't be logged. Indicators (dummies) cannot be logged therefore and even the intent is pointless. Variables that are bounded (e.g. percents, proportions) should not usually be logged.



      Comment


      • #4
        Thanks for your answer Carlo.
        My model has variables at current prices and others in % of GDP, and I don't know if I can estimate this model or if I need to do something to some variables.

        Comment


        • #5
          Mary:
          Nick (as usual) explained clearly when logging is OK and when it is technically impossible/pointless.
          Your reply does not help interested listers that much, as we do not have any idea about what you're after.
          I would recommend you to sketch something in Stata at the best of your knowledge and post back to this forum; in the meantime, reading any decent book on panel data econometrics can help more than hamper.
          Eventually, you are seemingly dealing with a large N, large T panel dataset: hence, you should probably take AR(1) disturbance into account (which is a more technical issue than logging variable) (see help -xtregar-) or serial correlation and heteroskedasticity (see -help xtgls-).
          As an aside I do hope that you can find guidance from your teacher/supervisor and/or skilled academic mates.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thank you very much for your help Mr. Carlo Lazzaro and Nick Cox.

            Comment

            Working...
            X