1

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?

Ferdi
  • 5,179
koras
  • 51
  • 3
    What does the plot show? What is on the $y$-axis? What exactly is your model? – Tim Jun 20 '18 at 21:15
  • 2
    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). – Nick Cox Jun 20 '18 at 21:15
  • You should use piecewise linear function to do this. Piecewise linear regression in numpy – user1876887 Jun 20 '18 at 21:33
  • The plot is strongly reminiscent of data about energy usage vs. temperature I analyzed at https://stats.stackexchange.com/a/148166/919. Regardless, the same principles I advocated there will serve you well. – whuber Jun 21 '18 at 01:06

1 Answers1

0

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)

AlexR
  • 789