﻿ VisualStat® Examples - GLM

Software to Simplify Statistical Practice ...

## Fitting Generalized Linear Models

#### Data

Using the Consumer Price Index dataset we can explore the relationship between the prices of various products and commodities. These data represent the average prices of the following items for the months of January between 1981 and 2006.

#### Analysis

1. Open the DataBook reg.vstz
open this data file via the Help / Open Examples menu; it is in the Sample Data
2. Select the sheet ConsumerPriceIndex
3. Choose the menu Analyze and the command GLM
4. In Dependent, select Gasolin.
5. In Independent, select Electricity, Fuel_Oil and Orange_Juice
6. Click OK

#### Output

By default, R code is printed after parsing and before evaluation.

DataSheet is converted to DataFrame, in the form DataBook.DataSheet

> GLMModel <- glm(formula = Gasoline ~ Electricity + Fuel_Oil + Orange_Juice, family = gaussian(link = identity), data = regr.ConsumerPriceIndex, na.action = na.exclude, control = list(epsilon .... [TRUNCATED]

> summary(GLMModel)

Call:
glm(formula = Gasoline ~ Electricity + Fuel_Oil + Orange_Juice,

family = gaussian(link = identity), data = regr.ConsumerPriceIndex,

na.action = na.exclude, control = list(epsilon = 1e-04, maxit = 50,

trace = F))

Deviance Residuals:

Min        1Q    Median        3Q       Max
-0.19733  -0.03573   0.01222   0.03878   0.08749

Coefficients:

Estimate Std. Error t value Pr(>|t|)
(Intercept)   0.082920   0.124971   0.664 0.513892
Electricity   0.013233   0.003362   3.936 0.000705 ***
Fuel_Oil      0.793367   0.044522  17.819 1.47e-14 ***

Orange_Juice -0.190291   0.086680  -2.195 0.038982 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.'
0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.00456996)

Null deviance: 2.40123  on 25  degrees of freedom
Residual deviance: 0.10054  on 22  degrees of freedom
AIC: -60.653

Number of Fisher Scoring iterations: 2