Announcement

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

  • I need to log a variable, but some of the observations are negative. How to solve this problem?

    Hi,

    I'm using Stata/SE 16.1.
    My dataset is a panel data and contains the financial statement and key figures of all companies within a certain industry over 27 years.

    I'm writing about the wealth tax in Norway, and want to investigate how it affects companies as the owners often takes out dividends from the companies to pay the wealth tax.
    I want to use regress with different types of key figures to check if there is any evidence that wealth tax affects the companies financial status. For example:

    regress liquidity ratio as dependet variable, and profit, wealth tax and dividend as independent variables.

    I understand that i can't use log of profit, as this is negative for many of the companies. But if i regress it without log, the results will be 0.. I understand why, but is there any way to solve this problem?

    Hope this was understandable! Thank you

  • #2
    You can take logarithms of negative values but the result is a complex number and no use in any problem like yours. (That's not the usual answer, but the usual answer is "you can't take logarithms of negative values", yet the conclusion is the same.) Also, you can't take logarithms of zero and In principle your profit could be exactly zero.

    As profit is a predictor or covariate for you (in my view the term "independent variable" is long past its sell-by date) the question arises of why you want (you say "need") to take logarithms, which you don't explain.

    My guess is some mix of worry about outliers, skewness and nonlinearity. The so-called neglog function -- often discussed under other names, or under no name at all -- is

    Code:
    sign(x) * log(1 + abs(x))
    and so approaches

    Code:
    -log(-x)
    for large negative x

    and

    Code:
    log(x)
    for large positive x

    and is 0 when x is zero.

    One half-sibling of that function is asinh(x) which you can tune with some fudge factor say asinh(k * x) or asinh(x / k).

    Cube roots are another possibility, meaning in practice

    Code:
    sign(x) * abs(x)^(1/3)
    as

    Code:
    x^(1/3)
    will fail for negative values. (More at
    https://www.stata-journal.com/sjpdf....iclenum=st0223 .) A little thought shows that any odd integer root (says powers 1/5, 1.7, ,,,) is defined perfectly well for positive, zero and negative arguments alike, but even cube roots are likely to arouse anything from puzzlement to negativity in reviewers. (I had experience of this in review of a paper we published in Nature.)

    Comment


    • #3
      On using the inverse hyperbolic sine transformation, and post-estimation derivations, see: Bellamare and Wichman (2020), "Elasticities and the Inverse Hyperbolic Sine Transformation", Oxford Bulletin of Economics and Statistics, Volume82, Issue1, pp. 50-61. Free access.

      Comment


      • #4
        If you find the book 101 Stata tips, or search Stata Journal, you will find a nice entry by Nick Cox on square roots, cube roots, and logs.

        Nick's general comment is worth considering – do you really need to take the log of profits? While some people do this because the right-hand side variable is skewed, this is not actually a problem. What is a problem is if the errors are highly nonnormal which is a very different thing although it may be less of a problem in very large data sets which I assume yours is.

        There is also a question about ratio variables and the consistency of ratio variables with the measurement of the right-hand side variables. Since liquidity ratios are in some sense normalized for size, one might want to normalize profits or dividends for size.

        If you're using panel data, you should seriously consider a panel estimator like xtreg.

        Comment

        Working...
        X