coef.dglars: Extract the dgLARS Coefficient Path

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/coef.dglars.R

Description

coef.dglars is used to extract the coefficient path computed by dgLARS method.

Usage

1
2
3
## S3 method for class 'dglars'
coef(object, type = c("pearson", "deviance", "mle"), 
...)

Arguments

object

fitted dglars object.

type

a description of the estimator used for the dispersion parameter.

...

this is the argument by means of to pass the argument g to predict.dglars and phihat.

Details

coef.dglars is a wrapper function calling “predict.dglars” and “phihat”. By default, this function returns the sequence of the penalized coefficients and the sequence of the penalized estimate of the dispersion parameter phi; by using the argument “...”, the user can obtain the prediction of the estimates for any value of the tuning parameter (see the example below).

Value

coef.dglars returns a named list with component:

beta

the sequence of the penalized estimates of the regression coefficients;

phi

the penalized estimates of the dispersion parameter;

g

the vector of the values of the tuning parameter.

Author(s)

Luigi Augugliaro
Maintainer: Luigi Augugliaro [email protected]

See Also

predict.dglars and phihat.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
###########################
# Logistic regression model
set.seed(123)
n <- 100
p <- 10
X <- matrix(rnorm(n * p), n, p)
b <- 1:2
eta <- b[1] + X[, 1] * b[2]
mu <- binomial()$linkinv(eta)
y <- rbinom(n, 1, mu)
fit <- dglars(y ~ X, family = binomial)
coef(fit)
coef(fit, g = seq(4, 0.5, length = 10))

###########################
# Gamma family
n <- 100
p <- 10
X <- matrix(abs(rnorm(n * p)), n, p)
b <- 1:2
eta <- b[1] + X[, 1] * b[2]
mu <- drop(Gamma()$linkinv(eta))
shape <- 0.5
phi <- 1 / shape
y <- rgamma(n, scale = mu / shape, shape = shape)
fit <- dglars(y ~ X, Gamma("log"))
coef(fit, type = "pearson")
coef(fit, type = "deviance")
coef(fit, type = "mle")

dglars documentation built on May 29, 2017, 5:48 p.m.