Description Usage Arguments Value References See Also Examples
Fit a generalized regression problem while imposing an L1 constraint on
the parameters. Returns an object of class gl1ce
.
1 2 3 4 5 6 | gl1ce(formula, data = parent.frame(), weights, subset, na.action,
family = gaussian, control = glm.control(...), sweep.out = ~ 1,
x = FALSE, y = TRUE, contrasts = NULL, standardize = TRUE,
guess.constrained.coefficients = double(p), bound = 0.5, ...)
## S3 method for class 'gl1ce'
family(object, ...)
|
formula |
a |
data |
a |
weights |
vector of observation weights. The length of
|
subset |
expression saying which subset of the rows of the data should be used in the fit. This can be a logical vector (which is replicated to have length equal to the number of observations), or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default. |
na.action |
a function to be applied to the |
family |
a |
control |
a list of iteration and algorithmic constants. See glm.control for their names and default values. These can also be set as arguments to gl1ce itself. |
sweep.out |
a formula object, variables whose parameters are not put under the
constraint are swept out first. The variables should appear on the
right of a |
x |
logical flag: if |
y |
logical flag: if |
contrasts |
a list giving contrasts for some or all of the factors appearing in the model formula. The elements of the list should have the same name as the variable and should be either a contrast matrix (specifically, any full-rank matrix with as many rows as there are levels in the factor), or else a function to compute such a matrix given the number of levels. |
standardize |
logical flag: if |
guess.constrained.coefficients |
initial guess for the parameters that are constrained. |
bound |
numeric, either a single number or a vector: the constraint(s) that is/are put onto the L1 norm of the parameters. |
... |
potential arguments for |
object |
an R object of class |
an object of class gl1ce
is returned by gl1ce()
.
See gl1ce.object
for details.
See the references in l1ce
.
Justin Lokhorst (1999). The LASSO and Generalised Linear Models, Honors Project, Nov. 1999, Dept.Statist., Univ. of Adelaide.
glm
for unconstrained generalized regression
modeling.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## example from base:
data(esoph)
summary(esoph)
## effects of alcohol, tobacco and interaction, age-adjusted
modEso <- formula(cbind(ncases, ncontrols) ~ agegp + tobgp * alcgp)
glm.E <- glm(modEso, data = esoph, family = binomial())
gl1c.E <- gl1ce(modEso, data = esoph, family = binomial())
gl1c.E
plot(residuals(gl1c.E) ~ fitted(gl1c.E))
sg1c <- summary(gl1c.E)
sg1c
## Another comparison glm() / gl1c.E:
plot(predict(glm.E, type="link"), predict(glm.E, type="response"),
xlim = c(-3,0))
points(predict(gl1c.E, type="link"), predict(gl1c.E, type="response"),
col = 2, cex = 1.5)
labels(gl1c.E)#-- oops! empty!!
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.