nauf_glm: Fit a fixed effects regression using 'nauf' contrasts.

Description Usage Arguments Details Value Note on Generics See Also Examples

Description

The fixed effects regression functions nauf_lm, nauf_glm.nb, and nauf_glm fit linear, negative binomial, and other generalized linear models, respectively, impelementing nauf_contrasts.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
nauf_glm(formula, family = gaussian, data = NULL, weights, subset,
  na.action = na.pass, start = NULL, etastart, mustart, offset,
  control = list(...), model = TRUE, method = "glm.fit", x = TRUE,
  y = TRUE, contrasts = NULL, ncs_scale = attr(formula,
  "standardized.scale"), ...)

nauf_lm(formula, data = NULL, subset, weights, na.action = na.pass,
  method = "qr", model = TRUE, x = TRUE, y = TRUE, qr = TRUE,
  singular.ok = TRUE, contrasts = NULL, offset, ncs_scale = attr(formula,
  "standardized.scale"), ...)

nauf_glm.nb(formula, data = NULL, weights, subset, na.action = na.pass,
  start = NULL, etastart, mustart, control = stats::glm.control(...),
  method = "glm.fit", model = TRUE, x = TRUE, y = TRUE,
  contrasts = NULL, ncs_scale = attr(formula, "standardized.scale"), ...,
  init.theta, link = log)

Arguments

formula, data, subset, offset, weights, method, control, start, etastart, mustart, qr, singular.ok, family, init.theta, link, ...

See lm, glm, and glm.nb.

na.action, contrasts

Changes to the default values for these arguments are ignored with a warning. See nauf_model.frame.

model, x, y

Chages to the default values for these arguments are ignored with a warning. See 'Details'.

ncs_scale

A positive number to be passed as the scale argument to named_contr_sum for all unordered factors. See nauf_model.frame.

Details

nauf_lm is based on lm in the stats package, nauf_glm on glm in the stats package, and nauf_glm.nb on glm.nb in the MASS package; but implementing nauf_contrasts. The nauf functions have all the same arguments as the functions they are based on, but additionally ncs_scale, which is passed to nauf_model.frame. Other than ncs_scale, the arguments have the same functions as they do in the functions they are based on. The default values for na.action, contrasts, model, x, and y cannot be changed. For na.action and contrasts, see nauf_model.frame. Forcing model, x, and y to be TRUE ensures that the fitted model retains the model frame, model matrix, and response, respectively. This is necessary for some generic functions applied to the fitted model to work properly.

Value

A fitted model with class nauf.glm (inheriting from lm, and also possibly glm and/or negbin depending on the regression). For the elements contained in the object, and additional class attributes the model may contain, see lm, glm, and glm.nb.

Note on Generics

Methods for S3 generic functions from the stats and MASS packages should work for nauf.glm models as they normally would for the related regression models not fit with nauf_contrasts. If you encounter a generic function in these packages which does not function properly, please report the issue at https://github.com/CDEager/nauf/issues.

See Also

nauf_contrasts for a description of the contrasts applied to unordered factors; and lm, glm, and glm.nb for argument definitions.

Examples

1
2
3
4
dat <- plosives
dat$spont[dat$dialect == "Valladolid"] <- NA
sobj <- standardize(intdiff ~ voicing * dialect * spont, dat)
mod <- nauf_lm(sobj$formula, sobj$data)

CDEager/nauf documentation built on May 6, 2019, 9:24 a.m.