glm.fit.cons {zetadiv} | R 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 |
y |
as for |
weights |
as for |
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 |
etastart |
as for |
mustart |
as for |
offset |
as for |
family |
as for |
control |
as for |
intercept |
as for |
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
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)