When y is negative in linear regression?

In summary, the speaker is using linear regression with 8 independent variables to predict a value, y, which is the time in seconds. However, some of the calculated Betas are negative, leading to a negative predicted y. The speaker is unsure if this is correct, and is considering alternative regression models. They also mention the possibility of using a stepwise regression algorithm and incorporating only statistically significant variables. Additionally, they suggest trying a model that will never result in a negative prediction.
  • #1
xeon123
90
0
I am using linear regression to predict 'y' based on 8 variables.
With my example, most the Betas that I got are negative. So, y, the value to predict, is negative.
To my data, y is a time in seconds, so I think it shouldn't be negative.

I my example in python, and I want to know if y should be negative, even when y is seconds, or my code is not correct.

Is is possible that y can be negative?
 
Physics news on Phys.org
  • #2
It's not clear what you mean by a linear regression with 8 variables. Does this mean you are using 8 data points?
 
  • #3
I mean that I use 8 independent variables to get y.

y = Beta1*x1 + Beta2*x2 + Beta3*x3 + Beta4*x4 + Beta5*x5 + Beta6*x6 + Beta7*x7 + Beta8*x8

And when I calculate the Betas to get a predicted y, \hat{y}, some of them are negative, making \hat{y} negative.
 
Last edited:
  • #4
Have you checked the statistical significance of those betas? If some of them are just noise then you would expect to get nonsense results.

Even then statistical modeling with a linear fit is never going to be a perfect, it is entirely possible that if x1 is larger that the timing of y will be shorter, causing a negative Beta1 to appear. At that point you might question whether a linear model is a good one to use for the x1 variable.
 
  • #5
A lot of statistics packages have stepwise regression algorithms. They start with a constant and the most significant independent variable (say Xm): Y = Beta0 + Betam * Xm. Then, one by one, add in the next most significant term, then the next, etc., till there are no statistically significant terms to add. That will allow you to include only those terms that are statistically significant.

If you know that Y can never be negative, you might want to try a model that will never go negative, like Y = exp( Beta0 + Beta1 * X1). For that, do a stepwise linear regression using the natural log of the Y data. That will give an expression ln(Y) = Beta0 + Beta1 * X1. Many statistics packages have these types of regressions as options.
 

1. What is the significance of y being negative in linear regression?

When y is negative in linear regression, it means that there is a negative relationship between the independent and dependent variable. This indicates that as the independent variable increases, the dependent variable decreases.

2. Can y be negative in linear regression?

Yes, y can be negative in linear regression. This is known as a negative slope and is a common occurrence in data analysis.

3. How does a negative y value affect the interpretation of the regression line?

A negative y value indicates that the slope of the regression line is negative, meaning that the line is decreasing from left to right. This affects the interpretation of the line by showing that as the independent variable increases, the dependent variable decreases.

4. Is a negative y value always a cause for concern in linear regression?

No, a negative y value is not always a cause for concern in linear regression. It is important to consider the context of the data and the relationship between the variables before determining if a negative y value is problematic.

5. How can a negative y value be interpreted in terms of the data?

A negative y value in linear regression can be interpreted as an inverse relationship between the independent and dependent variables. This means that as one variable increases, the other variable decreases in a predictable manner.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
13
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
832
  • Engineering and Comp Sci Homework Help
Replies
7
Views
723
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
30
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
491
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
Back
Top