Skip to content

Commit

Permalink
Merge pull request #17 from ikosmidis/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ikosmidis committed Mar 19, 2020
2 parents 55063e3 + 25e99d6 commit 3b605b6
Show file tree
Hide file tree
Showing 26 changed files with 337 additions and 103 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,6 +1,6 @@
Package: brglm2
Title: Bias Reduction in Generalized Linear Models
Version: 0.6.1
Version: 0.6.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 = "Kjell", family = "Konis", role = "ctb", email = "kjell.konis@me.com"),
person(given = c("Euloge", "Clovis"), family = c("Kenne Pagui"), role = "ctb", email = "kenne@stat.unipd.it"),
Expand Down
163 changes: 104 additions & 59 deletions NEWS.md
@@ -1,113 +1,158 @@
# brglm 0.6.1
# brglm2 0.6.2

## Other improvements, updates and additions
* `vcov.brglmFit` objects 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.
* Deprecated `detect_sepration` and `check_infinite_estimates`, which
will be removed from **brglm2** at version 0.8. New versions of
`detect_sepration` and `check_infinite_estimates` are now maintained
in the
[**detectseparation**](https://cran.r-project.org/package=detectseparation)
R package.
* Fixed typos in NEWS.

# brglm2 0.6.1
## Bug fixes
* Fixed bug in AIC reported by `print.summary` for `brmultinom` and `bracl`
* `detect_separation` now handles one-column model matrices correctly
* `detect_separation` now handles one-column model matrices correctly.

## Other improvements, updates and additions
* Documentation improvements and typo fixes

# brglm 0.6
# brglm2 0.6
## New functionality
* `brglmFit` can now do maximum penalized likelihood with powers of the Jeffreys prior as penalty (`type = "MPL_Jeffreys`) for all supported generalized linear models. See `brglmControl` and `brglmFit` for details.
* `brglmFit` can now do maximum penalized likelihood with powers of
the Jeffreys prior as penalty (`type = "MPL_Jeffreys`) for all
supported generalized linear models. See `brglmControl` and
`brglmFit` for details.

## Other improvements, updates and additions
* Documentation updates and improvements
* Updated vignettes to include maximum penalized likelihood with powers of the Jeffreys prior as penalty
* New examples in `?brglmFit`
* Documentation updates and improvements.
* Updated vignettes to include maximum penalized likelihood with
powers of the Jeffreys prior as penalty.
* New examples in `?brglmFit`.

# brglm 0.5.2
# brglm2 0.5.2
## Bug fixes
* `print.brmultinom` is now exported, so `bracl` and `brmultinom` fits print correctly
* `print.brmultinom` is now exported, so `bracl` and `brmultinom` fits
print correctly.

## New functionality
* Added `response_adjustment` argument in `brglmControl` to allow for more fine-tuning of the starting values when `brglmFit` is called with `start = NULL`
* Added `response_adjustment` argument in `brglmControl` to allow for
more fine-tuning of the starting values when `brglmFit` is called
with `start = NULL`.

## Other improvements, updates and additions
* Documentation updates and improvements
* Added Kosmidis et al (2019) in the description file
* Added tests for `brglmControl`
* Documentation updates and improvements.
* Added Kosmidis et al (2019) in the description file.
* Added tests for `brglmControl`.

# brglm 0.5.1
# brglm2 0.5.1

## Other improvements, updates and additions
* Fixed typos in vignettes and documentation
* Added ORCHID for Ioannis Kosmidis in DESCRIPTION
* Fixed typos in vignettes and documentation.
* Added ORCHID for Ioannis Kosmidis in DESCRIPTION.

# brglm 0.5.0
# brglm2 0.5.0
## Bug fixes
* `brglmFit` now works as expected with custom link functions (mean and median bias reduction)
* `brglmFit` respects the specification of the transformation argument in `brglmControl`
* Fixed bug in the computation of the QR decomposition under aliasing in `brglmFit`
* Other minor bug fixes and performance improvements
* Protection against use of `quasi`, `quasibinomial` and `quasibinomial` families and documentation update.
* `brglmFit` now works as expected with custom link functions (mean
and median bias reduction).
* `brglmFit` respects the specification of the transformation argument
in `brglmControl`.
* Fixed bug in the computation of the QR decomposition under aliasing
in `brglmFit`.
* Other minor bug fixes and performance improvements.
* Protection against use of `quasi`, `quasibinomial` and
`quasibinomial` families and documentation update.

## New functionality
* Added `bracl` for fitting adjacent category logit models for ordinal responses using maximum likelihood, mean bias reduction, and median bias reduction and associated methods (`logLik`, `summary` and so on)
* Added `predict` methods for `brmultinom` and `bracl`
@ Added `residuals` methods for `brmultinom` and `bracl` (residuals of the equivalent Poisson log-linear model)
* Added the `mis` link functions for accounting for misclassification in binomial response models (Neuhaus, 1999, Biometrika)
* Added `bracl` for fitting adjacent category logit models for ordinal
responses using maximum likelihood, mean bias reduction, and median
bias reduction and associated methods (`logLik`, `summary` and so
on).
* Added `predict` methods for `brmultinom` and `bracl`. @ Added
`residuals` methods for `brmultinom` and `bracl` (residuals of the
equivalent Poisson log-linear model)
* Added the `mis` link functions for accounting for misclassification
in binomial response models (Neuhaus, 1999, Biometrika).

## Other 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 documentation
* Updated reference to [Kenne Pagui et al (2017)](https://doi.org/10.1093/biomet/asx046)
* 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
documentation.
* Updated reference to [Kenne Pagui et al (2017)](https://doi.org/10.1093/biomet/asx046).

# brglm 0.1.8
# brglm2 0.1.8
## Other 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
* Improved documentation examples.
* Removed warning about observations with non-positive weights from brmultinom.
* Updated email address for Ioannis Kosmidis in brglmFit.

## Bug fixes
* brmultinom returns a fitted values matrix that respects the dimension of data
* Fixed bug on condition for NA dispersion for models with 0 df resid
* brmultinom returns a fitted values matrix that respects the
dimension of data.
* Fixed bug on condition for NA dispersion for models with 0 df resid.

# brglm 0.1.7
# brglm2 0.1.7

## Other improvements, updates and additions
* Eliminated errors from markdown chunks in multinomial vignette
* Eliminated errors from markdown chunks in multinomial vignette.

# brglm2 0.1.6

## Bug fixes
* Compatibility with new version of enrichwith
* Compatibility with new version of enrichwith.

## Other improvements, updates and additions
* New email for Ioannis Kosmidis
* New email for Ioannis Kosmidis.

# brglm2 0.1.5

## Bug fixes

## New functionality
* Added `type = AS_mixed` as an option to use **mean-bias reducing score functions** for the regression parameters and **median-bias reducing score functions** for the dispersion in models with unknown dispersion
* `check_infinite_estimates` now accepts `brmultinom` objects
* Added `singular.ok` argument to `brglmFit` and `detect_separation` methods in line with the update of `glm.fit`
* Added `type = AS_mixed` as an option to use **mean-bias reducing
score functions** for the regression parameters and **median-bias
reducing score functions** for the dispersion in models with unknown
dispersion.
* `check_infinite_estimates` now accepts `brmultinom` objects.
* Added `singular.ok` argument to `brglmFit` and `detect_separation`
methods in line with the update of `glm.fit`.

## Other improvements, updates and additions
* less strict tolerance in `brglm_control`
* Updates to help files
* Fixed typos in iteration vignette
* Added URL and bugreports in Description
* Added new tests
* less strict tolerance in `brglm_control`.
* Updates to help files.
* Fixed typos in iteration vignette.
* Added URL and bugreports in Description.
* Added new tests.

# brglm2 0.1.4

## Bug fixes
* `brglmControl` is now exported
* `slowit` did nothing; now included in iteration
* `brglmControl` is now exported.
* `slowit` did nothing; now included in iteration.

## New functionality
* The `detect_separation` `method` for the `glm` function can be used to check for separation in binomial response settings without fitting the model. This relies on a port of Kjell Konis' `safeBinaryRegression:::separator` function (see ?detect_separation)
* brglm2 provides estimation via **median-bias reducing score functions** with `type = "AS_median"`
* brglm2 provides camel and underscored aliases for basic methods (`brglmFit`, `brglm_fit`, `detectSeparation`, `detect_separation`, `brglm_control`, `brglmControl`, `detectSeparationControl`, `detect_separation_control`, `checkInfiniteEstimates`, `check_infinite_estimates`)
* The `detect_separation` `method` for the `glm` function can be used
to check for separation in binomial response settings without
fitting the model. This relies on a port of Kjell Konis'
`safeBinaryRegression:::separator` function (see ?detect_separation).
* **brglm2** provides estimation via **median-bias reducing score
functions** with `type = "AS_median"`.
* **brglm2** provides camel and underscored aliases for basic methods
(`brglmFit`, `brglm_fit`, `detectSeparation`, `detect_separation`,
`brglm_control`, `brglmControl`, `detectSeparationControl`,
`detect_separation_control`, `checkInfiniteEstimates`,
`check_infinite_estimates`).

## Other improvements, updates and additions
* Minor enhancements in the codebase
* The inverse expected information matrix is computed internally using cho2inv
* Internal changes to have more meaningful variable names
* Renamed detect_infinite* to check_infinite
* Minor enhancements in the codebase.
* The inverse expected information matrix is computed internally using
`cho2inv`.
* Internal changes to have more meaningful variable names.
* Renamed detect_infinite* to check_infinite.

# brglm2 0.1.3

Expand All @@ -117,11 +162,11 @@

## Other improvements, updates and additions
* Fixed typo in f_{Y_i}(y) in iteration vignette (thanks to Eugene
Clovis Kenne Pagui for spotting)
Clovis Kenne Pagui for spotting),

# brglm2 0.1.2

* First release
* First release.



17 changes: 17 additions & 0 deletions R/brglm2-package.R
Expand Up @@ -94,7 +94,24 @@ if (getRversion() >= "2.15.1") globalVariables(c("n", "lambda"))
#' @param object a fitted model object (e.g. the result of a
#' \code{\link{glm}} call).
#' @param ... other options to be passed to the method.
#'
#'
#' @note
#'
#'
#' \code{check_infinite_estimates} will be removed from \pkg{brglm2}
#' at version 0.8. An new version of
#' \code{check_infinite_estimates} is now maintained in the
#' \pkg{detectseparation} R package at
#' \url{https://cran.r-project.org/package=detectseparation}.
#'
#' @seealso check_infinite_estimates.glm
#'
#' @export
check_infinite_estimates <- function(object, ...) {
function_moves_to_new_package(gsub("\\(|\\)", "", deparse(match.call()[1])),
"0.8",
"brglm2",
"detectseparation")
UseMethod("check_infinite_estimates")
}
1 change: 0 additions & 1 deletion R/brglmControl.R
Expand Up @@ -20,7 +20,6 @@
#' Typically only used internally by \code{\link{brglmFit}}, but may
#' be used to construct a \code{control} argument.
#'
#' @inheritParams stats::glm.control
#' @aliases brglm_control
#' @param epsilon positive convergence tolerance epsilon. Default is
#' \code{1e-06}.
Expand Down
16 changes: 12 additions & 4 deletions R/brglmFit.R
Expand Up @@ -1254,16 +1254,24 @@ confint.brglmFit <- function(object, parm, level = 0.95, ...) {
#' Return the variance-covariance matrix for the regression parameters
#' in a \code{\link{brglmFit}} object
#'
#' @inheritParams stats::vcov
#' @inheritParams stats::vcov.glm
#' @param model character specifying for which component of the model coefficients should be extracted.
#'
#' @details
#'
#' The options for \code{model} are \code{"mean"} for mean regression
#' parameters only (default), \code{"dispersion"} for the dispersion
#' parameter (or the transformed dispersion; see
#' \code{\link{brglm_control}}), and \code{"mean"} for both the mean
#' regression and the (transformed) dispersion parameters.
#'
#' @method vcov brglmFit
#' @export
vcov.brglmFit <- function(object, model = c("mean", "full", "dispersion"), ...) {
vcov.brglmFit <- function(object, model = c("mean", "full", "dispersion"), complete = TRUE, ...) {
model <- match.arg(model)
switch(model,
mean = {
summary.brglmFit(object, ...)$cov.scaled
vcov(summary.brglmFit(object, ...), complete = complete)
},
dispersion = {
vtd <- 1/object$info_transformed_dispersion
Expand All @@ -1272,7 +1280,7 @@ vcov.brglmFit <- function(object, model = c("mean", "full", "dispersion"), ...)
vtd
},
full = {
vbetas <- summary.brglmFit(object, ...)$cov.scaled
vbetas <- vcov(summary.brglmFit(object, ...), complete = complete)
vtd <- 1/object$info_transformed_dispersion
nBetasAll <- c(rownames(vbetas), paste0(object$transformation, "(dispersion)"))
vBetasAll <- cbind(rbind(vbetas, 0),
Expand Down
6 changes: 3 additions & 3 deletions R/brmultinom.R
Expand Up @@ -46,7 +46,7 @@
#' baseline-category logit models have infinite components with
#' positive probability, which can result in problems in their
#' estimation and the use of inferential procedures (e.g. Wad
#' tests). Albert and Andreson (1984) have categorised the possible
#' tests). Albert and Andreson (1984) have categorized the possible
#' data patterns for such models into the exclusive and exhaustive
#' categories of complete separation, quasi-complete separation and
#' overlap, and showed that infinite maximum likelihood estimates
Expand Down Expand Up @@ -264,7 +264,7 @@ fitted.brmultinom <- function(object, ...) {
#' @details
#'
#' The residuals computed are the residuals from the equivalent
#' Poisson log-linear model fit, organised in a form that matches the
#' Poisson log-linear model fit, organized in a form that matches the
#' output of \code{fitted(object, type = "probs")}. As a result, the
#' output is residuals defined in terms of the object and expected
#' multinomial counts.
Expand Down Expand Up @@ -418,7 +418,7 @@ print.summary.brmultinom <- function(x, digits = x$digits, ...)
#' \code{"class"}, which produces predictions of the response
#' category at the covariate values supplied in \code{"newdata"},
#' selecting the category with the largest probability; the
#' alternative \code{"probs"} returns all cateogry probabilities
#' alternative \code{"probs"} returns all category probabilities
#' at the covariate values supplied in \code{"newdata"}.
#' @param ... further arguments passed to or from other methods.
#'
Expand Down
14 changes: 12 additions & 2 deletions R/check_infinite_estimates.R
Expand Up @@ -28,7 +28,7 @@
#'
#' @details
#'
#' \code{check_infinite_estimates} attempts to identify the occurence
#' \code{check_infinite_estimates} attempts to identify the occurrence
#' of infinite estimates in GLMs with binomial responses by
#' successively refitting the model. At each iteration the maximum
#' number of allowed IWLS iterations is fixed starting from 1 to
Expand All @@ -43,6 +43,16 @@
#' estimate for the corresponding parameter has value minus or plus
#' infinity.
#'
#' @note
#'
#' \code{check_infinite_estimates} will be removed from \pkg{brglm2}
#' at version 0.8. An new version of \code{check_infinite_estimates}
#' is now maintained in the \pkg{detectseparation} R package at
#' \url{https://cran.r-project.org/package=detectseparation}. In order
#' to use the version in \code{detect_separation} load first
#' \pkg{brglm2} and then \pkg{detectseparation}, i.e.
#' \code{library(brglm2); library(detectseparation)}.
#'
#' @seealso \code{\link[nnet]{multinom}}, \code{\link{brmultinom}}
#'
#' @references
Expand Down Expand Up @@ -73,7 +83,7 @@
#' }
#' @export
check_infinite_estimates.glm <- function(object, nsteps = 20, ...)
{
{
is_brmultinom <- inherits(object, "brmultinom")

if ((class(object)[1] != "glm") & (!is_brmultinom)) {
Expand Down

0 comments on commit 3b605b6

Please sign in to comment.