0
$\begingroup$

Here is some data and a logarithmic model:

df <- data.frame(
  x = 1:8,
  y = c(7.5,6,5.2,4.3,3.9,3.4,3.1,2.9)
)

model <- lm(y ~ log(x), data = df)

I am able to use this model to predict y for any given x e.g.

predict(model, newdata = data.frame(x = 10)) # 2.3

My question is, if I want to find y when x is known, can I do that? 'Reverse prediction' or what's the correct term?

e.g. If I want to know the value of x when the function output is 8, how would I do that?

$\endgroup$
2
  • $\begingroup$ I'm assuming that whoever closed this pasted the wrong duplicate link, because I don't see how that linked post answers the question. $\endgroup$
    – Doug Fir
    Apr 9 '21 at 17:23
  • 1
    $\begingroup$ This is called calibration or inverse-prediction $\endgroup$ Apr 9 '21 at 21:19
1
$\begingroup$

In your specific case

Coefficients:
(Intercept)       log(x)  
      7.544       -2.268 

In original

$$y=7.544-2.268 \cdot \log(x)$$

therefore

$$(7.544 - y)/2.268 = \log(x)$$

or

$$\exp((7.544 - y)/2.268) = x$$

$\endgroup$
1
$\begingroup$

I don't have enough reputation to comment, but I've heard it referred to as calibration or inverse regression. Hope that gives you something to start.

$\endgroup$
1
  • $\begingroup$ Thanks for the info @PRZ! $\endgroup$
    – Doug Fir
    Apr 9 '21 at 11:41

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