REGR_INTERCEPT Function Example | VantageCloud Lake - Example: Returning the Intercept of the Regression Line for NbrSold and SalesPrice - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

This example uses the data from the HomeSales table.

SalesPrice NbrSold Area
160000 126 358711030
180000 103 358711030
200000 82 358711030
220000 75 358711030
240000 82 358711030
260000 40 358711030
280000 20 358711030

The following query returns the intercept of the regression line for NbrSold and SalesPrice in the range of 160000 to 280000 in the 358711030 area.

   SELECT CAST (REGR_INTERCEPT(NbrSold,SalesPrice) AS DECIMAL (5,1))
   FROM HomeSales
   WHERE area = 358711030 
   AND SalesPrice BETWEEN 160000 AND 280000;

Here is the result:

REGR_INTERCEPT(NbrSold,SalesPrice)
----------------------------------
                             249.9