Nothing
###############################################################################################################
###############################################################################################################
#' Give predicteds for elastic net models form a nested..glmnetr() output object.
#'
#' @description
#' Give predicteds based upon a cv.glmnetr() output object. By default lambda and gamma
#' are chosen as the minimizing values for the relaxed lasso model. If gam=1 and lam=NULL
#' then the best unrelaxed lasso model is chosen and if gam=0 and lam=NULL then
#' the best fully relaxed lasso model is selected.
#'
#' @param object A cv.glmnetr (or nested.glmnetr) output object.
#' @param xs_new The predictor matrix. If NULL, then betas are provided.
#' @param alpha A specific value of alpha for plotting. Used only when type is
#' set to "elastic". Specifies which alpha is to be used for deviance plots.
#' Default is "alpha.min", else must be an element of the alpha vector used in
#' running the elastic net model. This can be reviewed using summary(fit)
#' where fit is a nested.glmnetr() output object. Note, alpha is 1 for the
#' lasso model and alpha is 0 for the ridge model.
#' @param lambda The lambda value for choice of beta. If NULL, then
#' lambda.min is used from the cross validated tuned relaxed model. We
#' use the term lam instead of lambda as lambda usually denotes a vector
#' in the package.
#' @param gamma The gamma value for choice of beta. If NULL, then
#' gamma.min is used from the cross validated tuned relaxed model. We
#' use the term gam instead of gamma as gamma usually denotes a vector
#' in the package.
#' @param comment Default of TRUE to write to console information on lam and gam selected for output.
#' FALSE will suppress this write to console.
#' @param ... Additional arguments passed to the predict function.
#'
#' @return Either predicteds (xs_new*beta estimates based upon the predictor matrix xs_new)
#' or model coefficients, based upon a cv.glmnetr() output object. When
#' outputting coefficients (beta), creates a list
#' with the first element, beta_, including 0 and non-0 terms and the
#' second element, beta, including only non 0 terms.
#'
#' @seealso
#' \code{\link{summary.cv.glmnetr}} , \code{\link{nested.glmnetr}}
#'
#' @export
#'
predict.cv.glmnetr.el = function(object, xs_new, alpha=NULL, gamma=NULL, lambda=NULL, comment=TRUE, ...) {
cat( " in predict.cv.glmnetr.el class(object) = ", class(object), "\n")
return( predict.cv.glmnetr(object, xs_new = xs_new, alpha=alpha, lambda = lambda, gamma = gamma, comment=comment, type="elastic", ...) )
}
###############################################################################################################
#' Give predicteds for elastic net models form a nested..glmnetr() output object.
#'
#' @description
#' Give predicteds based upon a cv.glmnetr() output object. By default lambda and gamma
#' are chosen as the minimizing values for the relaxed lasso model. If gam=1 and lam=NULL
#' then the best unrelaxed lasso model is chosen and if gam=0 and lam=NULL then
#' the best fully relaxed lasso model is selected.
#'
#' @param object A cv.glmnetr (or nested.glmnetr) output object.
#' @param xs_new The predictor matrix. If NULL, then betas are provided.
#' @param alpha A specific value of alpha for plotting. Used only when type is
#' set to "elastic". Specifies which alpha is to be used for deviance plots.
#' Default is "alpha.min", else must be an element of the alpha vector used in
#' running the elastic net model. This can be reviewed using summary(fit)
#' where fit is a nested.glmnetr() output object. Note, alpha is 1 for the
#' lasso model and alpha is 0 for the ridge model.
#' @param lambda The lambda value for choice of beta. If NULL, then
#' lambda.min is used from the cross validated tuned relaxed model. We
#' use the term lam instead of lambda as lambda usually denotes a vector
#' in the package.
#' @param gamma The gamma value for choice of beta. If NULL, then
#' gamma.min is used from the cross validated tuned relaxed model. We
#' use the term gam instead of gamma as gamma usually denotes a vector
#' in the package.
#' @param comment Default of TRUE to write to console information on lam and gam selected for output.
#' FALSE will suppress this write to console.
#' @param ... Additional arguments passed to the predict function.
#'
#' @return Either predicteds (xs_new*beta estimates based upon the predictor matrix xs_new)
#' or model coefficients, based upon a cv.glmnetr() output object. When
#' outputting coefficients (beta), creates a list
#' with the first element, beta_, including 0 and non-0 terms and the
#' second element, beta, including only non 0 terms.
#'
#' @seealso
#' \code{\link{summary.cv.glmnetr}} , \code{\link{nested.glmnetr}}
#'
#' @export
#'
predict.cv.glmnetr.list = function(object, xs_new, alpha=NULL, gamma=NULL, lambda=NULL, comment=TRUE, ...) {
# cat( " in predict.cg.glmnetr.list class(object) = ", class(object), "\n")
return( predict.cv.glmnetr(object, xs_new = xs_new, alpha=alpha, lambda = lambda, gamma = gamma, comment=comment, type="elastic", ...) )
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.