Generalized Linear Model

In statistics, the generalized linear model (GLM) is a flexible generalization of ordinary linear regression that allows for response variables that have error distribution models other than a normal distribution. The GLM generalizes linear regression by allowing the linear model to be related to the response variable via a link function and by allowing the magnitude of the variance of each measurement to be a function of its predicted value.

The GAUSS function glm is used to solve generalized linear model problems. GAUSS provides the following combinations from exponential family and related link function.

Normal Binomial Poisson Gamma
identity * * * *
inverse * * * *
ln * * * *
logit *
probit *

Format

// Read data matrix from a '.csv' file and start from the second row
data = csvReadM("binary.csv", 2);

// Read headers from first row
vnames = csvReadSA("binary.csv", 1|1);

// Specify dependent variable
y = data[.,1];

// Specify independent variable
x = data[.,2:4];

// Specify link function
link = "logit";

// Call glm function
call glm(y, x, "binomial", vnames, 3, link);

Output

Generalized Linear Model

Valid cases:                  400     Dependent Variable:                      admit 
Degrees of freedom:           394     Distribution:                         binomial 
Deviance:                   458.5     Link function:                           logit 
Pearson Chi-square:         397.5     AIC:                                     470.5
Log likelihood:            -229.3     BIC:                                     494.5
Dispersion:                     1     Iterations:                                  4


                                          Standard                              Prob 
Variable                 Estimate            Error          z-value             >|z| 
----------------     ------------     ------------     ------------     ------------ 
CONSTANT                    -3.99             1.14          -3.5001      0.000465027 
rank           2         -0.67544          0.31649          -2.1342        0.0328288 
               3          -1.3402          0.34531          -3.8812      0.000103942 
               4          -1.5515          0.41783          -3.7131      0.000204711 
gre                     0.0022644         0.001094           2.0699        0.0384651 
gpa                       0.80404          0.33182           2.4231        0.0153879 

Note: Dispersion parameter for BINOMIAL distribution taken to be 1

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.