# predict.enet

From elasticnet v1.02
by Hui Zou

##### Make predictions or extract coefficients from a fitted elastic net model

While enet() produces the entire path of solutions, predict.enet allows one to extract a prediction at a particular point along the path.

- Keywords
- methods, regression

##### Usage

```
predict.enet(object, newx, s, type = c("fit", "coefficients"), mode =
c("step","fraction", "norm", "penalty"),naive=FALSE, ...)
```

##### Arguments

- object
- A fitted enet object
- newx
- If type="fit", then newx should be the x values at which the fit is required. If type="coefficients", then newx can be omitted.
- s
- a value, or vector of values, indexing the path. Its values depends on the mode= argument. By default (mode="step").
- type
- If type="fit", predict returns the fitted values. If type="coefficients", predict returns the coefficients. Abbreviations allowed.
- mode
- Mode="step" means the s= argument indexes the LARS-EN step number, and the coefficients will be returned corresponding to the values corresponding to step s. If mode="fraction", then s should be a number between 0 and 1, and it refers to the ratio of the
- naive
- IF naive is True, then the naive elastic net fit is returned.
- ...
- Additonal arguments for generic print.

##### Details

Starting from zero, the LARS-EN algorithm provides the entire sequence of coefficients and fits.

##### Value

- Either a vector/matrix of fitted values, or a vector/matrix of coefficients.

##### References

Zou and Hastie (2004) "Regularization and
Variable Selection via the Elastic Net"
*In press, Journal of the Royal Statistical Society, Series B*.

##### See Also

print, plot, enet

##### Examples

```
data(diabetes)
attach(diabetes)
object <- enet(x,y,lambda=0.1)
### make predictions at the values in x, at each of the
### steps produced in object
fits <- predict.enet(object, x, type="fit")
### extract the coefficient vector with L1 norm=2000
coef2000 <- predict(object, s=2000, type="coef", mode="norm")
### extract the coefficient vector with L1 norm fraction=0.45
coef.45 <- predict(object, s=0.45, type="coef", mode="fraction")
detach(diabetes)
```

*Documentation reproduced from package elasticnet, version 1.02, License: GPL version 2 or newer*

### Community examples

Looks like there are no examples yet.