2.1.0
User Documentation for Apache MADlib
robust.sql_in File Reference

SQL functions for robust variance linear and logistic regression. More...

Functions

bytea8 robust_linregr_transition (bytea8 state, float8 y, float8[] x, float8[] coef)
 
bytea8 robust_linregr_merge_states (bytea8 state1, bytea8 state2)
 
robust_linregr_result robust_linregr_final (bytea8 state)
 
aggregate bytea8 robust_linregr (float8 dependentVariable, float8[] independentVariables, float8[] coef)
 
varchar robust_variance_linregr (varchar message)
 
varchar robust_variance_linregr ()
 
void robust_variance_linregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, varchar grouping_cols, boolean verbose_mode)
 
void robust_variance_linregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, varchar grouping_cols)
 
void robust_variance_linregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname)
 
float8 [] robust_logregr_step_transition (float8[] state, boolean y, float8[] x, float8[] coef)
 
float8 [] robust_logregr_step_merge_states (float8[] state1, float8[] state2)
 
robust_logregr_result robust_logregr_step_final (float8[] state)
 
aggregate robust_logregr_result robust_logregr (boolean dependentVariable, float8[] independentVariables, float8[] coef)
 
varchar robust_variance_logregr (varchar message)
 
varchar robust_variance_logregr ()
 
void robust_variance_logregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, varchar grouping_cols, integer max_iter, varchar optimizer, float8 tolerance, boolean verbose_mode)
 The robust logistic regression function. More...
 
void robust_variance_logregr (varchar source_table, varchar out_table, varchar dependent_variable, varchar independent_variable, varchar grouping_cols, integer max_iter, varchar optimizer, float8 tolerance)
 
void robust_variance_logregr (varchar source_table, varchar out_table, varchar dependent_variable, varchar independent_variable, varchar grouping_cols, integer max_iter, varchar optimizer)
 
void robust_variance_logregr (varchar source_table, varchar out_table, varchar dependent_variable, varchar independent_variable, varchar grouping_cols, integer max_iter)
 
void robust_variance_logregr (varchar source_table, varchar out_table, varchar dependent_variable, varchar independent_variable, varchar grouping_cols)
 
void robust_variance_logregr (varchar source_table, varchar out_table, varchar dependent_variable, varchar independent_variable)
 
float8 [] mlogregr_robust_step_transition (float8[] state, integer y, integer numcategories, integer ref_category, float8[] x, float8[] coef)
 
float8 [] mlogregr_robust_step_merge_states (float8[] state1, float8[] state2)
 
robust_mlogregr_result mlogregr_robust_step_final (float8[] state)
 
aggregate robust_mlogregr_result robust_mlogregr (integer dependentVariable, integer numCategories, integer ref_category, float8[] independentVariables, float8[] coef)
 
varchar robust_variance_mlogregr (varchar message)
 
varchar robust_variance_mlogregr ()
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols, varchar optimizer_params, boolean verbose_mode)
 Compute robust regression diagnostic statistics for multinomial logistic regression. More...
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols, varchar optimizer_params)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols, integer max_iter, varchar optimizer, float8 tolerance, boolean verbose_mode)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols, integer max_iter, varchar optimizer, float8 tolerance)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols, integer max_iter, varchar optimizer)
 
void robust_variance_mlogregr (varchar source_table, varchar out_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar grouping_cols, integer max_iter)
 

Detailed Description

Date
2012
See also
For a brief introduction to robust variance, see Robust Variance

Function Documentation

◆ mlogregr_robust_step_final()

robust_mlogregr_result mlogregr_robust_step_final ( float8 []  state)

◆ mlogregr_robust_step_merge_states()

float8 [] mlogregr_robust_step_merge_states ( float8 []  state1,
float8 []  state2 
)

◆ mlogregr_robust_step_transition()

float8 [] mlogregr_robust_step_transition ( float8 []  state,
integer  y,
integer  numcategories,
integer  ref_category,
float8 []  x,
float8 []  coef 
)

◆ robust_linregr()

aggregate bytea8 robust_linregr ( float8  dependentVariable,
float8 []  independentVariables,
float8 []  coef 
)

◆ robust_linregr_final()

robust_linregr_result robust_linregr_final ( bytea8  state)

◆ robust_linregr_merge_states()

bytea8 robust_linregr_merge_states ( bytea8  state1,
bytea8  state2 
)

◆ robust_linregr_transition()

bytea8 robust_linregr_transition ( bytea8  state,
float8  y,
float8 []  x,
float8 []  coef 
)

◆ robust_logregr()

aggregate robust_logregr_result robust_logregr ( boolean  dependentVariable,
float8 []  independentVariables,
float8 []  coef 
)

◆ robust_logregr_step_final()

robust_logregr_result robust_logregr_step_final ( float8 []  state)

◆ robust_logregr_step_merge_states()

float8 [] robust_logregr_step_merge_states ( float8 []  state1,
float8 []  state2 
)

◆ robust_logregr_step_transition()

float8 [] robust_logregr_step_transition ( float8 []  state,
boolean  y,
float8 []  x,
float8 []  coef 
)

◆ robust_mlogregr()

aggregate robust_mlogregr_result robust_mlogregr ( integer  dependentVariable,
integer  numCategories,
integer  ref_category,
float8 []  independentVariables,
float8 []  coef 
)

◆ robust_variance_linregr() [1/5]

varchar robust_variance_linregr ( varchar  message)

◆ robust_variance_linregr() [2/5]

varchar robust_variance_linregr ( )

◆ robust_variance_linregr() [3/5]

void robust_variance_linregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
varchar  grouping_cols,
boolean  verbose_mode 
)

◆ robust_variance_linregr() [4/5]

void robust_variance_linregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
varchar  grouping_cols 
)

◆ robust_variance_linregr() [5/5]

void robust_variance_linregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname 
)

◆ robust_variance_logregr() [1/8]

varchar robust_variance_logregr ( varchar  message)

◆ robust_variance_logregr() [2/8]

varchar robust_variance_logregr ( )

◆ robust_variance_logregr() [3/8]

void robust_variance_logregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
varchar  grouping_cols,
integer  max_iter,
varchar  optimizer,
float8  tolerance,
boolean  verbose_mode 
)
Parameters
source_tableString identifying the input table
out_tableString identifying the output table to be created
dependent_varnameColumn containing the dependent variable
independent_varnameColumn containing the array of independent variables
grouping_colsColumns to group by.
max_iterInteger identifying the maximum iterations used by the logistic regression solver. Default is 20.
optimizerString identifying the optimizer used in the logistic regression. See the documentation in the logistic regression for the available options. Default is irls.
toleranceFloat identifying the tolerance of the logistic regression optimizer. Default is 1e-4.
verbose_modeBoolean specifying if the regression fit should print any warning messages. Default is false.
To include an intercept in the model, set one coordinate in the independent_varname array to 1.
Returns
A composite value:
  • std_err FLOAT8[] - Array of huber-white standard errors, \( \mathit{se}(c_1), \dots, \mathit{se}(c_k) \)
  • t_stats FLOAT8[] - Array of t-statistics, \( \boldsymbol t \)
  • p_values FLOAT8[] - Array of p-values, \( \boldsymbol p \)
Usage
For function summary information. Run sql> select robust_variance_logregr('help'); OR sql> select robust_variance_logregr(); OR sql> select robust_variance_logregr('?'); For function usage information. Run sql> select robust_variance_logregr('usage');
  • Compute the coefficients, and the get the robust diagnostic statistics:
       select robust_variance_logregr(source_table, out_table, regression_type, dependentVariable, independentVariables, NULL );
      
  • If the coefficients are already known, they can be provided directly
    select robust_variance_logregr(source_table, out_table, regression_type, dependentVariable, independentVariables, coef );
    

◆ robust_variance_logregr() [4/8]

void robust_variance_logregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_variable,
varchar  independent_variable,
varchar  grouping_cols,
integer  max_iter,
varchar  optimizer,
float8  tolerance 
)

◆ robust_variance_logregr() [5/8]

void robust_variance_logregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_variable,
varchar  independent_variable,
varchar  grouping_cols,
integer  max_iter,
varchar  optimizer 
)

◆ robust_variance_logregr() [6/8]

void robust_variance_logregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_variable,
varchar  independent_variable,
varchar  grouping_cols,
integer  max_iter 
)

◆ robust_variance_logregr() [7/8]

void robust_variance_logregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_variable,
varchar  independent_variable,
varchar  grouping_cols 
)

◆ robust_variance_logregr() [8/8]

void robust_variance_logregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_variable,
varchar  independent_variable 
)

◆ robust_variance_mlogregr() [1/11]

varchar robust_variance_mlogregr ( varchar  message)

◆ robust_variance_mlogregr() [2/11]

varchar robust_variance_mlogregr ( )

◆ robust_variance_mlogregr() [3/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols,
varchar  optimizer_params,
boolean  verbose_mode 
)

– NOTICE ---------------------------------------------------------—— – All functions calling other modeling functions should be in the format: – accept a model table created by the underlying modeling function – and extract all parameters from the model table and summary table CREATE OR REPLACE FUNCTION madlib.robust_variance_mlogregr( model_table VARCHAR – name of the mlogregr model table , out_table VARCHAR – name of output table ) RETURNS VOID AS $$ PythonFunction(regress, robust_mlogistic, robust_variance_mlogregr_new) $$ LANGUAGE plpython3u; – END OF NOTICE ---------------------------------------------------------——

Parameters
source_tablename of input table, VARCHAR
out_tablename of output table, VARCHAR
dependent_varnamedependent variable, VARCHAR
independent_varnameindependent variables, VARCHAR
ref_categoryInteger specifying the reference category. Default is 0.
grouping_colsgrouping variables, VARCHAR. Default is NULL. Currently a placeholder.
max_iterInteger identifying the maximum iterations used by the logistic regression solver. Default is 20.
optimizerString identifying the optimizer used in the multinomial logistic regression. See the documentation in the multinomial logistic regression for the available options. Default is 'irls'.
toleranceFloat identifying the tolerance of the multinomial logistic regression optimizer. Default is 1e-4.
verbose_modeBoolean specifying if the multinomial logistic regression solver should print any warnings. Currently a placeholder.
To include an intercept in the model, set one coordinate in the independentVariables array to 1.
Usage
SELECT  madlib.robust_variance_mlogregr(
    'source_table',        -- name of input table, VARCHAR
    'out_table',           -- name of output table, VARCHAR
    'dependent_varname',   -- dependent variable, VARCHAR
    'independent_varname', -- independent variables, VARCHAR
    ref_category,        -- [OPTIONAL] Integer specifying the reference category. Default is 0.
    'grouping_cols',        -- [OPTIONAL] grouping variables, VARCHAR. Default is NULL.
    max_iter,           -- [OPTIONAL] Integer identifying the maximum iterations used by the logistic regression solver.  Default is 20.
    'optimizer',            -- [OPTIONAL] String identifying the optimizer used in the multinomial logistic regression.  See the documentation in the multinomial logistic regression for the available options.  Default is irls.
 tolerance,         -- [OPTIONAL] Float identifying the tolerance of the multinomial logistic regression optimizer. Default is 1e-4.
 verbose_mode        -- [OPTIONAL] Boolean specifying if the regression fit should print any warning messages.  Default is false.
);
Returns
A composite value:
  • ref_category INTEGER - The reference category
  • coef FLOAT8[] - The coefficients for the regression
  • std_err FLOAT8[] - Array of huber-white standard errors,
  • z_stats FLOAT8[] - Array of Wald z-statistics,
  • p_values FLOAT8[] - Array of p-values,

◆ robust_variance_mlogregr() [4/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols,
varchar  optimizer_params 
)

◆ robust_variance_mlogregr() [5/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols 
)

◆ robust_variance_mlogregr() [6/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category 
)

◆ robust_variance_mlogregr() [7/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname 
)

◆ robust_variance_mlogregr() [8/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols,
integer  max_iter,
varchar  optimizer,
float8  tolerance,
boolean  verbose_mode 
)

◆ robust_variance_mlogregr() [9/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols,
integer  max_iter,
varchar  optimizer,
float8  tolerance 
)

◆ robust_variance_mlogregr() [10/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols,
integer  max_iter,
varchar  optimizer 
)

◆ robust_variance_mlogregr() [11/11]

void robust_variance_mlogregr ( varchar  source_table,
varchar  out_table,
varchar  dependent_varname,
varchar  independent_varname,
integer  ref_category,
varchar  grouping_cols,
integer  max_iter 
)