Skip to content

Commit 41a4890

Browse files
authored
Merge pull request #10 from pachadotdev/issue8
reorganize srr comments
2 parents 3aa24f6 + af00f0d commit 41a4890

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+438
-7594
lines changed

R/apes.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#' \strong{Remark:} The routine currently does not allow to compute average
1212
#' partial effects based on functional forms like interactions and polynomials.
1313
#'
14+
#' @srrstats {G2.3} *For univariate character input:*
15+
#' @srrstats {G2.3a} *Use `match.arg()` or equivalent where applicable to only permit expected values.*
16+
#' @srrstats {G2.3b} *Either: use `tolower()` or equivalent to ensure input of character parameters is not case dependent; or explicitly document that parameters are strictly case-sensitive.*
17+
#'
1418
#' @param object an object of class \code{"bias_corr"} or \code{"feglm"};
1519
#' currently restricted to \code{\link[stats]{binomial}}.
1620
#' @param n_pop unsigned integer indicating a finite population correction for
@@ -43,6 +47,8 @@
4347
#' @return The function \code{\link{apes}} returns a named list of class
4448
#' \code{"apes"}.
4549
#'
50+
#' @srrstats {G1.0} *Statistical Software should list at least one primary reference from published academic literature.*
51+
#'
4652
#' @references Cruz-Gonzalez, M., I. Fernández-Val, and M. Weidner (2017). "Bias
4753
#' corrections for probit and logit models with two-way fixed effects". The
4854
#' Stata Journal, 17(3), 517-545.

R/apes_bias_helpers.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#' @title Checks if the object is an `feglm` object
2+
#' @description Internal check
3+
#' @param object Object to check
4+
#' @param fun Function name (e.g., "apes")
5+
#' @srrstats {G1.4a} *All internal (non-exported) functions should also be documented in standard [`roxygen2`](https://roxygen2.r-lib.org/) format, along with a final `@noRd` tag to suppress automatic generation of `.Rd` files.*
6+
#' @noRd
17
apes_bias_check_object_ <- function(object, fun) {
28
if (is.null(object)) {
39
stop("'object' has to be specified.", call. = FALSE)
@@ -12,6 +18,12 @@ apes_bias_check_object_ <- function(object, fun) {
1218
}
1319
}
1420

21+
#' @title Checks if the `feglm` object is a binary choice model
22+
#' @description Internal check
23+
#' @param object Object to check
24+
#' @param fun Function name (e.g., "apes")
25+
#' @srrstats {G1.4a} *All internal (non-exported) functions should also be documented in standard [`roxygen2`](https://roxygen2.r-lib.org/) format, along with a final `@noRd` tag to suppress automatic generation of `.Rd` files.*
26+
#' @noRd
1527
apes_bias_check_binary_model_ <- function(family, fun) {
1628
if (family[["family"]] != "binomial") {
1729
stop(
@@ -21,6 +33,12 @@ apes_bias_check_binary_model_ <- function(family, fun) {
2133
}
2234
}
2335

36+
#' @title Checks if the panel structure string is valid
37+
#' @description Internal check
38+
#' @param panel_structure Object to check
39+
#' @param k Number of fixed effects
40+
#' @srrstats {G1.4a} *All internal (non-exported) functions should also be documented in standard [`roxygen2`](https://roxygen2.r-lib.org/) format, along with a final `@noRd` tag to suppress automatic generation of `.Rd` files.*
41+
#' @noRd
2442
apes_bias_check_panel_ <- function(panel_structure, k) {
2543
if (panel_structure == "classic") {
2644
if (!(k %in% c(1L, 2L))) {

R/bias_corr.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#' currently restricted to \code{\link[stats]{binomial}} with 1,2,3-way fixed
99
#' effects.
1010
#'
11+
#' @srrstats {G2.3} *For univariate character input:*
12+
#' @srrstats {G2.3a} *Use `match.arg()` or equivalent where applicable to only permit expected values.*
13+
#' @srrstats {G2.3b} *Either: use `tolower()` or equivalent to ensure input of character parameters is not case dependent; or explicitly document that parameters are strictly case-sensitive.*
14+
#'
1115
#' @param object an object of class \code{"feglm"}.
1216
#' @param l unsigned integer indicating a bandwidth for the estimation of
1317
#' spectral densities proposed by Hahn and Kuersteiner (2011). The default is
@@ -25,6 +29,8 @@
2529
#'
2630
#' @return A named list of classes \code{"bias_corr"} and \code{"feglm"}.
2731
#'
32+
#' @srrstats {G1.0} *Statistical Software should list at least one primary reference from published academic literature.*
33+
#'
2834
#' @references Czarnowske, D. and A. Stammann (2020). "Fixed Effects Binary
2935
#' Choice Models: Estimation and Inference with Long Panels". ArXiv e-prints.
3036
#' @references Fernández-Val, I. and M. Weidner (2016). "Individual and time

R/capybara-package.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#' @title Generalized Linear Models (GLMs) with high-dimensional k-way fixed
22
#' effects
33
#'
4+
#' @srrstats {G1.1} *Statistical Software should document whether the algorithm(s) it implements are:* - *The first implementation of a novel algorithm*; or - *The first implementation within **R** of an algorithm which has previously been implemented in other languages or contexts*; or - *An improvement on other implementations of similar algorithms in **R***.
5+
#' @srrstats {G1.2} *Statistical Software should include a* Life Cycle Statement *describing current and anticipated future states of development.*
6+
#' @srrstats {G1.4} *Software should use [`roxygen2`](https://roxygen2.r-lib.org/) to document all functions.*
7+
#'
48
#' @description
59
#' Provides a routine to partial out factors with many levels during the
610
#' optimization of the log-likelihood function of the corresponding GLM. The
@@ -9,7 +13,11 @@
913
#' post-estimation routine and includes robust and multi-way clustered standard
1014
#' errors. Further the package provides analytical bias corrections for binary
1115
#' choice models derived by Fernández-Val and Weidner (2016) and Hinz, Stammann,
12-
#' and Wanner (2020).
16+
#' and Wanner (2020). This package is a ground up rewrite with multiple
17+
#' refactors, optimizations, and new features compared to the original package
18+
#' `alpaca`. In its current state, the package is stable and future changes will
19+
#' be limited to bug fixes and improvements, but not to altering the functions'
20+
#' arguments or outputs.
1321
#'
1422
#' @name capybara-package
1523
#' @importFrom dplyr across all_of filter group_by mutate pull select summarise

R/feglm.R

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
#' \strong{Remark:} The term fixed effect is used in econometrician's sense of
99
#' having intercepts for each level in each category.
1010
#'
11+
#' @srrstats {G2.3} *For univariate character input:*
12+
#' @srrstats {G2.3a} *Use `match.arg()` or equivalent where applicable to only permit expected values.*
13+
#' @srrstats {G2.3b} *Either: use `tolower()` or equivalent to ensure input of character parameters is not case dependent; or explicitly document that parameters are strictly case-sensitive.*
14+
#' @srrstats {RE4.4} *The specification of the model, generally as a formula (via `formula()`)*
15+
#' @srrstats {RE1.0} *Regression Software should enable models to be specified via a formula interface, unless reasons for not doing so are explicitly documented.*
16+
#' @srrstats {RE1.1} *Regression Software should document how formula interfaces are converted to matrix representations of input data.*
17+
#' @srrstats {RE1.2} *Regression Software should document expected format (types or classes) for inputting predictor variables, including descriptions of types or classes which are not accepted.*
18+
#' @srrstats {RE1.3} *Regression Software which passes or otherwise transforms aspects of input data onto output structures should ensure that those output structures retain all relevant aspects of input data, notably including row and column names, and potentially information from other `attributes()`.*
19+
#' @srrstats {RE1.3a} *Where otherwise relevant information is not transferred, this should be explicitly documented.*
20+
#' @srrstats {RE1.4} *Regression Software should document any assumptions made with regard to input data; for example distributional assumptions, or assumptions that predictor data have mean values of zero. Implications of violations of these assumptions should be both documented and tested.*
21+
#' @srrstats {RE2.3} *Where applicable, Regression Software should enable data to be centred (for example, through converting to zero-mean equivalent values; or to z-scores) or offset (for example, to zero-intercept equivalent values) via additional parameters, with the effects of any such parameters clearly documented and tested.*
22+
#' @srrstats {RE3.0} *Issue appropriate warnings or other diagnostic messages for models which fail to converge.*
23+
#' @srrstats {RE3.1} *Enable such messages to be optionally suppressed, yet should ensure that the resultant model object nevertheless includes sufficient data to identify lack of convergence.*
24+
#' @srrstats {RE3.2} *Ensure that convergence thresholds have sensible default values, demonstrated through explicit documentation.*
25+
#' @srrstats {RE3.3} *Allow explicit setting of convergence thresholds, unless reasons against doing so are explicitly documented.*
26+
#'
1127
#' @param formula an object of class \code{"formula"}: a symbolic description of
1228
#' the model to be fitted. \code{formula} must be of type \code{y ~ x | k},
1329
#' where the second part of the formula refers to factors to be concentrated
@@ -36,6 +52,9 @@
3652
#' category. In this case, you should carefully inspect your model
3753
#' specification.
3854
#'
55+
#' @srrstats {G1.3} *All statistical terminology should be clarified and unambiguously defined.*
56+
#' @srrstats {RE4.0} *Regression Software should return some form of "model" object, generally through using or modifying existing class structures for model objects (such as `lm`, `glm`, or model objects from other packages), or creating a new class of model objects.*
57+
#'
3958
#' @return A named list of class \code{"feglm"}. The list contains the following
4059
#' fifteen elements:
4160
#' \item{coefficients}{a named vector of the estimated coefficients}
@@ -57,6 +76,8 @@
5776
#' \item{family}{the family used in the model}
5877
#' \item{control}{the control list used in the model}
5978
#'
79+
#' @srrstats {G1.0} *Statistical Software should list at least one primary reference from published academic literature.*
80+
#'
6081
#' @references Gaure, S. (2013). "OLS with Multiple High Dimensional Category
6182
#' Variables". Computational Statistics and Data Analysis, 66.
6283
#' @references Marschner, I. (2011). "glm2: Fitting generalized linear models

0 commit comments

Comments
 (0)