REGR_R2 Function Example | VantageCloud Lake - Example: Returning the Coefficient of Determination for Height and Weight - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

This example is based the following regrtbl data. Nulls are indicated by the QUESTION MARK character.

c1   height   weight
--   ------   ------
 1       60       84
 2       62       95
 3       64      140
 4       66      155
 5       68      119
 6       70      175
 7       72      145
 8       74      197
 9       76      150
10       76      ?
11       ?       150
12       ?       ?

The following SELECT statement returns the coefficient of determination for height and weight where neither height nor weight is null.

SELECT CAST(REGR_R2(weight,height) AS DECIMAL(4,2)) 
FROM regrtbl;
REGR_R2(weight,height)
----------------------
                   .58