2
$\begingroup$

If I'm trying to establish a linear relationship between effort (watts produced or speed, for example) and time-taken. How can I account for the fact that if effort is zero (speed equal zero or watts produced equal zero) then the time taken would be infinite?

Essentially I don't want an intercept term in my equation but I also don't want y = 0 when x = 0.

Entering an extremely large value (10^32) for x = 0 makes the relationship non-linear...

As an aside, this question is mostly out of curiosity, since the equation I get is entirely functional given that effort only varies over a small range. Presumably the relationship is only linear over the range of narrow observations that I have?

$\endgroup$
2
  • $\begingroup$ What are the limits as you approach 0 from the right and from the left? $\endgroup$
    – Dave
    Commented Mar 17, 2020 at 4:43
  • $\begingroup$ I'm not sure I can calculate that with my limited observations, but (if I understand your question, which I suspect I don't) then one can't approach 0 from the left in this case (there's no negative wattage) and I don't have and don't expect observations below 200 for x. $\endgroup$
    – lithic
    Commented Mar 17, 2020 at 4:52

1 Answer 1

4
$\begingroup$

Your stipulated requirements are incompatible, since there is no linear function that goes through the point $(0, \infty)$ and the point $(1, a)$ for any real $a \in \mathbb{R}$. The obvious thing to do here is to stipulate a nonlinear relationship between effort and time. The best way to do this is to first stipulate a model for the relationship between effort and speed ---e.g., you might stipulate that:

$$\log \text{Speed} = \alpha_0 + \alpha_1 \cdot \log \text{Effort} + \text{Error},$$

where you expect the parameter $\alpha_1$ to be positive. Since $\text{Time}$ is inversely proportionate to $\text{Speed}$, you then have $ \log \text{Time} = \log \text{Speed} + \text{const}$, which igives you the corresponding model:

$$\log \text{Time} = \beta_0 + \beta_1 \cdot \log \text{Effort} + \text{Error},$$

where you now expect the parameter $\beta_1 = - \alpha_1$ to be negative. This is just one example of a nonlinear model that might fit reasonably in this case. I would suggest you start with something like this and have a look at the diagnostic plots to see if it looks okay. If these plots exhibit problems then you could refine the model to get one that has appropriate asymptotic properties for your situation, and reasonable diagnostic plots from the data.


Update: Based on the data you have given in the comments (which is only four data points), this model fits almost perfectly ($R^2=0.9932$).

Call:
lm(formula = log(Time) ~ log(Effort), data = DATA)

...

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 13.49482    0.35820   37.67 0.000704 ***
log(Effort) -1.13527    0.06618  -17.15 0.003381 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.008463 on 2 degrees of freedom
Multiple R-squared:  0.9932,    Adjusted R-squared:  0.9899 
F-statistic: 294.2 on 1 and 2 DF,  p-value: 0.003381

enter image description here

The R code for the plot and regression output is here:

#Set libraries and theme
library(ggplot2);
library(gridExtra);
THEME <- theme(plot.title    = element_text(hjust = 0.5, size = 14, face = 'bold'),
               plot.subtitle = element_text(hjust = 0.5, face = 'bold'));

#Specify data and fit model
DATA  <- data.frame(Effort = c(241,232,222,203), Time = c(1425, 1500, 1588, 1734));
MODEL <- lm(log(Time) ~ log(Effort), data = DATA);

#Generate plot of data
ggplot(aes(x = Effort, y = Time), data = DATA) +
  geom_point(colour = 'blue', size = 4) +
  geom_smooth(method='lm', formula= y ~ x) +
  scale_x_log10(breaks = scales::trans_breaks("log10", function(x) 10^x),
                labels = scales::trans_format("log10", scales::math_format(10^.x))) +
  scale_y_log10(breaks = scales::trans_breaks("log10", function(x) 10^x),
                labels = scales::trans_format("log10", scales::math_format(10^.x))) +
  THEME +
  ggtitle('Scatterplot of Effort vs Time') +
  labs(subtitle = '(Log-linear regression)');

#Give summary of model
summary(MODEL);
$\endgroup$
3
  • $\begingroup$ Thank you for the answer Ben. May I ask - given that for the range of expected values a linear relationship is 'perfect' (the points lie on the line...) then would changing for a non-linear function be conceptually better (no intercept) but practically worse? As in, the model would make more sense but be less useful? $\endgroup$
    – lithic
    Commented Mar 17, 2020 at 6:21
  • $\begingroup$ I really can't answer that without seeing the data. $\endgroup$
    – Ben
    Commented Mar 17, 2020 at 7:27
  • $\begingroup$ 241, 1425 232, 1500 222, 1588 203, 1734 $\endgroup$
    – lithic
    Commented Mar 17, 2020 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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