glm#

swordfish.function.glm()#

Fit a generalized linear model.

Parameters:
  • ds (Constant) – The data source to be trained. It can be generated with function sqlDS.

  • yColName (Constant) – A string indicating the dependent variable column.

  • xColNames (Constant) – A STRING scalar/vector indicating the names of the indepenent variable columns.

  • family (Constant,) – A string indicating the type of distribution. It can be gaussian (default), poisson, gamma, inverseGaussian or binomial.

  • link (Constant, optional) –

    A string indicating the type of the link function.

    Possible values of link and the dependent variable for each family:

    family

    link

    default link

    dependent variable

    gaussian

    identity, inverse, log

    identity

    DOUBLE type

    poisson

    log, sqrt, identity

    log

    non-negative integer

    gamma

    inverse, identity, log

    inverse

    y>=0

    inverseGaussian

    inverseOfSquare, inverse, identity, log | inverseOfSquare | y>=0

    binomial

    logit, probit

    logit

    y=0,1

  • tolerance (Constant, optional) – A numeric scalar. The iterations stops if the difference in the value of the log likelihood functions of 2 adjacent iterations is smaller than tolerance. The default value is 0.000001.

  • maxIter (Constant, optional) – A positive integer indicating the maximum number of iterations. The default value is 100.

Returns:

A dictionary with the following keys: coefficients, link, tolerance, family, xColNames, tolerance, modelName, residualDeviance, iterations and dispersion.

  • coefficients is a table with the coefficient estimate, standard deviation, t value and p value for each coefficient;

  • modelName is “Generalized Linear Model”;

  • iterations is the number of iterations;

  • dispersion is the dispersion coefficient of the model.

Return type:

Constant