Skip to content

Commit bc87233

Browse files
committed
0.4: Lots of internal updates to documentation, testing
1 parent f00a12b commit bc87233

31 files changed

+78
-83
lines changed

.Rbuildignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
3+
^inst/data$
4+
^\.lintr$
5+
^ex$

.Rprofile

-6
This file was deleted.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.Rproj.user
22
hdrm.Rproj
33
!R/sysdata.rda
4+
inst/data/*
5+
!inst/data/README

DESCRIPTION

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
Package: hdrm
22
Title: High-Dimensional Regression Modeling
3-
Date: 2023-01-11
4-
Version: 0.3.8
3+
Date: 2023-02-08
4+
Version: 0.4.0
55
Author: Patrick Breheny and Jian Huang
66
Maintainer: Patrick Breheny <patrick-breheny@uiowa.edu>
77
Description: Examples, simulations, and figures from the book, "High-Dimensional
88
Regression Modeling", by Breheny and Huang.
9-
Depends: glmnet, ncvreg
9+
Depends: R (>= 3.5.0), glmnet, ncvreg
1010
Imports: grpreg, Matrix
1111
Suggests: ggplot2, abind, gridExtra
12-
LazyData: TRUE
1312
BugReports: http://github.com/pbreheny/hdrm/issues
1413
License: GPL-3
1514
RoxygenNote: 7.2.3

R/gam-snr.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#'
1212
#' @return A list of two arrays, `MCP`, containing the MSE for MCP, and `SCAD`, containing the MSE for SCAD.
1313
#'
14-
#' @examples Ex3.1(N=10)
14+
#' @examples Ex3.1(N=2)
1515
#'
1616
#' @export
1717

@@ -50,7 +50,7 @@ Ex3.1 <- function(N=500, n=50, p=100, p1=6, SNR=c(1, 2, 4), seed=2) {
5050
#' @param parlist List of arguments to pass to `par()`
5151
#'
5252
#' @examples
53-
#' out <- Ex3.1(N=10)
53+
#' out <- Ex3.1(N=3)
5454
#' Fig3.5(out)
5555
#' @export
5656

R/hdrm.R

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
#' hdrm: High dimensional regression modeling, by Breheny and Huang
2-
#'
3-
#' @docType package
1+
#' @keywords internal
42
#'
53
#' @import stats
64
#' @import graphics
75
#' @import grDevices
86
#' @import utils
97
#' @import glmnet
108
#' @import ncvreg
11-
#'
9+
#'
1210
#' @importFrom Matrix bandSparse t
1311
#' @importFrom grpreg grpreg grpsurv cv.grpreg cv.grpsurv
14-
#'
15-
#' @name hdrm
16-
NULL
12+
"_PACKAGE"

R/mnet-sim-cor.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' @param rho Correlation between features (compound symmetric)
1111
#' @param seed Seed for reproducibility
1212
#'
13-
#' @examples Ex4.4(N=3)
13+
#' @examples Ex4.4(N=2, seq=c(0.3, 1))
1414
#' @export
1515

1616
Ex4.4 <- function(N=100, s=seq(0.1, 1.1, 0.2), n=100, p=500, p1=12, rho=0.7, seed=1) {

R/mnet-sim-ind.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' @param p1 Number of non-null features
1010
#' @param seed Seed for reproducibility
1111
#'
12-
#' @examples Ex4.3(N=10)
12+
#' @examples Ex4.3(N=2, seq=c(0.3, 1))
1313
#' @export
1414

1515
Ex4.3 <- function(N=100, s=seq(0.1, 1.1, 0.2), n=100, p=500, p1=12, seed=1) {
@@ -50,7 +50,7 @@ Ex4.3 <- function(N=100, s=seq(0.1, 1.1, 0.2), n=100, p=500, p1=12, seed=1) {
5050
#' @param parlist List of arguments to pass to `par()`
5151
#'
5252
#' @examples
53-
#' res <- Ex4.3(N=5, corr='cs')
53+
#' res <- Ex4.3(N=5)
5454
#' Fig4.2(res)
5555
#' @export
5656

R/ridge-gcv.R

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
#'
33
#' Reproduces Figure 1.5 from the book. If you specify any options, your results may look different.
44
#'
5+
#' @param lwd,xlim,ylim,xlab,ylab As in `plot()`
6+
#' @param ... Further arguments to `plot()`
7+
#'
58
#' @examples
69
#' Fig1.5()
7-
#'
810
#' @export
911

10-
Fig1.5 <- function() {
12+
Fig1.5 <- function(lwd=3, xlim=c(3,-3), ylim=c(50,250), xlab=expression(lambda), ylab="Prediction error", ...) {
1113
Data <- readData("pollution")
1214
XX <- std(Data$X)
1315
y <- Data$y
1416
fit <- ridge(XX, y)
1517
ll <- log10(fit$lambda)
1618
col <- pal(2)
17-
plot(ll, fit$GCV/1000, type="l", lwd=3, xlim=c(3,-3), las=1, xlab=expression(lambda), xaxt="n", ylab="Prediction error",
18-
col=col[2], bty="n", ylim=c(50,250))
19+
plot(ll, fit$GCV/1000, type="l", lwd=3, xlim=xlim, las=1, xlab=xlab, xaxt="n", ylab=ylab, ylim=ylim,
20+
col=col[2], bty="n")
1921
logAxis(1, base=10)
2022
lines(ll, fit$RSS/1000, col=col[1], lwd=3)
2123
text(-3.1, 105, "GCV", xpd=TRUE)

R/ridge.R

+6-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ ridge.matrix <- function (obj, y, lambda, ...) {
7777

7878
#' Plot a ridge regression coefficient path
7979
#'
80-
#' @param x a ridge
80+
#' @param x An object of class `"ridge"`, as returned by `ridge()`
81+
#' @param xaxis One of `"loglam"`, `"df"`, or `"both"`. If `"both"`, the
82+
#' bottom axis is lambda (log scale), and the top is df.
83+
#' @param xlab,ylab As in `plot()`
84+
#' @param ... Additional arguments to `matplot()`
8185
#'
8286
#' @export
8387

@@ -89,7 +93,7 @@ plot.ridge <- function(x, xaxis=c('loglam', 'df', 'both'), xlab, ylab, ...) {
8993
ll <- log10(x$lambda)
9094
if (missing(xlab)) xlab <- expression(lambda)
9195
matplot(ll, B, lty=1, col=col, type="l", lwd=3, xaxt="n",
92-
xlab=xlab, ylab="", las=1, xlim=rev(range(ll)), bty="n")
96+
xlab=xlab, ylab="", las=1, xlim=rev(range(ll)), bty="n", ...)
9397
logAxis(1, base=10)
9498
} else if (xaxis=='df') {
9599
matplot(x$df, B, lty=1, col=col, type="l", lwd=3,

R/split-tcga.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @param seed Random seed for reproducibility
77
#'
88
#' @examples
9-
#' p <- Ex9.2(N=10)
9+
#' p <- Ex9.2(N=5)
1010
#' head(sort(p))
1111
#'
1212
#' @export

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![GitHub version](https://img.shields.io/static/v1?label=GitHub&message=0.3.8&color=blue&logo=github)](https://github.com/pbreheny/hdrm)
1+
[![GitHub version](https://img.shields.io/static/v1?label=GitHub&message=0.4.0&color=blue&logo=github)](https://github.com/pbreheny/hdrm)
22

33
# hdrm: High dimensional regression modeling
44

inst/tests/1.R

-16
This file was deleted.

inst/tests/6.R

-13
This file was deleted.

inst/tests/9.R

-9
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

man/Ex3.1.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/Ex4.3.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/Ex4.4.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/Ex9.2.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/Fig1.5.Rd

+13-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/Fig3.5.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/Fig4.2.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/hdrm-package.Rd

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/hdrm.Rd

-6
This file was deleted.

man/plot.ridge.Rd

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test.R

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (requireNamespace("tinytest", quietly=TRUE)) {
2+
tinytest::test_package("hdrm", pattern="^[^_].*\\.[rR]$")
3+
}

0 commit comments

Comments
 (0)