# 1.0 - 8.00 - Linear Regression Example - Teradata Vantage

## Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

This example uses the LinRegInternal and LinReg functions to find the coefficients of the variables that determine the selling price of a home in a given neighborhood. The response variable, SellingPrice (the selling price of the house in dollars) is modeled on these independent (predictor) variables:

• House size (in square feet)
• Lot size (in square feet)
• Number of bedrooms
• Whether the kitchen counter is granite (0 or 1)
• Whether the bathrooms are upgraded (0 or 1)

## Input

housing_data
housesize lotsize bedrooms granite upgradedbathroom sellingprice
2397 14156 4 1 0 189900
2200 9600 4 0 1 195000
4032 10150 5 0 1 197900
3529 9191 6 0 0 205000
3247 10061 5 1 1 224900
2983 9365 5 0 1 230000
3536 19994 6 1 1 325000
3198 9669 5 1 1
The LinRegInternal function skips the last row of housing_data because it contains a NULL value.

## SQL Call

```SELECT * FROM LinReg (
ON LinRegInternal (
ON housing_data AS "input"
) AS "input" PARTITION BY 1
) AS dt;```

## Output

coefficient_name value_col
Intercept -21739.2966650368
housesize -26.9307835091457
lotsize 6.33452410459345
granite 7140.67629349537