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

Fitting generalized linear models with L1 (lasso and fused lasso) and/or L2 (ridge) penalties, or a combination of the two.

1 2 3 4 5 |

`response` |
The response variable (vector). This should be a numeric vector for linear regression, a |

`penalized` |
The penalized covariates. These may be specified either as a matrix or as a (one-sided) |

`unpenalized` |
Additional unpenalized covariates. Specified as under |

`lambda1, lambda2` |
The tuning parameters for L1 and L2 penalization. Each must be either a single positive numbers or a vector with length equal to the number of covariates in |

`positive` |
If |

`data` |
A |

`fusedl` |
If |

`model` |
The model to be used. If missing, the model will be guessed from the |

`startbeta` |
Starting values for the regression coefficients of the penalized covariates. |

`startgamma` |
Starting values for the regression coefficients of the unpenalized covariates. |

`steps` |
If greater than 1, the algorithm will fit the model for a range of |

`epsilon` |
The convergence criterion. As in |

`maxiter` |
The maximum number of iterations allowed. Set by default at 25 when only an L2 penalty is present, infinite otherwise. |

`standardize` |
If |

`trace` |
If |

The `penalized`

function fits regression models for a given combination of L1 and L2 penalty parameters.

`penalized`

returns a `penfit`

object when `steps = 1`

or a list of such objects if `steps > 1`

.

The `response`

argument of the function also accepts formula input as in `lm`

and related functions. In that case, the right hand side of the `response`

formula is used as the `penalized`

argument or, if that is already given, as the `unpenalized`

argument. For example, the input `penalized(y~x)`

is equivalent to `penalized(y, ~x)`

and `penalized(y~x, ~z)`

to `penalized(y, ~z, ~x)`

.

In case of tied survival times, the function uses Breslow's version of the partial likelihood.

Jelle Goeman: [email protected]

Goeman J.J. (2010). L-1 Penalized Estimation in the Cox Proportional Hazards Model. Biometrical Journal 52 (1) 70-84.

`penfit`

for the `penfit`

object returned, `plotpath`

for plotting the solution path, and `cvl`

for cross-validation and
optimizing the tuning parameters.

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 | ```
# More examples in the package vignette:
# type vignette("penalized")
data(nki70)
# A single lasso fit predicting survival
pen <- penalized(Surv(time, event), penalized = nki70[,8:77],
unpenalized = ~ER+Age+Diam+N+Grade, data = nki70, lambda1 = 10)
show(pen)
coefficients(pen)
coefficients(pen, "penalized")
basehaz(pen)
# A single lasso fit using the clinical risk factors
pen <- penalized(Surv(time, event), penalized = ~ER+Age+Diam+N+Grade,
data = nki70, lambda1=10, standardize=TRUE)
# using steps
pen <- penalized(Surv(time, event), penalized = nki70[,8:77],
data = nki70, lambda1 = 1,steps = 20)
plotpath(pen)
# A fused lasso fit predicting survival
pen <- penalized(Surv(time, event), penalized = nki70[,8:77], data = nki70,
lambda1 = 1, lambda2 = 2, fusedl = TRUE)
plot(coefficients(pen, "all"),type="l",xlab = "probes",ylab = "coefficient value")
plot(predict(pen,penalized=nki70[,8:77]))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.