glm.cons | R Documentation |
glm.cons
is an adaptation of function glm2
from package {glm2} in which the least squares estimation is replaced by a regression with signs constraint on the coefficients using function nnnpls
from package {nnls}.
glm.cons( formula, family = stats::gaussian(), data, weights, subset, na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, method = "glm.fit.cons", cons = -1, cons.inter = 1, x = FALSE, y = TRUE, contrasts = NULL, ... )
formula |
as for |
family |
as for |
data |
as for |
weights |
as for |
subset |
as for |
na.action |
as for |
start |
as for |
etastart |
as for |
mustart |
as for |
offset |
as for |
control |
as for |
model |
as for |
method |
the method used in fitting the model. The default method " |
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. |
x |
as for |
y |
as for |
contrasts |
as for |
... |
as for |
The value returned by glm.cons
has exactly the same structure as the value returned by glm
and glm.2
.
Marschner, I.C. (2011) glm2: Fitting generalized linear models with convergence problems. The R Journal, 3(2), 12-15.
glm
, glm2
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.