5
$\begingroup$

I have been suggested to use the log of a log-transformed independent variable (i.e., log(log healthcare expenditure)). I am not sure how would this make sense. Is this a standard practice (in the social sciences/epidemiology)? I haven’t been able to find any examples of this in the papers that I have read.

$\endgroup$
10
  • 5
    $\begingroup$ Did you consider asking the person who suggested it for the rationale? What did they say? $\endgroup$
    – Tim
    Aug 28 at 12:35
  • 2
    $\begingroup$ What would lead you to consider such a transformation? Why do you need to transform the expenditure or the log-expenditure? $\endgroup$
    – Glen_b
    Aug 28 at 12:42
  • 6
    $\begingroup$ @Xi'an Good point. But what comes to mind is the complementary log-log transformation, $x\to\log(-\log(x))$ for strictly positive numbers $x.$ Plausibly, healthcare expenditures will all be positive. ;-) $\endgroup$
    – whuber
    Aug 28 at 15:14
  • 3
    $\begingroup$ @dipetkov Sorry; yes, it's true that the argument $x$ cannot equal or exceed $1.$ One must first express the values $x$ relative to some upper bound, which might make little sense for healthcare expenditures. Another possibility is to re-express $x$ using a "sigmoid" like the logistic function (or any suitable CDF, for that matter) and then take the cloglog. $\endgroup$
    – whuber
    Aug 28 at 15:30
  • 1
    $\begingroup$ I recall trying to do this during my first internship (at a healthcare firm) before I learned about robust regressions (i.e. Cauchy regression), which can handle large price outliers. Does this fit your use case? $\endgroup$ Aug 28 at 21:13

1 Answer 1

9
$\begingroup$

One thing that comes to mind for exploratory data analysis (EDA), applicable for 1D distributions, is to plot the quantiles (related to the empirical cumulative distribution function) in various transformed axes: linear-vs-linear, log-vs-linear, linear-vs-log, log-vs-log, etc.

Having done so, some hypotheses may be formed and/or tested.

A specific example where “log of log” may appear is when the 1D data is distributed according to a Weibull distribution:

The cumulative distribution function (CDF) of a Weibull distributed variable $x$ is: $ F(x) = 1 - \exp(-(x/\lambda)^k).$ Therefore $$-\log(1 - F(x)) = (x/\lambda)^k$$ $$\log(-\log(1 - F(x))) = k \log(x) - k \log(\lambda).$$

Note: $\log$ is the natural logarithm, sometimes denoted $\operatorname{ln}(x)$.

Now, we obtain a straight line in the transformed axes: the left-hand side is the “dependent variable” in a kind of strange double-logarithmic transformation, $k$ is the slope of a log transformation of $x$, and the intercept is $-k\log(\lambda)$.

In the example above, you approximate $F(x)$ empirically using the rank $r$ of each $x$ data value (requires sorting your data), and use a common method guaranteeing $0 < \hat{F} < 1$ required for the formula above such as $$\hat{F}(r) = \frac{r - 0.3}{n + 0.4},$$ where $r$ is the rank of the data value and $n$ is the total number of data points.

Since the OP has a tag "least squares", please be very careful with applying it due to its fragility; better use a robust fitting procedure, such as Theil-Sen. Specifically in the example above, although the result should be a straight line after transformation, any small deviation of the actual data from a straight line may be magnified by the nonlinear transformation, ruining any least squares fit, but probably not a robust method.

$\endgroup$
2
  • 4
    $\begingroup$ Welcome to CV! This site supports MathJax markup using the standard \$ delimiter. You can link to MathJax help when editing your post. I have marked up your equations to illustrate the process. $\endgroup$
    – whuber
    Aug 28 at 15:27
  • 5
    $\begingroup$ To what @whuber said, you can check this for a quick reference. $\endgroup$ Aug 28 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.