Skip to content

Commit

Permalink
Code cleanup for R CMD CHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
ehrlinger committed Mar 9, 2016
1 parent f86bdf2 commit 2ea594a
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 58 deletions.
17 changes: 9 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Generated by roxygen2: do not edit by hand

export(coef.l2boost)
S3method(coef,l2boost)
S3method(fitted,l2boost)
S3method(l2boost,default)
S3method(l2boost,formula)
S3method(plot,l2boost)
S3method(predict,l2boost)
S3method(print,l2boost)
S3method(residuals,l2boost)
export(cv.l2boost)
export(elasticNetSim)
export(fitted.l2boost)
export(l2boost)
export(l2boost.default)
export(l2boost.formula)
export(mvnorm.l2boost)
export(plot.l2boost)
export(predict.l2boost)
export(print.l2boost)
export(residuals.l2boost)
importFrom(MASS,mvrnorm)
importFrom(parallel,detectCores)
importFrom(parallel,mclapply)
7 changes: 3 additions & 4 deletions R/coef.l2boost.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @title Extract model coefficients from an l2boost model object at any point along the solution path indexed by step m.
#' Extract model coefficients from an l2boost model object at any point along the solution path indexed by step m.
#'
#' @details \code{\link{coef}} is a generic function which extracts model coefficients from objects returned by modeling functions.
#' \code{\link{coef}} is a generic function which extracts model coefficients from objects returned by modeling functions.
#'
#' By default, \code{\link{coef.l2boost}} returns the model (beta) coefficients from the last step,
#' M of the \code{\link{l2boost}} model. For a \code{\link{cv.l2boost}} object, the default returns the coefficients from
Expand Down Expand Up @@ -32,8 +32,7 @@
#' # At the m=500 step
#' coef(object, m=500)
#'
#' @export coef.l2boost
#'
#' @export
coef.l2boost <- function(object, m=NULL, ...){
if(inherits(object, "cv")){
if(!is.null(m)) warning ("Cannot select step number for cv.l2boost objects.")
Expand Down
4 changes: 3 additions & 1 deletion R/cv.l2boost.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@
#' plot(coef(cv.eBoost$fit, m=cv.obj$opt.step), cex=.5,
#' ylab=expression(beta[i]), xlab="Column Index", ylim=c(0,140), col=sig)
#' }
#'
#' @export cv.l2boost
#' @importFrom parallel mclapply
#' @importFrom parallel mclapply detectCores
#'
cv.l2boost <- function(x, y, K = 10, M = NULL, nu = 1e-4, lambda = NULL, trace = FALSE,
type = c( "discrete", "hybrid", "friedman","lars"), cores=NULL,
...) {
Expand Down
7 changes: 3 additions & 4 deletions R/fitted.l2boost.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' @title Extract the fitted model estimates along the solution path for an l2boost model.
#' Extract the fitted model estimates along the solution path for an l2boost model.
#'
#' @details \code{\link{fitted}} is a generic function which extracts fitted values from objects
#' \code{\link{fitted}} is a generic function which extracts fitted values from objects
#' returned by modeling functions.
#'
#' \code{\link{fitted.l2boost}} returns the function estimates obtained
Expand Down Expand Up @@ -54,8 +54,7 @@
#' type="l", lty=2, col="red", lwd=2)
#' abline(h=0, lty=2, col = 'gray')
#'
#' @export fitted.l2boost
#'
#' @export
fitted.l2boost <- function(object, m=NULL, ...){
if(inherits(object, "cv")){
if(is.null(m)){
Expand Down
26 changes: 11 additions & 15 deletions R/l2boost.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@
# y is centered --- > mean is returned as part of the object
# !!! remove x-columns with NA's !!! CAUTION
#---------------------------------------------------------------------
#' @export l2boost
#' @name l2boost
#' @aliases l2boost l2boost.default l2boost.formula
#'
#'
l2boost <- function(x, ...)UseMethod("l2boost")
#
#' @title Generic gradient descent boosting method for linear regression.
#' Generic gradient descent boosting method for linear regression.
#'
#' @description Efficient implementation of Friedman's boosting algorithm [Friedman (2001)] with L2-loss function and coordinate
#' Efficient implementation of Friedman's boosting algorithm [Friedman (2001)] with L2-loss function and coordinate
#' direction (design matrix columns) basis functions. This includes the elasticNet data augmentation of Ehrlinger and Ishwaran (2012),
#' which adds an L2-penalization (lambda) similar to the elastic net [Zou and Hastie (2005)].
#'
#' @details
#' The \code{\link{l2boost}} function is an efficient implementation of a generic boosting method [Friedman (2001)] for
#'
#' The \code{\link{l2boost}} function is an efficient implementation of a generic boosting method [Friedman (2001)] for
#' linear regression using an L2-loss function. The basis functions are the column vectors of the design matrix.
#' \code{\link{l2boost}} scales the design matrix such that the coordinate columns of the design correspond to the
#' gradient directions for each covariate. The boosting coefficients are equivalent to the gradient-correlation of each
Expand Down Expand Up @@ -76,7 +70,6 @@ l2boost <- function(x, ...)UseMethod("l2boost")
#' @references Zou H. and Hastie T (2005) "Regularization and variable selection via the elastic net" \emph{J. R. Statist. Soc. B}, 67, Part 2, pp. 301-320
#' @references Efron B., Hastie T., Johnstone I., and Tibshirani R. (2004). "Least Angle Regression" \emph{Ann. Statist.} 32:407-499
#'
#' @usage \method{l2boost}{default}(x, y, M, nu, lambda, trace, type, qr.tolerance, eps.tolerance, ...)
#'
#' @param x design matrix of dimension n x p
#' @param y response variable of length n
Expand Down Expand Up @@ -184,9 +177,12 @@ l2boost <- function(x, ...)UseMethod("l2boost")
#' main="elasticBoost nu=1.e-3, lambda=.1")
#' }
#'
#' @rdname l2boost
#' @name l2boost
#' @export l2boost.default
#' @aliases l2boost l2boost.default l2boost.formula
#'
#' @export
l2boost <- function(x, ...)UseMethod("l2boost")

#' @export
l2boost.default <- function(x, y,
M = NULL, nu = 1e-4, lambda = NULL, trace = FALSE,
type = c("discrete", "hybrid", "friedman","lars"),
Expand Down Expand Up @@ -473,7 +469,7 @@ l2boost.default <- function(x, y,
#'
#' @aliases l2boost.formula l2boost.default
#'
#' @export l2boost.formula
#' @export
l2boost.formula <- function(formula, data, ...){
mf <- model.frame(formula=formula, data=data)
x<- model.matrix(attr(mf, "terms"), data=mf)
Expand Down
3 changes: 1 addition & 2 deletions R/plot.l2boost.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@
#' # red points are selected in boosting algorithm.
#' plot(coef(cv.l2$fit, m=cv.l2$opt.step), col=clr, ylab=expression(beta))
#' }
#' @export plot.l2boost
#'
#' @export
plot.l2boost <- function(x,
type = c("rho", "coef"),
standardize = TRUE, active.set=NULL,
Expand Down
2 changes: 1 addition & 1 deletion R/predict.l2boost.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#' # Or used to predict new data, in this case a subset of training data
#' cbind(diabetes$y[1:5], predict(object, xnew=diabetes$x[1:5,])$yhat)
#'
#' @export predict.l2boost
#' @export
predict.l2boost <- function(object, xnew = NULL, type = c("fit", "coef"), newdata=xnew, ...) {
if(inherits(object,"cv")) object <- object$fit

Expand Down
2 changes: 1 addition & 1 deletion R/print.l2boost.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' # Similar at m=100
#' print(object, m=100)
#'
#' @export print.l2boost
#' @export
print.l2boost <- function(x, m = NULL, ...){
call<-match.call()

Expand Down
2 changes: 1 addition & 1 deletion R/residuals.l2boost.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#' lty=2, col="red", lwd=2)
#' abline(h=0, lty=2, col = 'gray')
#'
#' @export residuals.l2boost
#' @export
residuals.l2boost <- function(object, m=NULL, ...){
if(inherits(object, "cv")) object<- object$fit

Expand Down
8 changes: 4 additions & 4 deletions man/coef.l2boost.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/cv.l2boost.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/fitted.l2boost.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 12 additions & 14 deletions man/l2boost.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ea594a

Please sign in to comment.