TITLE(glm @@ Fitting Generalized Linear Models)
USAGE(
glm(formula, family=gaussian, data, weights, subset,
        na.action=na.fail, start=NULL, offset=NULL,
        control=glm.control(epsilon=0.0001, maxit=10,
                trace=F),
        model=T, method=glm.fit, x=F, y=T)
BLANK
summary(glm.obj, dispersion=NULL, correlation=TRUE,
        na.action=na.omit)
anova(glm.obj, DOTS)
BLANK
coefficients(glm.obj)
deviance(glm.obj)
df.residual(glm.obj)
effects(glm.obj)
family(glm.obj)
fitted.values(glm.obj)
residuals(glm.obj, type="deviance")
BLANK
glm.control(epsilon=0.0001, maxit=10, trace=FALSE) 
glm.fit(x, y, weights=rep(1, nrow(x)),
        start=NULL, offset=rep(0, nrow(x)),
        family=gaussian(), control=glm.control(),
        intercept=TRUE) 
)
ALIAS(glm)
ALIAS(glm.control)
ALIAS(glm.fit)
ALIAS(summary.glm)
ALIAS(anova.glm)
ALIAS(coefficients.glm)
ALIAS(deviance.glm)
ALIAS(df.residual.glm)
ALIAS(effects.glm)
ALIAS(family.glm)
ALIAS(fitted.values.glm)
ALIAS(residuals.glm)
ALIAS(print.glm)
ALIAS(print.anova.glm)
ALIAS(print.summary.glm)
ARGUMENTS(
ARG(formula @@ a symbolic description of the model to be fit.
The details of model specification are given below.)
ARG(family @@ a description of the error distribution and link
function to be used in the model.
See LANG(LINK(family)) for details.)
ARG(data @@ an optional data frame containing the variables
in the model.  By default the variables are taken from
the environment which LANG(lm) is called from.)
ARG(weights @@ an optional vector of weights to be used
in the fitting process.)
ARG(subset @@ an optional vector specifying a subset of observations
to be used in the fitting process.)
ARG(na.action @@ a function which indicates what should happen
when the data contain LANG(NA)s.  The default action (LANG(na.omit))
is to omit any incomplete observations.
The alternative action LANG(na.fail) causes LANG(lm) to
print an error message and terminate if there are any incomplete
observations.)
ARG(start @@ starting values for the parameters in the
linear predictor.)
ARG(offset @@ this can be used to specify an a-priori
known component to be included in the linear predictor
during fitting.)
ARG(control @@ a list of parameters for controlling the fitting
process.  See the documentation for LANG(LINK(glm.control)) for details.)
ARG(model @@ a logical value indicating whether ITALIC(model frame)
should be included as a component of the returned value.)
ARG(method @@ the method to be used in fitting the model.
The default (and presently only) method LANG(glm.fit)
uses iteratively reweighted least squares.)
ARG(x,y @@ logical values indicating whether the response
vector and design matrix used in the fitting process
should be returned as components of the returned value.)
ARG(glm.obj @@
an object of class LANG(glm).)
ARG(dispersion @@
the dispersion parameter for the fitting family.
By default the dispersion parameter is obtained from
LANG(glm.obj).)
ARG(correlation @@
should the correlation matrix of the estimated parameters
be printed.)
ARG(type @@
the type of residuals which should be returned.  The alternatives are:
LANG("deviance"), LANG("pearson"), LANG("working"), LANG("response").)
)
DESCRIPTION(
LANG(glm) is used to fit generalized linear models.
PARA
Models for LANG(glm) are specified by giving
a symbolic description of the linear predictor and
a description of the error distribution.
A typical predictor has the form
LANG(reponse ~ terms) where LANG(response) is the (numeric)
response vector and LANG(terms) is a series of terms which
specifies a linear predictor for LANG(response).
A terms specification of the form LANG(first+second)
indicates all the terms in LANG(first) together
with all the terms in LANG(second) with duplicates
removed.
A specification of the form LANG(first:second) indicates the
the set of terms obtained by taking the interactions of
all terms in LANG(first) with all terms in LANG(second).
The specification LANG(first*second) indicates the ITALIC(cross)
of LANG(first) and LANG(second).
This is the same as LANG(first+second+first:second).
)
VALUE(
LANG(glm) returns an object of class LANG(glm)
which inherits from the class LANG(lm).
The function LANG(summary) can be used to obtain or print
a summary of the results and the function LANG(anova)
and be used to produce and analysis of variance table.
The generic accessor functions LANG(coefficients),
LANG(effects), LANG(fitted.values) and LANG(residuals)
can be used to extract various useful features of the
value returned by LANG(glm).
)
SEEALSO(
LANG(LINK(anova)), LANG(LINK(coefficients)), LANG(LINK(effects)),
LANG(LINK(fitted.values)),
LANG(LINK(lm)),
LANG(LINK(residuals)), LANG(LINK(summary)).
)
EXAMPLES(
## Annette Dobson (1990) "An Introduction to Statistical Modelling".
## Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3,9)
print(d.AD <- data.frame(treatment, outcome, counts))
glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
anova(glm.D93)
summary(glm.D93)
)	 
