% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict.autotune_lasso.R
\name{predict.autotune_lasso}
\alias{predict.autotune_lasso}
\title{Predict from a autotune_lasso fit}
\usage{
\method{predict}{autotune_lasso}(
  object,
  newx = NULL,
  type = c("response", "coefficients"),
  path = NULL,
  ...
)
}
\arguments{
\item{object}{An object of class \code{autotune_lasso}.}

\item{newx}{Numeric matrix of new \code{x} (rows = observations,
columns = predictors) at which predictions are required. This 
argument is not used for \code{type="coefficients")}.}

\item{type}{Character; one of \code{"response"}, \code{"coefficients"}.}

\item{path}{For \code{type = "coefficients"}, \code{NULL} returns the final
coefficients and \code{TRUE} returns the full coefficient path. This
argument is ignored for \code{type = "response"}.}

\item{...}{Further arguments passed from the generic.}
}
\value{
If \code{type = "response"}, returns the prediction at the x provided for prediction.

If \code{type = "coefficients"}, returns the fitted coefficients.
}
\description{
Predict from a autotune_lasso fit
}
\examples{
set.seed(10)
n = 300
p = 500
s = 10
beta = c(rep(1, s), rep(0, p - s))
x = matrix(rnorm(n * p), ncol = p)
# Maunal sigma allocation
# y = x \%*\% beta + rnorm(n, sd = 1)
# Dynamic sigma allocation with snr specified
snr = 2
y = x \%*\% beta + rnorm(n, sd = sqrt(var(x\%*\%beta)/snr))
fit <- autotune_lasso(x, y)
predict(fit, newx = x[1:5, , drop = FALSE])
predict(fit, type = "coefficients")

predict(fit, type = "coefficients", path = TRUE)

}
