Diagnostic Tools for Logistic and Conditional Logistic Regression
Overview
Provides tools for fitting, assessing, and comparing logistic and conditional logistic regression models. Includes residual diagnostics and goodness of fit measures for model development and evaluation in matched case control studies.
- Update deprecated stan syntax in vignette Bayesian\_Logistic\_Regression.
- Fixed discordant.pairs() to correctly handle strata extracted from tibble inputs.
From NEWS.md in the release
Install
Health
ERRORre-building of vignette outputsr-devel-linux-x86_64-debian-gcc, r-devel-windows-x86_64, r-oldrel-windows-x86_64, r-release-windows-x86_64
r-devel-linux-x86_64-debian-gcc
Error(s) in re-building vignettes:
...
--- re-building ‘Bayesian_Logistic_regression.Rmd’ using rmarkdown
[WARNING] Deprecated: --mathjax. Use --math-method=mathjax[:URL] instead.
--- finished re-building ‘Bayesian_Logistic_regression.Rmd’
--- re-building ‘Conditional_Logistic_Regression.Rmd’ using rmarkdown
Quitting from Conditional_Logistic_Regression.Rmd:131-142 [unnamed-chunk-9]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `a$specials[[i]]`:
! subscript out of bounds
---
Backtrace:
▆
1. ├─utils::head(...)
2. └─CLRtools::residuals_clog(...)
3. ├─stats::model.matrix(model)
4. └─survival:::model.matrix.coxph(model)
5. └─stats::delete.response(object$terms)
6. └─stats (local) off(a$specials[[i]])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'Conditional_Logistic_Regression.Rmd' failed with diagnostics:
subscript out of bounds
--- failed re-building ‘Conditional_Logistic_Regression.Rmd’
--- re-building ‘Logistic_Regression.Rmd’ using rmarkdown
[WARNING] Deprecated: --mathjax. Use --math-method=mathjax[:URL] instead.
--- finished re-building ‘Logistic_Regression.Rmd’
SUMMARY: processing the following file failed:
‘Conditional_Logistic_Regression.Rmd’
Error: Vignette re-building failed.
Execution haltedr-devel-windows-x86_64
Error(s) in re-building vignettes:
--- re-building 'Bayesian_Logistic_regression.Rmd' using rmarkdown
specified C++17
make cmd is
make -f "D:/RCompile/recent/R/etc/x64/Makeconf" -f "D:/RCompile/recent/R/share/make/winshlib.mk" CXX='$(CXX17) $(CXX17STD)' CXXFLAGS='$(CXX17FLAGS)' CXXPICFLAGS='$(CXX17PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX17LDFLAGS)' SHLIB_LD='$(SHLIB_CXX17LD)' SHLIB="file52f0878892a5a.dll" WIN=64 TCLBIN= OBJECTS="file52f0878892a5a.o"
make would use
if test "zfile52f0878892a5a.o" != "z"; then \
if test -e "file52f0878892a5a-win.def"; then \
echo g++ -shared -s -static-libgcc -o file52f0878892a5a.dll file52f0878892a5a-win.def file52f0878892a5a.o "D:/RCompile/CRANpkg/lib/4.7/rstan/lib/x64/libStanServices.a" -L"D:/RCompile/CRANpkg/lib/4.7/StanHeaders/libs/x64" -lStanHeaders -L"D:/RCompile/CRANpkg/lib/4.7/RcppParallel/lib/x64" -ltbb -LD:/RCompile/CRANpkg/lib/4.7/RcppParallel/libs/x64 -lRcppParallel -LD:/RCompile/CRANpkg/lib/4.7/RcppParallel/lib/x64 -ltbb -ltbbmallo
...[truncated]...
fi
Quitting from Bayesian_Logistic_regression.Rmd:268-348 [unnamed-chunk-7]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `sink()`:
! invalid connection
---
Backtrace:
▆
1. └─rstan::stan(...)
2. └─rstan::stan_model(...)
3. └─rstan:::cxxfunctionplus(...)
4. └─base::sink(type = "output")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'Bayesian_Logistic_regression.Rmd' failed with diagnostics:
invalid connection
--- failed re-building 'Bayesian_Logistic_regression.Rmd'
--- re-building 'Conditional_Logistic_Regression.Rmd' using rmarkdown
--- finished re-building 'Conditional_Logistic_Regression.Rmd'
--- re-building 'Logistic_Regression.Rmd' using rmarkdown
--- finished re-building 'Logistic_Regression.Rmd'
SUMMARY: processing the following file failed:
'Bayesian_Logistic_regression.Rmd'
Error: Vignette re-building failed.
Execution haltedr-oldrel-windows-x86_64
Error(s) in re-building vignettes:
--- re-building 'Bayesian_Logistic_regression.Rmd' using rmarkdown
make cmd is
make -f "D:/RCompile/recent/R-4.5.3/etc/x64/Makeconf" -f "D:/RCompile/recent/R-4.5.3/share/make/winshlib.mk" CXX='$(CXX17) $(CXX17STD)' CXXFLAGS='$(CXX17FLAGS)' CXXPICFLAGS='$(CXX17PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX17LDFLAGS)' SHLIB_LD='$(SHLIB_CXX17LD)' SHLIB="file14c0c5c8816c8.dll" WIN=64 TCLBIN= OBJECTS="file14c0c5c8816c8.o"
make would use
if test "zfile14c0c5c8816c8.o" != "z"; then \
if test -e "file14c0c5c8816c8-win.def"; then \
echo g++ -shared -s -static-libgcc -o file14c0c5c8816c8.dll file14c0c5c8816c8-win.def file14c0c5c8816c8.o "D:/RCompile/CRANpkg/lib/4.5/rstan/lib/x64/libStanServices.a" -L"D:/RCompile/CRANpkg/lib/4.5/StanHeaders/libs/x64" -lStanHeaders -L"D:/RCompile/CRANpkg/lib/4.5/RcppParallel/lib/x64" -ltbb -LD:/RCompile/CRANpkg/lib/4.5/RcppParallel/libs/x64 -lRcppParallel -LD:/RCompile/CRANpkg/lib/4.5/RcppParallel/lib/x64 -ltbb -ltbbmalloc -L"d
...[truncated]...
fi
Quitting from Bayesian_Logistic_regression.Rmd:268-348 [unnamed-chunk-7]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `sink()`:
! invalid connection
---
Backtrace:
▆
1. └─rstan::stan(...)
2. └─rstan::stan_model(...)
3. └─rstan:::cxxfunctionplus(...)
4. └─base::sink(type = "output")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'Bayesian_Logistic_regression.Rmd' failed with diagnostics:
invalid connection
--- failed re-building 'Bayesian_Logistic_regression.Rmd'
--- re-building 'Conditional_Logistic_Regression.Rmd' using rmarkdown
--- finished re-building 'Conditional_Logistic_Regression.Rmd'
--- re-building 'Logistic_Regression.Rmd' using rmarkdown
--- finished re-building 'Logistic_Regression.Rmd'
SUMMARY: processing the following file failed:
'Bayesian_Logistic_regression.Rmd'
Error: Vignette re-building failed.
Execution haltedr-release-windows-x86_64
Error(s) in re-building vignettes:
--- re-building 'Bayesian_Logistic_regression.Rmd' using rmarkdown
specified C++17
make cmd is
make -f "D:/RCompile/recent/R-4.6.1/etc/x64/Makeconf" -f "D:/RCompile/recent/R-4.6.1/share/make/winshlib.mk" CXX='$(CXX17) $(CXX17STD)' CXXFLAGS='$(CXX17FLAGS)' CXXPICFLAGS='$(CXX17PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX17LDFLAGS)' SHLIB_LD='$(SHLIB_CXX17LD)' SHLIB="file5971852873328.dll" WIN=64 TCLBIN= OBJECTS="file5971852873328.o"
make would use
if test "zfile5971852873328.o" != "z"; then \
if test -e "file5971852873328-win.def"; then \
echo g++ -shared -s -static-libgcc -o file5971852873328.dll file5971852873328-win.def file5971852873328.o "D:/RCompile/CRANpkg/lib/4.6/rstan/lib/x64/libStanServices.a" -L"D:/RCompile/CRANpkg/lib/4.6/StanHeaders/libs/x64" -lStanHeaders -L"D:/RCompile/CRANpkg/lib/4.6/RcppParallel/lib/x64" -ltbb -LD:/RCompile/CRANpkg/lib/4.6/RcppParallel/libs/x64 -lRcppParallel -LD:/RCompile/CRANpkg/lib/4.6/RcppParallel/lib/x64 -ltb
...[truncated]...
fi
Quitting from Bayesian_Logistic_regression.Rmd:268-348 [unnamed-chunk-7]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `sink()`:
! invalid connection
---
Backtrace:
▆
1. └─rstan::stan(...)
2. └─rstan::stan_model(...)
3. └─rstan:::cxxfunctionplus(...)
4. └─base::sink(type = "output")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'Bayesian_Logistic_regression.Rmd' failed with diagnostics:
invalid connection
--- failed re-building 'Bayesian_Logistic_regression.Rmd'
--- re-building 'Conditional_Logistic_Regression.Rmd' using rmarkdown
--- finished re-building 'Conditional_Logistic_Regression.Rmd'
--- re-building 'Logistic_Regression.Rmd' using rmarkdown
--- finished re-building 'Logistic_Regression.Rmd'
SUMMARY: processing the following file failed:
'Bayesian_Logistic_regression.Rmd'
Error: Vignette re-building failed.
Execution haltedERRORexamplesr-devel-linux-x86_64-debian-gcc
Running examples in ‘CLRtools-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: residuals_clog
> ### Title: Model Diagnostic for Conditional Logistic Regression
> ### Aliases: residuals_clog
>
> ### ** Examples
>
> # Example from Hosmer et al., 2013
> # Applied Logistic Regression (3rd ed.), Chapter 7
>
> # Convert 'fracture' to binary (0 = No, 1 = Yes)
> glow11m$fracture <- ifelse(glow11m$fracture == "Yes", 1, 0)
>
> # Load required package
> library(survival)
>
> # Fit a conditional logistic regression model
> mod7.3 <- clogit(
+ fracture ~ weight + bmi + priorfrac + momfrac + armassist + strata(pair),
+ data = glow11m)
>
> # Run diagnostics for the conditional logistic model
> residuals_clog(mod7.3, strata = glow11m$pair, y = glow11m$fracture)
Error in a$specials[[i]] : subscript out of bounds
Calls: residuals_clog ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted- ERROR9 OK, 4 ERRORNow
- ERROR12 OK, 1 ERROR2026-09-06
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
Show 5 earlier changesHide 5 earlier changes
- OK13 OK2026-05-02
- ERROR11 OK, 1 ERROR2026-04-25
- NOTE11 OK, 3 NOTE2026-04-22
- ERROR10 OK, 3 NOTE, 1 ERROR2026-04-18
- NOTE5 OK, 9 NOTE2026-03-10
Documentation
- Help pages
- 28 (1 internal)includes a package overview page
- Examples that run
- 100%19 run in a plain check
- Exported functions with examples
- 76%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 29%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 8
Forks over time
PRs over time
Commits over time
Commit identities over time
Checks run against github.com/brendacontla/clrtools on 2026-10-22.
No development-tooling practices detected in the upstream repository.
Dependencies
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2026-01-29
- Total releases
- 3 / 1 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 3.5
- Bundled data
- 11 KB / 2 files
- Download size
- 4.7 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("CLRtools")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.