plot.lqa: Coefficient build-ups for penalized GLMs

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

View source: R/plot.lqa.R

Description

This function plots coefficient build-ups for GLMs that can be estimated with lqa.

Usage

1
2
3
4
 plot.lqa (x, y, family, penalty.family, intercept = TRUE, 
   standardize = TRUE, lambdaseq = NULL, offset.values = NULL, 
   show.standardized = FALSE, add.MLE = TRUE, control = lqa.control(), 
   plot.type = "l", ret.true = FALSE, really.plot = TRUE, ...)

Arguments

x

the augmented design matrix. It must contain a column of ones if an intercept is included in the model.

y

the vector of observed responses.

family

a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See family for details of family functions.)

penalty.family

a function argument identifying the penalty family. See examples below.

intercept

a logical object whether the model should include an intercept (this is recommended) or not. The default value is TRUE.

standardize

a logical object, whether the regressors should be standardized (this is recommended) or not. The default value is TRUE.

lambdaseq

a sequence of tuning parameter candidates for the dimension you want to plot.

offset.values

a vector of the same dimension as your tuning parameter. At the position of the dimension you want to plot there must be entry ‘NA’. The other positions should be filled with given (and fixed) tuning parameter values, as e.g. returned from cv.lqa. See examples below.

show.standardized

logical. If ‘TRUE’ the standardized coefficients are plotted, otherwise the unstandardized coefficients are plotted.

add.MLE

logical. If ‘TRUE’ the unrestricted MLE is also plotted. Note this only works for ‘n > p’ settings. Otherwise this argument is set to ‘FALSE’ automatically.

control

list of control parameters as returned by lqa.control. See there for details.

plot.type

determines the line type.

ret.true

logical. If ‘TRUE’ then plot.lqa returns a list ret.obj with the abscissa (s1) and ordinate (beta.mat) values of the coefficient build-up.

really.plot

logical. If ‘FALSE’ then plot.lqa just computes and returns the ret.obj object.

...

further arguments.

Details

This function plots coefficient build-ups for a given dimension of your tuning parameter(s). The argument lambdaseq can be omitted. In this case a default sequence lambdaseq <- exp (seq (-10, 6, length = 60) is used. If your penalty consists of more than one tuning parameter you must identify the relevant dimension to plot using offset.values where you state the fixed values for the other tuning parameters. See examples below for further details.

Value

This returns a plot object, if really.plot = TRUE, or ret.obj, if really.plot = FALSE.

Author(s)

Jan Ulbricht

See Also

lqa, cv.lqa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
set.seed (434534)
family <- binomial ()

nobs <- 50
nvars <- 5
beta.true <- c (1, 2, 0, 0, -1)
intercept <- TRUE
standardize <- TRUE

x <- matrix (rnorm (nvars * nobs), ncol = nvars)
x[,2] <- x[,1] + rnorm (nobs, sd = 0.1)
x[,3] <- x[,1] + rnorm (nobs, sd = 0.2)

eta.true <- drop (x %*% beta.true)
mu.true <- family$linkinv (eta.true)
vec1 <- 1 : nobs
y <- sapply (mu.true, function (vec1) {rbinom (1, 1, vec1)})

pdf ("fusedlasso_lambda1.pdf", width = 6, height = 6)   
    # here lambda1 'lambda1' is getting varied:
plot.lqa (y = y, x = x, family = binomial (), penalty.family = fused.lasso, 
          offset.values = c (NA, 0.2), add.MLE = FALSE, really.plot = TRUE)
dev.off ()

lqa documentation built on May 30, 2017, 3:41 a.m.