So I made a linear regression in R Studio to predict the price of a car based on the year of fabrication. The data set is called "audi" and my linear regression looks like this:

model_price_Year <- lm(data = audi, price ~ year)

The result of the summary is this:

              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -6.437e+06  8.503e+04  -75.71   <2e-16 
year         3.203e+03  4.215e+01   75.98   <2e-16 
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 9437 on 10666 degrees of freedom
Multiple R-squared:  0.3512,    Adjusted R-squared:  0.3511 
F-statistic:  5772 on 1 and 10666 DF,  p-value: < 2.2e-16

Then, I made a grid and i added predictions for 100 values of the year. It looks like this:

grid_year <- audi %>%
  data_grid(year = seq_range(year, 100)) %>%
  add_predictions(model_price_Year, "price")

And after that, if i want to see results, they look like this:

  year   price
   <dbl>   <dbl>
 1 1997  -41481.
 2 1997. -40737.
 3 1997. -39993.
 4 1998. -39249.
 5 1998. -38505.
 6 1998. -37761.
 7 1998. -37017.
 8 1999. -36273.
 9 1999. -35529.
10 1999. -34785.

They are all negative, and becuase we are talking about the price, it doesnt really make sense. Why are they negative? How do I interpret this?

  • 7
    $\begingroup$ Have you tried to plot your dataset and fitted line ? You will have only negative values for year < 2010 with your current model $\endgroup$
    – Lelouch
    May 9, 2022 at 13:37
  • 1
    $\begingroup$ The coefficient for year is about 3000. Is it plausible that price goes up by 3000 currency units per year? $\endgroup$
    – mdewey
    May 9, 2022 at 13:43
  • 7
    $\begingroup$ Plotting is not something one performs only in R! Grab pencil and paper or chalk and chalkboard if you must. $\endgroup$
    – whuber
    May 9, 2022 at 15:45
  • 1
    $\begingroup$ It would help to know what the range of years of your training set is. This very much looks like you are applying a model to a range significantly outside the training set. $\endgroup$ May 10, 2022 at 0:22
  • 1
    $\begingroup$ without your data, it's very difficult to make sense of your results. I'd have to guess that either your prediction interval is outside your data, or your data is improperly coded. $\endgroup$
    – Faydey
    May 10, 2022 at 4:04

3 Answers 3



You have a linear fit that does not predict well for cars older than ten years.

This is because most data points are for cars younger than 10 years old and these will dominate the fitting. If you would force the fit line to have no negative values from 1997 to 2020, then you would get a fit that has a larger error for the younger cars.

How do I interpret this?

The linear model is false, and does not fit well.

  • 1
    $\begingroup$ +1 Just a question about the data itself: are the prices corrected or uncorrected for inflation? $\endgroup$
    – Galen
    May 10, 2022 at 18:24
  • 1
    $\begingroup$ @AgnesianOperator I did not really pay much time in trying to understand the data. To me it looked like the prizes are for ocassions. So that means there is no need for inflation correction, because the prizes are all from the same time. But, it is the cars that have the different age. $\endgroup$ May 10, 2022 at 21:40
  • $\begingroup$ Ok so, does this mean that the prediction its not accurate for all the cars, or just for the cars older than 10 years? $\endgroup$ May 12, 2022 at 8:16
  • $\begingroup$ @BiancaTărău the straight line is a biased prediction which will be less and more biased depending on the age of the cars. But in some small region it might be a reasonable predictor since many curves can be locally approximated with a straight line (but just not everywhere). So the straight line will be more accurate for the younger cars which are more dominant in your sample and have a stronger influence on the position of the fitted line... $\endgroup$ May 12, 2022 at 8:46
  • $\begingroup$ ... if you fit with a more flexible model you should get a better fit for the entire region. Spline curves or regression trees can provide this flexibility. In your particular case you could assume that the price should be monotonically increasing (an assumption that breaks down if older cars, old-timers, are more pricey because of their uniqueness, but for younger regular cars it won't be a bad assumption). With that assumption you might wanna use monotonic regression. $\endgroup$ May 12, 2022 at 8:52

You didn't constrain the output. Without such a constraint, you allow for any real number to be predicted, including numbers that are ridiculous. For instance, logistic regressions constrain the probability predictions to $[0,1]$ by applying a link function that compresses the real line to the unit interval.

An alternative might be to fit a log-linked gamma generalized linear model or a log-linked Gaussian generalized linear model.

A negative price might make sense, but the interpretation would be that, instead of selling the car, you pay someone to take it off your hands. I could imagine this for someone who has a useless item that is expensive to store, so you hire someone to take it away.

It also might be that the year is not a linear predictor of price. I would guess that prices don't just increase by a fixed amount every year. If the price of a car goes up $X\%$ each year (nonlinear), that's different than the price going up $\$Y$ every year (linear).

  • $\begingroup$ Thank you! I found your answer the most clear. But i have one more questions. Is it correct to take 100 values? If i have only 21 different years. Isn't it alright if I write only data_grid(year)? Without the seq_range function? $\endgroup$ May 9, 2022 at 16:58
  • $\begingroup$ @BiancaTărău I do you follow your question. Could you please clarify? $\endgroup$
    – Dave
    May 9, 2022 at 17:01
  • $\begingroup$ I will try. From my understanding, the seq_range function takes a number o values between the range of a column. In my case, seq_range(year, 100) takes 100 values in the range of 1997-2020. Right? And I am asking if this is logic, taking in consideration the fact that between 1997-2020 are only a finite number of years? Like it can't take the value 2012,34. $\endgroup$ May 9, 2022 at 17:18
  • $\begingroup$ In the plot? I recommend posting a new question about that topic. Unlike many parts of the Internet, Cross Validated is strictly Q&A, not a discussion forum, and others will benefit most from your question if it is asked and answered separately. $\endgroup$
    – Dave
    May 9, 2022 at 17:20

[UPDATED] A typical times series interpretation doesn't apply in this case. It's more like a panel data, just to point out. There are more than one value per year. I suspect there are many models of cars with same year of fabrication, among other types of heterogeneity. I'll assume you want to say in the OLS model.

So, the negative values can be caused, for example by the use of logarithm in prices (A very common technique), however if prices are adjusted by inflation, a price of 0.8 could turn to a negative value ($log(0.8) = -0.22$) Another cause is a very short time-space of fabrication year (i.e. 1997 to 2022).

If your model is $Price = a + YearFab$, we should remember that the intercept ($a$) is the Price when the Year of Fabrication is 0. Obviously that's not possible. Using your results, the year when prices start being negative is 2009 to the past ($year_{p=0} = -a/b$) However, that last interpretation is useless and misleading.

This is the graph before recoding: enter image description here

Thus, you may need to recode the year from 1 (first year of fabrication) to T (last year), and then run the regression again, to obtain new coefficients. For example if 1997 is the first year, then it code will be 1, and so on. Please present your results. If the problem persists, perhaps the relation is not trend related to year or you may have huge outliers, among other things.

Basically, the problem is the data set of the model, the results suggest that the independent variable starts at 0 and goes to the end (2022) given a total of 2022 possible units, which is false. Your data starts at 1997 (or similar year) and end in 2022 with a total of 25 units (around).

After the recoding, the intercept will be interpreted as the price when the year series starts, "year 0", that is 1997 (presumably). And any increase will be related to that year.

The marginal interpretation doesn't change, that is, if the car is newer then the price will increase in b units. ( $dy/dx = b$). Forecasts are easy too, if you keep the code for external validation data.

  • 5
    $\begingroup$ I lost you at the second paragraph: if one models log prices, it's impossible to predict a negative price. Your discussion of recoding is also opaque: changing the time origin will make no difference at all in the fitted prices. $\endgroup$
    – whuber
    May 9, 2022 at 15:46
  • $\begingroup$ Thank you @whuber! I've made some changes to be less opaque. Thanks for the feed back! I hope to improve soon! $\endgroup$ May 9, 2022 at 18:17
  • $\begingroup$ So I have tried changing my years. For 1997 I gave the value 1, for value 1998 the value 2 and so on. The results where the same. So, does it mean that the model based on the year of fabrication can't be a valid model? $\endgroup$ May 10, 2022 at 11:26
  • $\begingroup$ Hi @BiancaTărău. If your intercept is still negative, then you may have real issues with your data (outlers, missing values, high heterogeneity). Please update your table to input your observed price and the estimated price. Also a summary of basic statistics of those 3. So we can help. If you need further assistance you can always DM me. $\endgroup$ May 10, 2022 at 22:11
  • 1
    $\begingroup$ kaggle.com/datasets/rohitagrawal362/audi-car-price-prediction this is the data set I used for my prediction. Maybe this helps $\endgroup$ May 12, 2022 at 8:22

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.