GLM Example: Gaussian Distribution Analysis - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

For the Gaussian distribution the response variable must be a continuous numerical variable, where the data is grouped around a single mean and the graph looks like a normal or bell curve distribution. This example uses default options.

SQL Call

The family is GAUSSIAN and the default family link is IDENTITY.

DROP TABLE glm_housing_model;

SELECT * FROM GLM (
  ON housing_train AS InputTable
  OUT TABLE OutputTable (glm_housing_model)
  USING
  TargetColumns ('price', 'lotsize', 'bedrooms', 'bathrms',
                'stories', 'garagepl', 'driveway', 'recroom',
                'fullbase', 'gashw', 'airco', 'prefarea', 'homestyle')
  CategoricalColumns ('driveway', 'recroom', 'fullbase', 'gashw',
                       'airco', 'prefarea', 'homestyle')
  Family ('GAUSSIAN')
  LinkFunction ('IDENTITY')
  WeightColumn ('1')
  StopThreshold (0.01)
  MaxIterNum (25)
  Intercept ('true')
) AS dt;

Output

 predictor               estimate           std_error           t_score             p_value                significance                            
 ----------------------- ------------------ ------------------- ------------------- ---------------------- --------------------------------------- 
 (Intercept)                 36349.30078125   2733.462158203125  13.297897338867188                    0.0 ***                                    
 lotsize                 2.0809500217437744 0.26133036613464355   7.962909698486328 1.2434497875801753E-14 ***                                    
 bedrooms                  782.093017578125   766.8397216796875  1.0198911428451538     0.3082960247993469                                        
 bathrms                   6772.31005859375  1106.7789306640625   6.118936538696289   1.963181173181283E-9 ***                                    
 stories                    2445.6201171875   694.1449584960938   3.523212194442749   4.673068760894239E-4 ***                                    
 garagepl                1483.0999755859375   623.5965576171875   2.378300666809082    0.01778467558324337 *                                      
 driveway.no               -2822.6298828125  1481.2474365234375  -1.905576229095459    0.05730487406253815 .                                      
 recroom.yes              1208.530029296875   1358.570556640625  0.8895599842071533     0.3741496801376343                                        
 fullbase.yes             3588.300048828125  1167.3746337890625  3.0738205909729004  0.0022341914009302855 **                                     
 gashw.yes                          5787.25   2405.470458984375  2.4058704376220703    0.01651271991431713 *                                      
 airco.yes                  6478.7900390625  1152.1597900390625   5.623169422149658  3.1934060729099656E-8 ***                                    
 prefarea.yes              6465.64013671875  1212.8397216796875   5.330992698669434  1.5088656368789088E-7 ***                                    
 homestyle.classic         -16550.900390625   1308.585205078125 -12.647933959960938                    0.0 ***                                    
 homestyle.bungalow          37577.69921875      1850.173828125  20.310361862182617                    0.0 ***                                    
 ITERATIONS #                           2.0                 0.0                 0.0                    0.0 Number of Fisher Scoring iterations    
 ROWS #                               492.0                 0.0                 0.0                    0.0 Number of rows                         
 Residual deviance                 Infinity                 0.0                 0.0                    0.0 on 478 degrees of freedom              
 Pearson goodness of fit    5.3066899456E10                 0.0                 0.0                    0.0 on 478 degrees of freedom              
 AIC                               Infinity                 0.0                 0.0                    0.0 Akaike information criterion           
 BIC                               Infinity                 0.0                 0.0                    0.0 Bayesian information criterion         
 Wald Test                  23174.041015625                 0.0                 0.0                    0.0 ***                                    
 Dispersion parameter          1.11018616E8                 0.0                 0.0                    0.0 Taken to be 1 for BINOMIAL and POISSON.

Many predictors are significant at 95% confidence level (p-value < 0.05).

SELECT * FROM glm_housing_model ORDER BY attribute;
 attribute predictor   category estimate           std_err             z_score             p_value                significance family   
 --------- ----------- -------- ------------------ ------------------- ------------------- ---------------------- ------------ -------- 
        -1 Loglik      NULL              -Infinity               492.0                13.0                    0.0 NULL         GAUSSIAN
         0 (Intercept) NULL         36349.30078125   2733.462158203125  13.297897338867188                    0.0 ***          GAUSSIAN
         1 lotsize     NULL     2.0809500217437744 0.26133036613464355   7.962909698486328 1.2434497875801753E-14 ***          GAUSSIAN
         2 bedrooms    NULL       782.093017578125   766.8397216796875  1.0198911428451538     0.3082960247993469              GAUSSIAN
         3 bathrms     NULL       6772.31005859375  1106.7789306640625   6.118936538696289   1.963181173181283E-9 ***          GAUSSIAN
         4 stories     NULL        2445.6201171875   694.1449584960938   3.523212194442749   4.673068760894239E-4 ***          GAUSSIAN
         5 garagepl    NULL     1483.0999755859375   623.5965576171875   2.378300666809082    0.01778467558324337 *            GAUSSIAN
         6 driveway    yes                    NULL                NULL                NULL                   NULL NULL         GAUSSIAN
         7 driveway    no         -2822.6298828125  1481.2474365234375  -1.905576229095459    0.05730487406253815 .            GAUSSIAN
         8 recroom     no                     NULL                NULL                NULL                   NULL NULL         GAUSSIAN
         9 recroom     yes       1208.530029296875   1358.570556640625  0.8895599842071533     0.3741496801376343              GAUSSIAN
        10 fullbase    no                     NULL                NULL                NULL                   NULL NULL         GAUSSIAN
        11 fullbase    yes       3588.300048828125  1167.3746337890625  3.0738205909729004  0.0022341914009302855 **           GAUSSIAN
        12 gashw       no                     NULL                NULL                NULL                   NULL NULL         GAUSSIAN
        13 gashw       yes                 5787.25   2405.470458984375  2.4058704376220703    0.01651271991431713 *            GAUSSIAN
        14 airco       no                     NULL                NULL                NULL                   NULL NULL         GAUSSIAN
        15 airco       yes         6478.7900390625  1152.1597900390625   5.623169422149658  3.1934060729099656E-8 ***          GAUSSIAN
        16 prefarea    no                     NULL                NULL                NULL                   NULL NULL         GAUSSIAN
        17 prefarea    yes        6465.64013671875  1212.8397216796875   5.330992698669434  1.5088656368789088E-7 ***          GAUSSIAN
        18 homestyle   eclectic               NULL                NULL                NULL                   NULL NULL         GAUSSIAN
        19 homestyle   classic    -16550.900390625   1308.585205078125 -12.647933959960938                    0.0 ***          GAUSSIAN
        20 homestyle   bungalow     37577.69921875      1850.173828125  20.310361862182617                    0.0 ***          GAUSSIAN

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.