ml_glm2: A function to fit generalized linear models using maximum...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This function fits generalized linear models by maximizing the joint log-likeliood, which is set in a separate function. Two-parameter members of the exponential family are covered. The post-estimation output is designed to work with existing reporting functions.

Usage

1
2
ml_glm2(formula1, formula2 = ~1, data, family, mean.link, scale.link,
        offset = 0, start = NULL, verbose = FALSE)

Arguments

formula1

an object of class '"formula"' (or one that can be coerced to that class): a symbolic description of the mean function for the model to be fitted. (See the help for 'glm' for more details).

formula2

an object of class '"formula"' (or one that can be coerced to that class): a symbolic description of the scale function for the model to be fitted. (See the help for 'glm' for more details).

data

a data frame containing the variables in the model.

family

a description of the error distribution be used in the model. This must be a character string naming a family.

mean.link

a description of the link function be used for the mean in the model. This must be a character string naming a link function.

scale.link

a description of the link function be used for the scale in the model. This must be a character string naming a link function.

offset

this can be used to specify an _a priori_ known component to be included in the linear predictor during fitting. This should be 0 or a numeric vector of length equal to the number of cases.

start

optional starting points for the parameter estimation.

verbose

logical flag affecting the detail of printing. Defaults to FALSE.

Details

The containing package, msme, provides the needed functions to use the ml_glm2 function to fit the normal and negative binomial (2), families, and supports the use of the identity and log link functions.

The object returned by the function is designed to be reported by the print.glm function.

Value

fit

the output of optim.

loglike

the maximized log-likelihood.

X

the design matrix.

y

the response variable.

p

the number of parameters estimated.

rank

the rank of the design matrix for the mean function.

call

the call used for the function.

obs

the number of observations.

fitted.values

estimated response variable.

linear.predictor

linear predictor.

df.null

the degrees of freedom for the null model.

df.residual

the residual degrees of freedom.

pearson

the Pearson Chi2.

null.pearson

the Pearson Chi2 for the null model.

dispersion

the dispersion.

deviance

the residual deviance.

null.deviance

the residual deviance for the null model.

residuals

the deviance residuals.

presiduals

the Pearson residuals.

coefficients

parameter estimates.

se.beta.hat

standard errors of parameter estimates.

aic

Akaike's Information Criterion.

offset

the offset used.

i

the number of iterations required for convergence.

Author(s)

Andrew Robinson and Joe Hilbe.

References

Hilbe, J.M., and Robinson, A.P. 2013. Methods of Statistical Model Estimation. Chapman & Hall / CRC.

See Also

glm, irls, ml_glm,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(medpar)
ml.nb2 <- ml_glm2(los ~ hmo + white,
                    formula2 = ~1,
                    data = medpar,
                    family = "negBinomial",
                    mean.link = "log",
                    scale.link = "inverse_s")

data(ufc)

ufc <- na.omit(ufc)
ml.g <- ml_glm2(height.m ~ dbh.cm,
                formula2 = ~ dbh.cm,
                data = ufc,
                family = "normal",
                mean.link = "identity",
                scale.link = "log_s")

summary(ml.g)

msme documentation built on May 2, 2019, 5:07 a.m.

Related to ml_glm2 in msme...