From ea6152fa5df0ca9e794d3ed1d196802ff7d48667 Mon Sep 17 00:00:00 2001 From: Ioannis Kosmidis Date: Wed, 8 Feb 2023 12:53:07 +0000 Subject: [PATCH 1/7] Bumb to development version --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4035eb1..2522b27 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: brglm2 Title: Bias Reduction in Generalized Linear Models -Version: 0.9.1 +Version: 0.9.999 Authors@R: c(person(given = "Ioannis", family = "Kosmidis", role = c("aut", "cre"), email = "ioannis.kosmidis@warwick.ac.uk", comment = c(ORCID = "0000-0003-1556-0302")), person(given = c("Euloge", "Clovis"), family = c("Kenne Pagui"), role = "aut", email = "kenne@stat.unipd.it"), person(given = "Kjell", family = "Konis", role = "ctb", email = "kjell.konis@me.com"), diff --git a/NEWS.md b/NEWS.md index 3bb871b..4ee691a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# brglm2 0.9.999 + # brglm2 0.9.1 ## Other improvements, updates and additions From f19a1c9a370418d43f8ef7723ddce80a62ee2949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Staffan=20Betn=C3=A9r?= Date: Tue, 29 Aug 2023 15:53:25 +0200 Subject: [PATCH 2/7] Small typo corrected --- vignettes/iteration.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/iteration.Rmd b/vignettes/iteration.Rmd index 143ff2a..c243373 100755 --- a/vignettes/iteration.Rmd +++ b/vignettes/iteration.Rmd @@ -144,7 +144,7 @@ The results in @kosmidis:2019 can be used to show that if \end{align*} then the solution of the adjusted score equations $s_\beta + A_\beta = 0_p$ and $s_\phi + A_\phi = 0$ results in estimators $\tilde\beta$ with mean bias of small asymptotic order than the maximum likelihood estimator and $\tilde\phi$ with median bias of smaller asymptotic order than the maximum likelihood estimator. -### Maximum penalized likelihood with powers of Jefreys prior as penalty +### Maximum penalized likelihood with powers of Jeffreys prior as penalty The likelihood penalized by a power of the Jeffreys prior \[ |i_{\beta\beta}|^a |i_{\phi\phi}|^a \quad a > 0 From bdc4ced5b20274c0635e8f324d8fdf4bd0394961 Mon Sep 17 00:00:00 2001 From: Ioannis Kosmidis Date: Thu, 5 Oct 2023 11:49:36 +0100 Subject: [PATCH 3/7] Updates on convergence criteria + code base + docs + argument checks --- NEWS.md | 54 ++++++++++++++++------------- R/brglm2-package.R | 1 + R/brglmControl.R | 5 +++ R/brglmFit.R | 41 ++++++++++++---------- inst/tinytest/test-binomial.R | 2 +- inst/tinytest/test-bracl.R | 8 ++--- inst/tinytest/test-jeffreys.R | 2 +- inst/tinytest/test-transformation.R | 2 +- man/brglm2.Rd | 1 + 9 files changed, 66 insertions(+), 50 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4ee691a..31e9e89 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,16 @@ -# brglm2 0.9.999 +# brglm2 0.9.2 + +## Improvements, updates and additions + +* Convergence of the `brglm_fit` iterations is now determined if the L^Inf norm of the step size (rather than the L^1 as it was previously) of the quasi-Fisher scoring procedure is less than `epsilon` (see `?brglm_control` for the definition of `epsilon`). This is more natural as `epsilon` then determines directly the precision of the reported estimates and does not depend on their number. + +* `brglm_control()` now checks that the supplied value of `max_step_factor` is numeric and greater or equal to `1`. If not, then it is set to the default value of `12`. + + # brglm2 0.9.1 -## Other improvements, updates and additions +## Improvements, updates and additions * Added the `enzymes` and `hepatitis` data sets (from the [*pmlr*](https://cran.r-project.org/package=pmlr)) to support examples and tests. @@ -16,7 +24,7 @@ * Fixed a bug where the dispersion in the resulting object would not be transformed even if `transformation != "identity"` when `type` is `ML` or `AS_median` or `AS_mixed`. -## Other improvements, updates and additions +## Improvements, updates and additions * Moved unit tests to [**tinytest**](https://cran.r-project.org/package=tinytest). @@ -28,7 +36,7 @@ # brglm2 0.8.2 -## Other improvements, updates and additions +## Improvements, updates and additions * Housekeeping. * Removed lpSolveAPI from imports. @@ -39,7 +47,7 @@ * Fixed a bug when predicting from `bracl` objects with non-identifiable parameters. -## Other improvements, updates and additions +## Improvements, updates and additions * Work on output consistently from `print()` methods for `summary.XYZ` objects; estimator type is now printed and other fixes. @@ -74,7 +82,7 @@ * `brglmFit()` iteration returns last estimates that worked if iteration fails. -## Other improvements, updates and additions +## Improvements, updates and additions * Documentation and example updates. @@ -94,7 +102,7 @@ (`check_aliasing = FALSE`) rank deficiency checks (through a QR decomposition of the model matrix), saving some computational effort. -## Other improvements, updates and additions +## Improvements, updates and additions * updated DOI links in documentation and some http -> https fixes. # brglm2 0.7.0 @@ -106,7 +114,7 @@ ## New functionality * `confint` method for `brmulitnom` objects -## Other improvements, updates and additions +## Improvements, updates and additions * Updated reference to [Kenne Pagui et al (2017)](https://doi.org/10.1093/biomet/asx046).q * Updated reference to [Kosmidis and Firth (2020)](https://doi.org/10.1093/biomet/asaa052). * Fixed issues with references. @@ -114,7 +122,7 @@ # brglm2 0.6.2 -## Other improvements, updates and additions +## Improvements, updates and additions * `vcov.brglmFit()` now uses `vcov.summary.glm()` and supports the `complete` argument for controlling whether the variance covariance matrix should include rows and columns for aliased parameters. @@ -132,7 +140,7 @@ `bracl` objects. * `detect_separation()` now handles one-column model matrices correctly. -## Other improvements, updates and additions +## Improvements, updates and additions * Documentation improvements and typo fixes. # brglm2 0.6 @@ -142,7 +150,7 @@ supported generalized linear models. See the help files of `brglmControl()` and `brglmFit()` for details. -## Other improvements, updates and additions +## Improvements, updates and additions * Documentation updates and improvements. * Updated vignettes to include maximum penalized likelihood with powers of the Jeffreys prior as penalty. @@ -158,14 +166,14 @@ for more fine-tuning of the starting values when `brglmFit()` is called with `start = NULL`. -## Other improvements, updates and additions +## Improvements, updates and additions * Documentation updates and improvements. * Added Kosmidis et al (2019) in the description file. * Added tests for `brglmControl()`. # brglm2 0.5.1 -## Other improvements, updates and additions +## Improvements, updates and additions * Fixed typos in vignettes and documentation. * Added ORCHID for Ioannis Kosmidis in DESCRIPTION. @@ -193,7 +201,7 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects misclassification in binomial response models (Neuhaus, 1999, Biometrika). -## Other improvements, updates and additions +## Improvements, updates and additions * Improved `summary()` method for `brmultinom` objects. * Better starting values for null fits. * Added references to [arxiv:1804.04085](https://arxiv.org/abs/1804.04085) in @@ -201,7 +209,7 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects * Updated reference to [Kenne Pagui et al (2017)](https://doi.org/10.1093/biomet/asx046). # brglm2 0.1.8 -## Other improvements, updates and additions +## Improvements, updates and additions * Improved documentation examples. * Removed warning about observations with non-positive weights from brmultinom. * Updated email address for Ioannis Kosmidis in brglmFit. @@ -214,7 +222,7 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects # brglm2 0.1.7 -## Other improvements, updates and additions +## Improvements, updates and additions * Eliminated errors from markdown chunks in multinomial vignette. # brglm2 0.1.6 @@ -222,7 +230,7 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects ## Bug fixes * Compatibility with new version of enrichwith. -## Other improvements, updates and additions +## Improvements, updates and additions * New email for Ioannis Kosmidis. # brglm2 0.1.5 @@ -239,7 +247,7 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects `detect_separation()` methods in line with the update of `glm.fit()`. -## Other improvements, updates and additions +## Improvements, updates and additions * less strict tolerance in `brglm_control()`. * Updates to help files. * Fixed typos in iteration vignette. @@ -265,7 +273,7 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects `detectSeparationControl()`, `detect_separation_control()`, `checkInfiniteEstimates()`, `check_infinite_estimates()`). -## Other improvements, updates and additions +## Improvements, updates and additions * Minor enhancements in the codebase. * The inverse expected information matrix is computed internally using `cho2inv()`. @@ -274,12 +282,8 @@ Added `residuals()` methods for `brmultinom` and `bracl` objects # brglm2 0.1.3 -## Bug fixes - -## New functionality - -## Other improvements, updates and additions -* Fixed typo in f_{Y_i}(y) in iteration vignette (thanks to Eugene +## Improvements, updates and additions +* Fixed typo in $f_{Y_i}(y)$ in iteration vignette (thanks to Eugene Clovis Kenne Pagui for spotting), # brglm2 0.1.2 diff --git a/R/brglm2-package.R b/R/brglm2-package.R index ee23ba0..025a599 100644 --- a/R/brglm2-package.R +++ b/R/brglm2-package.R @@ -96,6 +96,7 @@ #' 185-196. \doi{10.1002/wics.1296}. #' #' @docType package +#' @aliases brglm2-package #' @name brglm2 #' @import stats #' @import enrichwith diff --git a/R/brglmControl.R b/R/brglmControl.R index 8401574..9503412 100644 --- a/R/brglmControl.R +++ b/R/brglmControl.R @@ -201,6 +201,11 @@ brglmControl <- function(epsilon = 1e-06, maxit = 100, } if (!is.numeric(epsilon) || epsilon <= 0) stop("value of 'epsilon' must be > 0") + + if (!is.numeric(max_step_factor) || max_step_factor < 1) { + warning("`max_step_factor = ", deparse(max_step_factor), "` is not a permissible value. Defaulting to 12") + max_step_factor <- 12 + } list(epsilon = epsilon, maxit = maxit, trace = trace, check_aliasing = check_aliasing, response_adjustment = response_adjustment, diff --git a/R/brglmFit.R b/R/brglmFit.R index f36ffeb..3ab1284 100644 --- a/R/brglmFit.R +++ b/R/brglmFit.R @@ -876,29 +876,35 @@ brglmFit <- function(x, y, weights = rep(1, nobs), start = NULL, etastart = NULL for (iter in seq.int(control$maxit)) { step_factor <- 0 testhalf <- TRUE + ## Inner iteration while (testhalf & step_factor < control$max_step_factor) { ## store previous values - betas0 <- betas; dispersion0 <- dispersion + ## betas0 <- betas + ## dispersion0 <- dispersion step_beta_previous <- step_beta step_zeta_previous <- step_zeta + ## Update betas betas <- betas + slowit * 2^(-step_factor) * step_beta + ## Update zetas if (!no_dispersion & df_residual > 0) { transformed_dispersion <- eval(control$Trans) transformed_dispersion <- transformed_dispersion + 2^(-step_factor) * step_zeta dispersion <- eval(control$inverseTrans) } + ## Compute key quantities theta <- c(betas, dispersion) transformed_dispersion <- eval(control$Trans) - ## Mean quantities + ## Mean quantities quantities <- try(key_quantities(theta, y = y, level = 2 * !no_dispersion, scale_totals = has_fixed_totals, qr = TRUE), silent = TRUE) ## This is to capture qr failing and revering to previous estimates if (failed_adjustment_beta <- inherits(quantities, "try-error")) { - betas <- betas0; dispersion <- dispersion0 + ## betas <- betas0 + ## dispersion <- dispersion0 warning("failed to calculate score adjustment") break } @@ -912,10 +918,9 @@ brglmFit <- function(x, y, weights = rep(1, nobs), start = NULL, etastart = NULL warning("failed to calculate score adjustment") break } - adjusted_grad_beta <- with(step_components_beta, { - grad + adjustment - }) + adjusted_grad_beta <- with(step_components_beta, grad + adjustment) step_beta <- drop(step_components_beta$inverse_info %*% adjusted_grad_beta) + ## Dispersion quantities if (no_dispersion) { adjusted_grad_zeta <- step_zeta <- NA_real_ @@ -929,28 +934,28 @@ brglmFit <- function(x, y, weights = rep(1, nobs), start = NULL, etastart = NULL warning("failed to calculate score adjustment") break } - adjusted_grad_zeta <- with(step_components_zeta, { - grad + adjustment - }) + adjusted_grad_zeta <- with(step_components_zeta, grad + adjustment) step_zeta <- as.vector(adjusted_grad_zeta * step_components_zeta$inverse_info) } + + ## Convergence criteria + linf_current <- max(abs(c(step_beta, step_zeta)), na.rm = TRUE) + linf_previous <- max(abs(c(step_beta_previous, step_zeta_previous)), na.rm = TRUE) + testhalf <- linf_current > linf_previous + ## Continue inner loop - if (step_factor == 0 & iter == 1) { - testhalf <- TRUE - } else { - s2 <- c(abs(step_beta), abs(step_zeta)) - s1 <- c(abs(step_beta_previous), abs(step_zeta_previous)) - testhalf <- sum(s2, na.rm = TRUE) > sum(s1, na.rm = TRUE) - } + ## if (step_factor == 0 & iter == 1) { + ## testhalf <- TRUE + ## } step_factor <- step_factor + 1 + ## Trace here if (control$trace) { - trace_iteration() } } failed <- failed_adjustment_beta | failed_inversion_beta | failed_adjustment_zeta | failed_inversion_zeta - if (failed | sum(abs(c(step_beta, step_zeta)), na.rm = TRUE) < control$epsilon) { + if (failed | linf_current < control$epsilon) { break } } diff --git a/inst/tinytest/test-binomial.R b/inst/tinytest/test-binomial.R index 7197c01..602e683 100644 --- a/inst/tinytest/test-binomial.R +++ b/inst/tinytest/test-binomial.R @@ -2,7 +2,7 @@ library("brglm") data("lizards", package = "brglm2") links <- lapply(c("logit", "probit", "cloglog", "cauchit"), make.link) -tol <- 1e-10 +tol <- 1e-08 for (l in seq_along(links)) { expect_warning( lizardsBRlegacy <- brglm(cbind(grahami, opalinus) ~ height + diameter + diff --git a/inst/tinytest/test-bracl.R b/inst/tinytest/test-bracl.R index 936cf74..7712a96 100644 --- a/inst/tinytest/test-bracl.R +++ b/inst/tinytest/test-bracl.R @@ -85,8 +85,8 @@ s2p <- summary(fit_vgam_p) tol <- 1e-06 ## summary method for bracl returns the correct coef mat -expect_equal(coef(s1), coef(s2), tolerance = tol, check.attributes = FALSE) -expect_equal(coef(s1p), coef(s2p), tolerance = tol, check.attributes = FALSE) +expect_equal(coef(s1), s2@coef3, tolerance = tol, check.attributes = FALSE) +expect_equal(coef(s1p), s2p@coef3, tolerance = tol, check.attributes = FALSE) newdata <- expand.grid(gender = c("male", "female"), religion = c("moderate", "fundamentalist")) ## predict.bracl works as expected @@ -94,10 +94,10 @@ pp <- predict(fit_bracl_p, newdata = stemcell, type = "probs") p <- predict(fit_bracl, newdata = stemcell, type = "probs") expect_equal(predict(fit_vgam_p, type = "response"), pp[19:24, ], - tolerance = 1e-08, check.attributes = FALSE) + tolerance = 1e-06, check.attributes = FALSE) expect_equal(predict(fit_vgam, type = "response"), p[19:24, ], - tolerance = 1e-08, check.attributes = FALSE) + tolerance = 1e-06, check.attributes = FALSE) ## no intercept returns warning expect_warning( diff --git a/inst/tinytest/test-jeffreys.R b/inst/tinytest/test-jeffreys.R index 8faeae7..7205c95 100644 --- a/inst/tinytest/test-jeffreys.R +++ b/inst/tinytest/test-jeffreys.R @@ -41,7 +41,7 @@ data("lizards", package = "brglm2") links <- lapply(c("logit", "probit", "cloglog", "cauchit"), make.link) -tol <- 1e-10 +tol <- 1e-08 for (l in seq_along(links)) { expect_warning( lizardsBRlegacy <- brglm(cbind(grahami, opalinus) ~ height + diameter + diff --git a/inst/tinytest/test-transformation.R b/inst/tinytest/test-transformation.R index 096c0f1..b5cff7a 100644 --- a/inst/tinytest/test-transformation.R +++ b/inst/tinytest/test-transformation.R @@ -24,7 +24,7 @@ c_sqrt[5] <- c_sqrt[5]^2 c_inverse <- coef(mod_inverse, model = "full") c_inverse[5] <- 1/c_inverse[5] -tol <- sqrt(.Machine$double.eps) +tol <- 1e-08 ## ML estimate of gamma dispersion from brglmFit is invariant to trasnformation expect_equal(c_identity, c_log, tolerance = tol, check.attributes = FALSE) expect_equal(c_identity, c_sqrt, tolerance = tol, check.attributes = FALSE) diff --git a/man/brglm2.Rd b/man/brglm2.Rd index bf2f5cb..3f7191f 100644 --- a/man/brglm2.Rd +++ b/man/brglm2.Rd @@ -3,6 +3,7 @@ \docType{package} \name{brglm2} \alias{brglm2} +\alias{brglm2-package} \title{brglm2: Bias Reduction in Generalized Linear Models} \description{ Estimation and inference from generalized linear models using From dfd9c38fdf90f5652f316550a9a7a00a856427d0 Mon Sep 17 00:00:00 2001 From: Ioannis Kosmidis Date: Thu, 5 Oct 2023 12:23:33 +0100 Subject: [PATCH 4/7] Vignette and example updates --- .Rbuildignore | 2 ++ .gitignore | 4 +++- NEWS.md | 1 + R/brglmFit.R | 1 + R/brmultinom.R | 2 +- man/brmultinom.Rd | 2 +- vignettes/adjacent.Rmd | 2 +- vignettes/iteration.Rmd | 8 ++++---- vignettes/multinomial.Rmd | 4 ++-- vignettes/negativeBinomial.Rmd | 2 +- 10 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 341645f..4449f79 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -30,3 +30,5 @@ README_cache ^CRAN-RELEASE$ ^code_of_conduct\.md$ ^CRAN-SUBMISSION$ +^doc$ +^Meta$ diff --git a/.gitignore b/.gitignore index 06d1b0a..b4e86b5 100644 --- a/.gitignore +++ b/.gitignore @@ -115,4 +115,6 @@ flycheck_*.el .dir-locals.el # network security -/network-security.data \ No newline at end of file +/network-security.data +/doc/ +/Meta/ diff --git a/NEWS.md b/NEWS.md index 31e9e89..785a2e2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,7 @@ * `brglm_control()` now checks that the supplied value of `max_step_factor` is numeric and greater or equal to `1`. If not, then it is set to the default value of `12`. +* Vignette updates # brglm2 0.9.1 diff --git a/R/brglmFit.R b/R/brglmFit.R index 3ab1284..d669929 100644 --- a/R/brglmFit.R +++ b/R/brglmFit.R @@ -992,6 +992,7 @@ brglmFit <- function(x, y, weights = rep(1, nobs), start = NULL, etastart = NULL ## residuals and working_weights quantities <- key_quantities(c(betas, dispersion), y = y, level = 2 * !no_dispersion, scale_totals = has_fixed_totals, qr = TRUE) + qr.Wx <- quantities$qr_decomposition mus <- quantities$mus diff --git a/R/brmultinom.R b/R/brmultinom.R index 5a5aeff..5d1fd6a 100644 --- a/R/brmultinom.R +++ b/R/brmultinom.R @@ -142,7 +142,7 @@ #' contrasts(hepat$type) <- contr.treatment(3, base = 1) #' #' # Maximum likelihood estimation fails to converge because some estimates are infinite -#' hepML <- brmultinom(type ~ group * time, data = hepat, weights = counts, type = "ML") +#' hepML <- brmultinom(type ~ group * time, data = hepat, weights = counts, type = "ML", slowit = 0.1) #' #' # Mean bias reduction returns finite estimates #' hep_meanBR <- brmultinom(type ~ group * time, data = hepat, weights = counts, type = "AS_mean") diff --git a/man/brmultinom.Rd b/man/brmultinom.Rd index 4894abd..4c1959b 100644 --- a/man/brmultinom.Rd +++ b/man/brmultinom.Rd @@ -160,7 +160,7 @@ hepat$type <- factor(hepat$type, labels = c("noDisease", "C", "nonABC")) contrasts(hepat$type) <- contr.treatment(3, base = 1) # Maximum likelihood estimation fails to converge because some estimates are infinite -hepML <- brmultinom(type ~ group * time, data = hepat, weights = counts, type = "ML") +hepML <- brmultinom(type ~ group * time, data = hepat, weights = counts, type = "ML", slowit = 0.1) # Mean bias reduction returns finite estimates hep_meanBR <- brmultinom(type ~ group * time, data = hepat, weights = counts, type = "AS_mean") diff --git a/vignettes/adjacent.Rmd b/vignettes/adjacent.Rmd index 1d43490..3db26c4 100644 --- a/vignettes/adjacent.Rmd +++ b/vignettes/adjacent.Rmd @@ -7,7 +7,7 @@ bibliography: brglm2.bib nocite: | @kosmidis:2019 vignette: > - %\VignetteIndexEntry{Adjacent category logit models using brglm2} + %\VignetteIndexEntry{Adjacent category logit models using **brglm2**} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/iteration.Rmd b/vignettes/iteration.Rmd index c243373..1b9a39c 100755 --- a/vignettes/iteration.Rmd +++ b/vignettes/iteration.Rmd @@ -185,7 +185,7 @@ where $\rho = (\rho_1, \ldots, \rho_n)^T$ with $\rho_i = h_i \{2 d_i'/(d_i w_i) + $s_\beta$, $i_{\beta\beta}$, $A_\beta$ + $s_\phi$, $i_{\phi\phi}$, $A_\phi$ + Starting values $\beta^{(0)}$ and $\phi^{(0)}$ -+ $\epsilon > 0$: tolerance for the $L1$ norm of the direction before reporting convergence ++ $\epsilon > 0$: tolerance for the $L^\infty$ norm of the search direction before reporting convergence + $M$: maximum number of halving steps that can be taken ### Output @@ -214,7 +214,7 @@ where $\rho = (\rho_1, \ldots, \rho_n)^T$ with $\rho_i = h_i \{2 d_i'/(d_i w_i) 8. $v_\phi^{(m)} \leftarrow \upsilon_\phi^{(k)}$ -9. $d \leftarrow \left|v_\beta^{(m)}\right|_1 + \left|v_\phi^{(m)}\right|$ +9. $d \leftarrow \left|\left|(v_\beta^{(m)}, v_\phi^{(m)})\right|\right|_\infty$ *Update parameters* @@ -230,7 +230,7 @@ where $\rho = (\rho_1, \ldots, \rho_n)^T$ with $\rho_i = h_i \{2 d_i'/(d_i w_i) *Continue or break halving within inner loop* -14. if $m + 1 < M$ and $\left|v_\beta^{(m + 1)}\right|_1 + \left|v_\phi^{(m + 1)}\right| > d$ +14. if $m + 1 < M$ and $\left|\left|(v_\beta^{(m + 1)}, v_\phi^{(m + 1)})\right|\right|_\infty > d$ 14.1. $m \leftarrow m + 1$ @@ -248,7 +248,7 @@ where $\rho = (\rho_1, \ldots, \rho_n)^T$ with $\rho_i = h_i \{2 d_i'/(d_i w_i) *Continue or break outer loop* -16. if $k + 1 < K$ and $\left|\upsilon_\beta^{(k + 1)}\right|_1 + \left|\upsilon_\phi^{(k + 1)}\right| > \epsilon$ +16. if $k + 1 < K$ and $\left|\left|(\upsilon_\beta^{(k + 1)}, \upsilon_\phi^{(k + 1)})\right|\right|_\infty > \epsilon$ 16.1 $k \leftarrow k + 1$ diff --git a/vignettes/multinomial.Rmd b/vignettes/multinomial.Rmd index 290f37d..28fb283 100644 --- a/vignettes/multinomial.Rmd +++ b/vignettes/multinomial.Rmd @@ -73,12 +73,12 @@ particular model and data combination. Let's scale the frequencies in `alligators` by 3 in order to get a sparser data set. The differences between maximum likelihood and mean and median bias reduction should be more apparent on the resulting data set. Here we have to "slow-down" the Fisher scoring iteration (by scaling the step-size), because otherwise the Fisher information matrix quickly gets numerically rank-deficient. The reason is data separation [@albert:84]. ```{r, echo = TRUE, error = TRUE} -all_ml_sparse <- update(all_ml, weights = round(freq/3), slowit = 0.2) +all_ml_sparse <- update(all_ml, weights = round(freq/3), slowit = 0.1) summary(all_ml_sparse) ``` Specifically, judging from the estimated standard errors, the estimates for `(Intercept)`, `lakeHancock`, `lakeOklawaha` and `lakeTrafford` for `Reptile` and `lakeHancock` for `Bird` seem to be infinite. -To quickly check if that's indeed the case we can use the `check_infinite_estimates()` method of the [**detectseparation**][https://cran.r-project.org/package=detectseparation] R package. +To quickly check if that's indeed the case we can use the `check_infinite_estimates()` method of the [**detectseparation**](https://cran.r-project.org/package=detectseparation) R package. ```{r, echo = TRUE} library("detectseparation") se_ratios <- check_infinite_estimates(all_ml_sparse) diff --git a/vignettes/negativeBinomial.Rmd b/vignettes/negativeBinomial.Rmd index 669b4bf..a225061 100644 --- a/vignettes/negativeBinomial.Rmd +++ b/vignettes/negativeBinomial.Rmd @@ -5,7 +5,7 @@ date: "12 June 2021" output: rmarkdown::html_vignette bibliography: brglm2.bib vignette: > - %\VignetteIndexEntry{Negative Binomial regression using **brglm2**} + %\VignetteIndexEntry{Negative binomial regression using **brglm2**} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- From 37236c819720ab47bda318bc469d6358e68d9c77 Mon Sep 17 00:00:00 2001 From: Ioannis Kosmidis Date: Thu, 5 Oct 2023 12:41:54 +0100 Subject: [PATCH 5/7] Version bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2522b27..abee498 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: brglm2 Title: Bias Reduction in Generalized Linear Models -Version: 0.9.999 +Version: 0.9.2 Authors@R: c(person(given = "Ioannis", family = "Kosmidis", role = c("aut", "cre"), email = "ioannis.kosmidis@warwick.ac.uk", comment = c(ORCID = "0000-0003-1556-0302")), person(given = c("Euloge", "Clovis"), family = c("Kenne Pagui"), role = "aut", email = "kenne@stat.unipd.it"), person(given = "Kjell", family = "Konis", role = "ctb", email = "kjell.konis@me.com"), From cc80a2f792e05c6e09921fca9713e72234f6ae82 Mon Sep 17 00:00:00 2001 From: Ioannis Kosmidis Date: Wed, 11 Oct 2023 16:17:52 +0100 Subject: [PATCH 6/7] Attempt to CRAN --- CRAN-SUBMISSION | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CRAN-SUBMISSION diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..9aa33bf --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.9.2 +Date: 2023-10-11 15:17:41 UTC +SHA: 37236c819720ab47bda318bc469d6358e68d9c77 From 2769231f693b383d6c394a9138f11b2bb25877f1 Mon Sep 17 00:00:00 2001 From: Ioannis Kosmidis Date: Thu, 12 Sep 2024 18:55:37 +0100 Subject: [PATCH 7/7] deleted temporary files --- CRAN-SUBMISSION | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 CRAN-SUBMISSION diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION deleted file mode 100644 index 9aa33bf..0000000 --- a/CRAN-SUBMISSION +++ /dev/null @@ -1,3 +0,0 @@ -Version: 0.9.2 -Date: 2023-10-11 15:17:41 UTC -SHA: 37236c819720ab47bda318bc469d6358e68d9c77