1
$\begingroup$

I am working on an analysis of a simple linear regression and I don't know what to do. This is my graph: enter image description here

the p-value is <0.0001 but the data is clearly not linear and $R^2$ value is really small. What do you do in this situation? Transform it? Leave it as it is?

$\endgroup$
4
  • 3
    $\begingroup$ What does the plot show? What is on the $y$-axis? What exactly is your model? $\endgroup$
    – Tim
    Commented Jun 20, 2018 at 21:15
  • 2
    $\begingroup$ Nothing to transform. Use splines or local polynomial or fractional polynomial to match the turning point. This looks like two effects, but they are not symmetric: temperature rising means more work in air conditioning; temperature falling means more work in heating. Good scientific manners to state units of measurement (temperature in Fahrenheit; no idea about vertical axis). $\endgroup$
    – Nick Cox
    Commented Jun 20, 2018 at 21:15
  • $\begingroup$ You should use piecewise linear function to do this. Piecewise linear regression in numpy $\endgroup$ Commented Jun 20, 2018 at 21:33
  • $\begingroup$ The plot is strongly reminiscent of data about energy usage vs. temperature I analyzed at stats.stackexchange.com/a/148166/919. Regardless, the same principles I advocated there will serve you well. $\endgroup$
    – whuber
    Commented Jun 21, 2018 at 1:06

1 Answer 1

0
$\begingroup$

The p-value only tells you that the linear model is significantly better than a constant model.

The plot looks like a second-degree polynomial could fit well, i.e.

$$y=\beta_1 x^2 + \beta_2 x+\beta_3$$

This is linear - all you need to do is add a polynomial term to your predictors (i.e. create a new predictor $\mathrm{Temperature}^2$)

In R you can automagically do this with the formula interface: y ~ poly(x, 2)

$\endgroup$

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.