glm.fit.cons: Generalized Linear Models fitting method with negative...

glm.fit.consR Documentation

Generalized Linear Models fitting method with negative coefficients constraint

Description

glm.fit.cons is an adaptation of function glm.fit2 from package {glm2} in which the least squares estimation is replaced by a non-positive regression using function nnnpls from package {nnls}.

Usage

glm.fit.cons(
  x,
  y,
  weights = rep(1, nobs),
  cons = -1,
  cons.inter = 1,
  start = NULL,
  etastart = NULL,
  mustart = NULL,
  offset = rep(0, nobs),
  family = stats::gaussian(),
  control = list(),
  intercept = TRUE
)

Arguments

x

as for glm.fit

y

as for glm.fit

weights

as for glm.fit

cons

type of constraint. Default is -1 for negative coefficients on the predictors. The other option is 1 for positive coefficients on the predictors.

cons.inter

type of constraint for the intercept. Default is 1 for positive intercept, suitable for Gaussian family. The other option is -1 for negative intercept, suitable for binomial family.

start

as for glm.fit

etastart

as for glm.fit

mustart

as for glm.fit

offset

as for glm.fit

family

as for glm.fit

control

as for glm.fit

intercept

as for glm.fit

Value

The value returned by glm.fit.cons has exactly the same structure as the value returned by glm.fit and glm.fit2.

References

Marschner, I.C. (2011) glm2: Fitting generalized linear models with convergence problems. The R Journal, 3(2), 12-15.

See Also

glm.fit, glm.fit2

Examples

## Dobson (1990) 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)
print(d.AD <- data.frame(treatment, outcome, counts))
glm.D93 <- glm.cons(counts ~ outcome + treatment, family = poisson())
glm.D93.ngl <- glm.cons(counts ~ outcome + treatment, family = poisson(),
   method="glm.fit.cons")
summary(glm.D93)
summary(glm.D93.ngl)

zetadiv documentation built on June 11, 2022, 1:12 a.m.