Skip to content

Commit 6d9ca18

Browse files
committed
Fix submission comments
1 parent 430ec2a commit 6d9ca18

14 files changed

+79
-26
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Description: Natural strata fix a constant ratio of controls to treated units wi
99
each stratum. This ratio need not be an integer. The control units are
1010
chosen using randomized rounding of a linear program that balances many
1111
covariates.
12-
To solve the linear program, the Gurobi commercial optimization software
13-
is recommended, but not required. The gurobi R package can be installed following the instructions
12+
To solve the linear program, the 'Gurobi' commercial optimization software
13+
is recommended, but not required. The 'gurobi' R package can be installed following the instructions
1414
at <https://www.gurobi.com/documentation/9.1/refman/ins_the_r_package.html>.
1515
URL: https://github.com/kkbrum/natstrat, https://kkbrum.github.io/natstrat/, https://www.gurobi.com/documentation/9.1/refman/ins_the_r_package.html
1616
BugReports: https://github.com/kkbrum/natstrat/issues

R/balance_LP.R

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,22 @@
88
#' @param st_vals the unique stratum levels contained in \code{st}.
99
#' @param S the number of unique stratum levels contained in \code{st}.
1010
#' @param N the total number of available controls in the data.
11+
#'
12+
#' @return A list containing two elements:
13+
#' \describe{
14+
#' \item{\code{lpdetails}}{The output of either \code{gurobi()} or \code{\link[Rglpk]{Rglpk_solve_LP}()},
15+
#' except that if \code{gurobi()} is used, the elements \code{objval} and \code{x}
16+
#' are renamed \code{optimum} and \code{solution}
17+
#' to be consistent with the output of \code{\link[Rglpk]{Rglpk_solve_LP}()}.}
18+
#' \item{\code{o}}{The original output of either \code{gurobi()} or \code{\link[Rglpk]{Rglpk_solve_LP}()}.}
19+
#' }
20+
#'
1121
#' @keywords internal
1222

1323
balance_LP <- function(z, X, importances, st, st_vals, S, q_s, N,
1424
solver, integer, time_limit) {
1525
if (solver == "gurobi" && !requireNamespace("gurobi", quietly = TRUE)) {
16-
stop("Package \"gurobi\" needed if \"solver\" parameter set to \"gurobi\". Please
26+
stop("Package \'gurobi\' needed if \"solver\" parameter set to \"gurobi\". Please
1727
install it or switch the \"solver\" parameter to \"Rglpk\".",
1828
call. = FALSE)
1929
}

R/generate_qs.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ generate_qs <- function(z, st, ratio = NULL,
105105

106106
#' Verify the inputs to the earthmover's distance problem
107107
#'
108-
#' Check that the ratio, strata, and treated indicator provided
108+
#' Check that the ratio, strata, and treated indicator provided to \code{\link{generate_qs}()}
109109
#' are in the correct forms and that the desired ratio is feasible
110110
#' across the population.
111111
#'
112112
#' @inheritParams generate_qs
113+
#'
114+
#' @return No return value. If there is a problem with the inputs to \code{\link{generate_qs}()},
115+
#' an error is raised.
116+
#'
113117
#' @keywords internal
114118

115119

R/natstrat-package.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#' each stratum. This ratio need not be an integer. The control units are
44
#' chosen using randomized rounding of a linear program that balances many
55
#' covariates.
6-
#' To solve the linear program, the Gurobi commercial optimization software
7-
#' is recommended, but not required. The gurobi R package can be installed following
6+
#' To solve the linear program, the 'Gurobi' commercial optimization software
7+
#' is recommended, but not required. The 'gurobi' R package can be installed following
88
#' the instructions \href{https://www.gurobi.com/documentation/9.1/refman/ins_the_r_package.html}{here}.
99
#'
1010
#' @details

R/optimize_controls.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#' @param integer a logical stating whether to use a mixed integer programming solver
2424
#' instead of randomized rounding. Default is \code{FALSE}.
2525
#' @param solver a character stating which solver to use to run the linear program.
26-
#' Options are "Rglpk" (default) or "gurobi". You must have gurobi installed to use "gurobi".
27-
#' If gurobi is available, this is the recommended solver.
26+
#' Options are "Rglpk" (default) or "gurobi". You must have the 'gurobi' package
27+
#' installed to use the "gurobi" option. If available, this is the recommended solver.
2828
#' @param seed the seed to use when doing the randomized rounding of the linear program.
2929
#' This will allow results to be reproduced if desired. The default is \code{NULL},
3030
#' which will choose a random seed to use and return.
@@ -67,7 +67,7 @@
6767
#' not scaled by constraint importances.}
6868
#' }}
6969
#' \item{\code{lpdetails}}{the full return of the function \code{\link[Rglpk]{Rglpk_solve_LP}()}
70-
#' or gurobi plus information about the epsilons and objective values
70+
#' or \code{gurobi()} plus information about the epsilons and objective values
7171
#' for the linear program solution.}
7272
#' }
7373
#'
@@ -280,12 +280,16 @@ optimize_controls <- function(z, X, st, importances = NULL,
280280
}
281281
}
282282

283-
#' Verify the inputs to \code{\link{optimize_controls}}
283+
#' Verify the inputs to \code{\link{optimize_controls}()}
284284
#'
285-
#' Makes sure that the inputs to \code{\link{optimize_controls}} are in the correct
285+
#' Makes sure that the inputs to \code{\link{optimize_controls}()} are in the correct
286286
#' format and feasible.
287287
#'
288288
#' @inheritParams optimize_controls
289+
#'
290+
#' @return No return value. If there is a problem with the inputs to \code{\link{optimize_controls}()},
291+
#' an error is raised.
292+
#'
289293
#' @keywords internal
290294

291295
verify_inputs <- function(X, importances, ratio, q_s, st, z, integer, solver) {
@@ -305,7 +309,7 @@ verify_inputs <- function(X, importances, ratio, q_s, st, z, integer, solver) {
305309
call. = FALSE)
306310
}
307311
if (solver == "gurobi" && !requireNamespace("gurobi", quietly = TRUE)) {
308-
stop("Package \"gurobi\" needed if \"solver\" parameter set to \"gurobi\". Please
312+
stop("Package \'gurobi\' needed if \"solver\" parameter set to \"gurobi\". Please
309313
install it or switch the \"solver\" parameter to \"Rglpk\".",
310314
call. = FALSE)
311315
}

R/presolve_EMD.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#' @param max_s a vector containing the maximum number of controls that should
1111
#' be selected in each stratum. The order of the strata should match that of \code{desired_qs}.
1212
#' @param strata_dist_flat a flattened distance matrix between the strata.
13+
#'
14+
#' @return A named vector with names identical to those of \code{desired_qs} and
15+
#' elements containing the number of controls to select from the given stratum.
16+
#'
1317
#' @keywords internal
1418

1519
presolve_EMD <- function(S, desired_qs, max_s, strata_dist_flat) {

cran-comments.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## Resubmission
2+
This is a resubmission. In this version I have:
3+
4+
* Written all package names and software names in single quotes.
5+
6+
* I did not add references describing the methods in my package as they are not available yet.
7+
8+
* Return values are described in the documentation for balance_LP(), presolve_EMD(), verify_inputs_EMD(), and verify_inputs().
9+
110
## Test environments
211
* local windows install, R 4.0.3
312
* ubuntu-20.04 release (on github actions)

man/balance_LP.Rd

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/natstrat-package.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/optimize_controls.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)