betaregscale 2.7.4
Resubmission addressing CRAN feedback on vignette build time (Uwe Ligges, 2026-08-23): “Please reduce the vignette build timings … Otherwise we cannot afford checking the vignette regularly on CRAN.” No change to the statistical methods or to the user-facing API.
Vignette build time
-
The vignettes now use smaller toy data sets and fewer resampling iterations. Total knit time for the four vignettes drops from 77.5s to 14.5s on the development machine (5.3x), and
checking re-building of vignette outputsinsideR CMD check --as-crandrops from 89s to 26s (3.4x). That step took 376s on the CRAN incoming check, so the expected saving there is around four and a half minutes. The source tarball also shrank from 1.35 MB to 1.09 MB.The dominant cost was a single chunk in
brs-intro.Rmd, 45.1s of the 77.5s total: a bootstrap withci_type = "bca"on 1000 observations. BCa obtains its acceleration constant from a leave-one-out jackknife, so that call performed 1000 model fits for the jackknife on top of the 100 bootstrap replicates. The sample size for that vignette is now 250 and the replicate count 30.Other reductions: sample sizes in
brs-intro.Rmd(1000 to 200/250),brs-advanced-workflows.Rmd(260 to 150, and the mixed-effects example from 1200 to 250 observations) andbrs-mm.Rmd(5 groups of 200 to 12 groups of 20, which is also a more natural design for illustrating random effects); bootstrap replicates (80/100/120 to 30); marginal-effect simulation draws (120/160 to 60); and cross-validation repeats (5 to 2). All vignettes still knit without warnings. brs-advanced-workflows.Rmdcomputed its bootstrap twice (once for the table, once again withci_type = "bca"for the forest plot) and its average marginal effects twice. Both are now computed once, withkeep_draws = TRUE, and the plots reuse them. Dropping the redundant BCa call also removes its leave-one-out jackknife. BCa remains demonstrated inbrs-intro.Rmd.
Documentation
-
?brs_bootstrapgains a section on the cost ofci_type = "bca". The leave-one-out jackknife behind the acceleration constant requiresR + nmodel fits rather thanR, so the run time is governed by the sample size rather than by the number of replicates. This was not documented, and it is easy to hit unexpectedly on a large sample.
betaregscale 2.7.3
This release makes no change to the user-facing API. It improves the numerical conditioning of the interval-censored likelihood, removes an unused C++ backend, and collects packaging and documentation cleanups for CRAN submission.
Numerical accuracy
- The interval probability
P(lo < Y < hi)that underlies every interval-censored observation is no longer always computed from lower-tail beta CDF values. When both endpoints lie in the upper tail (lo + hi > 1, common when the fitted mean is close to 1) the difference is now taken between upper-tail (survival) probabilities, so both terms stay small and the subtraction no longer suffers catastrophic cancellation. The two forms are identical in exact arithmetic; the new one is strictly better conditioned in floating point.
Bug fixes
- Removed two stale help pages,
man/brsmm_loglik_eigen.Rdandman/brsmm_group_modes_eigen.Rd, that documentedbrsmm_loglik_eigen()andbrsmm_group_modes_eigen(). Those objects do not exist: the Eigen entry points are registered as the internal.brsmm_loglik_eigenand.brsmm_group_modes_eigen.R CMD checkreported both as code/documentation mismatches. - Removed a Dropbox conflict copy of
.Rbuildignorethat had been committed by mistake and was being shipped in the source tarball, whereR CMD checkflagged it as a hidden file with a non-portable name.
Packaging
-
DESCRIPTIONno longer setsLazyData: true. The package ships nodata/directory, soR CMD buildwas already reporting “Omitted ‘LazyData’ from DESCRIPTION”. -
betaregwas removed fromSuggests. It is not used by any function, test or vignette; the package is only mentioned in prose when describing the output style ofsummary(). -
src/Makevarsandsrc/Makevars.winno longer request the OpenMP compiler and linker flags ($(SHLIB_OPENMP_CXXFLAGS)). No translation unit insrc/contains an OpenMP directive, so the flags added portability risk without any parallelism. -
TODO.md, a development-only file, is now listed in.Rbuildignore.
Documentation
-
NEWS.mdrecords under 2.7.0 the extension ofint_method = "aghq"andint_method = "qmc"to multivariate random effects, which had been implemented but never announced. The 2.6.8 heading, which had been concatenated onto the end of the 2.6.9 entry, is now a separate section. -
README.md: the S3 interface table markedautoplot()as unavailable forbrsmmobjects althoughautoplot.brsmm()is registered, exported and documented; it is now marked as available, and the missingplot()and extractor (logLik(),AIC(),BIC(),nobs(),fitted(),formula(),model.matrix()) rows were added. -
README.md: the score-probability example described its output as “500 patients” while the accompanying simulation creates 1000. -
README.md: the installation section claimed the package was “currently under review for CRAN”. It has been on CRAN since 2.6.9 (published 2026-02-25), soinstall.packages("betaregscale")is again presented as the primary route, with the GitHub install offered as the development version. -
README.md: the package summary and the mixed-effects section described the random-effects likelihood as Laplace-only, omitting the AGHQ and QMC methods. -
README.md: fixed the interval-censoring notation, which rendered as a semicolon-separated list rather than a closed interval. - The package help page (
?betaregscale) showed its “Useful links” section twice and listed the maintainer a third time below the author list. The cause was a block inR/autoplot.Rthat used the"_PACKAGE"sentinel purely to emit@rawNamespacedirectives, which made roxygen2 treat it as a second package-level documentation block; it now uses@noRdand contributes only the NAMESPACE directives (NAMESPACEis unchanged). A hand-written@seealso/@authorpair inR/betaregscale-package.Rthat duplicated what roxygen2 already derives fromAuthors@R,URLandBugReportswas removed. -
DESCRIPTIONnow lists the GitHub repository inURLalongside the pkgdown site. - The URI of the cited master’s dissertation is no longer wrapped in
\url{}in the\referencessection of the 22 help pages that carry it. The UFPR institutional repository hosting it is down (502 across the whole server, with an official maintenance notice), so the link resolved to an error. The identifier is persistent and the reference unchanged; only the hyperlink markup was dropped, and it will be restored once the repository is back.
Internal
- Removed the unused Armadillo mixed-effects backend from
src/loglik.cpp(betaregscale_loglik_mixed_laplace_cpp(),betaregscale_group_modes_cpp()and thebuild_group_index()/group_Q()/golden_max_group()/laplace_group()helpers, 267 lines). It was reachable from no R code, test or vignette:brsmm()uses the Eigen backend exclusively.RcppExportswere regenerated and the two corresponding help pages removed.
betaregscale 2.7.1
This is a maintenance release focused on correctness, numerical robustness, and performance. It carries the fixes from a deep audit of the C++ backends and the R interface. No user-facing API changes.
Bug fixes
- Fixed the inverse link for the precision (dispersion) submodel, which could return a negative shape near the origin; the dispersion parameter is now always positive.
- Corrected deviance residuals to use the proper saturated-model log-likelihood (affecting
residuals()and the diagnostic plots for bothbrsandbrsmm). Negative discrepancies are now handled viasqrt(abs(...))rather than being silently truncated to zero. -
predict.brs()now detects a variable-dispersion model from the model’s term labels instead of the number of parameters, fixing incorrect predictions for some fits. - The
sqrtlink for the precision submodel now clamps the linear predictor to be non-negative, preserving the correct gradient sign during optimization. - Mixed-effects mode finding (
brsmm) is substantially more robust: the Newton-Raphson step is accepted only when it improves the objective, the Hessian regularization is now proportional to the smallest eigenvalue of-H, and non-finite proposed steps are rejected before evaluation, preventingNaN/Infcrashes. - The adaptive Gauss-Hermite (AGHQ) integration grid now uses 64-bit indexing to prevent an integer-overflow crash for four or more random-effect dimensions, and the quasi-Monte Carlo prime table was expanded (20 to 50 primes) to keep Halton sequences uncorrelated in higher dimensions.
- Halton quantiles are clamped to
(1e-9, 1 - 1e-9)to avoid infinite values at the boundary.
Improvements
- The optimizer now emits a warning when it fails to converge in
brs()andbrsmm(). - Pseudo-R2 reporting adds a caution note when more than 50% of observations are censored.
- Link evaluation no longer constructs
stats::make.link()objects on every call:apply_inv_link()uses direct closed-form formulas, and a newapply_link()provides the forward transform, used across the fitting, methods, and plotting code. -
brs_check()is fully vectorized (no R-level loop) andbrs_prep()usesvapply()with a vectorizedNAguard. - Starting values:
compute_start()uses a moment-based estimate for the precision intercept (avoiding a second GLM fit), andbrsmm()initializes the random-effect standard deviation from the between-group variance. -
brs_coef()now formally signals its deprecation via.Deprecated("brs_est"). -
vcov.brs()warns when it cannot compute a finite covariance matrix (e.g., whenMASSis unavailable for the generalized-inverse fallback).
Internal
- Extracted a shared C++ header (
src/brs_common.h) to remove duplicated code between the Armadillo and Eigen backends, and documented the numerical tolerance constants. - The Eigen backend reuses a single pre-allocated workspace vector when forming the numerical Hessian.
-
src/Makevarsandsrc/Makevars.winno longer define-DARMA_NO_DEBUG, enabling Armadillo bounds checking. - The internal
.brsmm_loglik_eigenentry point is exported with a leading dot to keep it out of the public namespace.
betaregscale 2.7.0
New features
-
brsmm()now supports the"aghq"and"qmc"integration methods with multivariate random effects. Previously both were restricted to a single random-effects dimension andbrsmm()raised an error forrandom = ~ 1 + x | groupunlessint_method = "laplace". The Eigen backend now builds a Cartesian adaptive Gauss-Hermite grid and prime-based multidimensional Halton sequences of the required dimension, so all three integration methods are available for any random-effects structure.- For
int_method = "aghq"the grid hasn_points^q_renodes;brsmm()stops with an informative message if that exceeds 500,000, suggesting a smallern_pointsorint_method = "qmc". -
int_method = "qmc"supports up to 50 random-effects dimensions.
- For
-
autoplot.brsmm()andautoplot.brs()gain three new arguments:-
theme: accepts any ggplot2 theme object or function (defaultggplot2::theme_minimal()), replacing the hardcoded theme in all 8 internalbrsmmand 4 internalbrsplot helpers. -
title,xlab,ylab: override individual plot labels viaggplot2::labs(). -
type = "all": renders every available panel in a singlegridExtra::grid.arrange()grid. -
ncol: controls the number of columns whentype = "all". -
...: passes additional named arguments toggplot2::theme()on top of the base theme.
-
-
autoplot.brsmm()addstype = "shrinkage": scatter of Laplace posterior modes versus naïve per-group logit-mean deviations, with identity line and loess smoother. -
autoplot.brsmm()updatestype = "ranef_caterpillar": error bars now show ±1.96 × Model SD (marginal standard deviation from theDcovariance matrix). -
plot.brsmm()adds two new base R diagnostic panels:-
which = 7: Q-Q normal plot of random-effect posterior modes. -
which = 8: dotchart caterpillar of posterior modes (ordered by value).
-
-
brsmm_re_study()now returns$icc: intraclass correlation coefficient on the latent logistic scale (σ²_b / (σ²_b + π²/3)). -
print.brsmm_re_study()now displays a VarCorr-style table (Std.Dev., Corr) and the ICC alongside the existing shrinkage and normality diagnostics.
Improvements
- Coefficient display:
print.summary.brsmm(),print.brsmm(),print.summary.brs(), andprint.brs()now apply cosmetic name cleaners that strip internal prefixes such as(phi)_from precision coefficients and convert Cholesky-factor internal names (e.g.,(re_chol_logsd)_X|g) to readablelogSD.X|g/cov.X:Y|gforms. - Calibration plots (
autoplot.brsandautoplot.brsmm) now maplinewidth = nforgeom_line()instead of the deprecatedsizeaesthetic, eliminating the ggplot2 ≥ 3.4.0 deprecation warning.
Testing
- Added
tests/testthat/test-re-and-autoplot-improvements.Rwith 15 new tests covering:.pretty_phi_names(),.pretty_re_names(),brsmm_re_study()ICC and VarCorr output,plot.brsmm()panels 7 and 8,autoplot.brsmm()andautoplot.brs()title/xlab/ylab, theme arg (object and function),type = "all",...forwarding.
betaregscale 2.6.9
CRAN release: 2026-02-25
CRAN resubmission
Documentation and formatting fixes
- Added missing
\value,\seealso, and\examples{\donttest{...}}tags to multiple S3 method documentation files (print.summary,residuals,summary,vcov,ranef) to ensure full CRAN policy compliance. - Translated remaining Portuguese text into English in the mixed-effects vignette (
vignettes/brs-mm.Rmd). - Corrected
ranef()usage in vignettes to correctly call the generic function. - Fixed mathematical formulas rendering in
README.mdto be fully compatible with GitHub Markdown, and updatedpkgdownsite build configuration to loadbetaregscaleappropriately during vignette setups. - Minor mathematical formatting and typographical fixes (e.g., en-dashes for page ranges) in
README.mdreferences.
betaregscale 2.6.8
New features
- Completed S3 method standardization for
brsmm(mixed-effects) objects to mirror the interface ofbrs(fixed-effects) objects:- Added missing extractors:
formula(),model.matrix(), andconfint(). - Upgraded
residuals()to support conditional"deviance","rqr"(randomized quantile residuals),"weighted", and"sweighted"options. - Upgraded
predict()to support conditionaltype = "quantile"evaluations directly. - Added
ranef()generic andranef.brsmm()method to extract random-effect modes.
- Added missing extractors:
- Modified package helper functions
brs_gof()andbrs_est()to compute GOF properties and estimates directly from bothbrsandbrsmmobjects respectively.
Improvements
- Standardized
print.brsmm()to explicitly display mean, precision, and random-effect coefficient blocks side-by-side, mirroring the verbose visual style ofprint.brs().
Documentation
-
Complete
@examplesaudit: added runnable\donttest{}examples to all ~30 previously undocumented exported functions, including all S3 methods forbrsandbrsmmobjects (coef(),vcov(),logLik(),AIC(),BIC(),nobs(),formula(),model.matrix(),fitted(),residuals(),confint(),predict(),print(),summary(),ranef(),anova(),plot(),autoplot()). -
Removed all
set.seed()calls from examples across 15+ files (fit.R,brsmm.R,bootstrap.R,cv.R,marginaleffects.R,scoreprob.R,table.R,simulate.R,prepare.R,autoplot.R,autoplot-brsmm.R,loglik.R). All examples now use deterministic toy datasets. -
No
\dontrun{}anywhere: all examples are either direct or wrapped in\donttest{}as appropriate. -
Ferrari & Cribari-Neto (2004) DOI (
10.1080/0266476042000214501) added to every occurrence of that reference acrossbetaregscale-package.R,brsmm.R,methods.R,anova-methods.R, andbrsmm-random-effects-study.R. -
@seealsocross-links added to all S3 method documentation blocks for bothbrsandbrsmmobjects. -
brs_coef()documentation updated with deprecation notice,@description,@return, and@seealso. -
brs_hessian()documentation improved: added@param object,@seealso, and a deterministic example. -
print.brsmm_re_study()now has a complete roxygen2 block including@description,@param,@return,@method,@seealso, and@examples. -
ranef()generic now includes@param,@return,@seealso, and@examples. - All
autoplot.*examples updated to useggplot2::autoplot()(explicit namespace) for reliability in check environments.
betaregscale 2.6.7
CRAN resubmission (Konstanze Lauseker review, 20 Feb 2026)
Bug fixes and CRAN policy compliance
- Added
\valuedocumentation toprint.brs()andprint.summary.brs()methods. - Replaced
\dontrun{}with\donttest{}inbrs_gof()example and created complete executable example. - Removed
.GlobalEnvmodification frombrs_bootstrap()(CRAN policy violation). - Removed
set.seed()calls from exported functions:brs_bootstrap(),brs_marginaleffects(),brsmm(), andbrs_cv(). Users must now callset.seed()externally before these functions for reproducibility. - Removed
seedparameter from all four functions listed above. Documentation updated with recommended usage pattern.
betaregscale 2.6.6
CRAN resubmission (Uwe Ligges review, 18 Feb 2026)
- DESCRIPTION: function names in Title/Description now use parentheses (e.g.
logLik(),coef()) per CRAN policy. - URL updated to GitHub repository (https://github.com/evandeilton/betaregscale) while pkgdown site is deployed.
betaregscale 2.6.5
New features
- Extended
brs_bootstrap()withci_type = "bca"(bias-corrected and accelerated intervals), plus Monte Carlo diagnostics for interval endpoints (mcse_lower,mcse_upper). - Added Wald interval columns (
wald_lower,wald_upper) to bootstrap output for direct asymptotic vs resampling comparison. - Added
autoplot.brs_bootstrap()support to visually compare bootstrap and Wald intervals intype = "ci_forest". - Added
autoplot.brs_marginaleffects()with three views:forest,magnitude, anddist.
Improvements
- Improved robustness and efficiency in
brs_marginaleffects():- central-difference AME approximation for numeric covariates,
- scale-adaptive perturbation step,
- one-time simulation draw generation reused across variables,
- optional storage of AME draws via
keep_draws = TRUE.
- Refined
brs_cens()output to include richer summary fields (percentage,severity,interpretation) and optional domain-agnostic interpretation messages viainform = TRUE. - Updated README and vignettes with examples for BCa bootstrap intervals, bootstrap visual diagnostics, and enhanced marginal-effects visualization workflow.
betaregscale 2.6.4
New features
- Extended
brsmm()to support multivariate random effects in the mean predictor, including random intercept + random slope specifications such asrandom = ~ 1 + x | group. - Added multivariate Laplace approximation in the Eigen C++ backend for group-specific latent vectors and covariance matrix handling via packed lower-Cholesky parameterization.
- Added
brsmm_group_modes_eigen()to compute posterior modes of group random effects for general random-effects dimension. - Added generic model-comparison methods
anova.brs()andanova.brsmm()for likelihood-ratio workflow acrossbrsandbrsmmcandidates. - Added
brsmm_re_study()andprint.brsmm_re_study()for numeric random-effects diagnostics (covariance/correlation, shrinkage, normality checks).
Improvements
- Updated
predict.brsmm(),vcov.brsmm(), andprint.brsmm()to support both scalar (q_b=1) and vector (q_b>1) random-effects structures. - Expanded mixed-model test coverage with integration tests for random intercept + slope fits, covariance extraction (
D),ranef, random-effects studies, and prediction behavior. - Updated
README.mdand vignettes with explicit multivariate mixed-model mathematics, Laplace formula in matrix form, and end-to-end model-selection examples. - Documentation references now use DOI-based validated links only (
https://doi.org/...) to keep CRAN URL checks robust.
betaregscale 2.6.3
Improvements
- Revised and expanded all core vignettes (
brs-intro,brs-analyst-tools,brs-mm) with stronger mathematical exposition, explicit likelihood pieces by censoring type, and clearer inferential interpretation for analysts. - Updated vignettes and README to prioritize the package’s most important analyst-facing functions:
brs_bootstrap(),brs_marginaleffects(),brs_predict_scoreprob(),brs_cv(), andbrs_table(). - Standardized vignette outputs with cleaner tabular presentation using
knitr::kable(..., digits = 4)for better readability and reporting consistency. - Added and revised bibliographic references with validated DOI metadata and dual online source verification links in vignettes/README.
- Re-rendered all vignettes and rebuilt documentation website (
pkgdown) to keep articles and reference pages synchronized with the current API.
betaregscale 2.6.2
Improvements
- Improved numerical stability in
brsmm()by refining the optimization control and starting values. - Updated
simulate()method to better handle edge cases in random effects simulation. - Enhanced
methods.Rfor better compatibility with downstream packages.
betaregscale 2.6.0
New features
- Added
brsmm()for mixed-effects beta interval regression with Gaussian random intercepts (random = ~ 1 | group) using Laplace-approximated marginal likelihood. - Added C++ mixed-model likelihood core:
.brsmm_loglik_laplace_cpp()and.brsmm_group_modes_cpp(). - Added a first S3 interface for
brsmmobjects:print,summary,coef,vcov,logLik,AIC,BIC,nobs,fitted,predict, andresiduals.
betaregscale 2.5.0
New features
- Added
brs_table()to compare one or more fittedbrsmodels in a single table withlogLik,AIC,BIC, pseudo-R2, and censoring composition. - Added
brs_marginaleffects()for average marginal effects in the mean or precision submodel, with optional simulation-based uncertainty intervals. - Added
autoplot.brs()withggplot2diagnostics fortype = "calibration",type = "score_dist",type = "cdf", andtype = "residuals_by_delta". - Added
brs_predict_scoreprob()to obtain predicted probabilities on the original integer score scale. - Added
brs_cv()for repeated k-fold cross-validation ofbrsmodels with fold-level predictive metrics (log_score,rmse_yt, andmae_yt).
betaregscale 2.4.0
Breaking changes
-
brs_sim_var()is no longer exported. Variable-dispersion simulation is now done throughbrs_sim()using a two-part formula (for example,~ x1 + x2 | z1 + z2). -
brs_loglik()andbrs_loglik_var()are now internal helpers and are no longer part of the user-facing API.
Improvements
- Release documentation was updated to reflect the consolidated simulation API and current exported function set.
-
brs_prep()consistency warnings are emitted once per call on final prepared output, improving test stability and warning capture behavior.
betaregscale 2.3.0
Breaking changes
-
API Overhaul: All exported functions have been renamed to use the compact
brs_prefix for consistency and ease of typing.-
betaregscale()->brs() -
betaregscale_fit()->brs_fit_fixed() -
betaregscale_fit_z()->brs_fit_var() -
betaregscale_loglik()->brs_loglik() -
betaregscale_loglik_z()->brs_loglik_var() -
betaregscale_simulate()->brs_sim() -
betaregscale_simulate_z()->brs_sim_var() -
prepare_data()->brs_prep() -
check_response()->brs_check() -
censoring_summary()->brs_cens() -
beta_reparam()->brs_repar() -
gof()->brs_gof() -
est()->brs_est() -
hessian_matrix()->brs_hessian() -
betaregscale_coef()->brs_coef()
-
-
Class Renaming: The S3 class
betaregscalehas been renamed tobrs. All associated S3 methods have been updated accordingly (e.g.,summary.brs,plot.brs).
betaregscale 2.2.0
Breaking changes
typeargument removed: The deprecatedtypeargument has been completely removed from all functions:check_response(),prepare_data(),betaregscale(),betaregscale_fit(),betaregscale_fit_z(),betaregscale_loglik(),betaregscale_loglik_z(),betaregscale_simulate(),betaregscale_simulate_z(), and internal helperscompute_start(),.extract_response(),.build_simulated_response(), and.compute_endpoints(). The midpoint interval geometry (type = "m") is now the only option and is hardcoded internally. Users who previously relied ontype = "l"ortype = "r"should useprepare_data()to supply custom left/right endpoints instead.Renamed
bs_prepare()toprepare_data(): The data preparation function has been renamed toprepare_data()to be more descriptive and consistent with the package’s verb-based API. The returned data frame now carries theis_preparedattribute instead ofbs_prepared.
betaregscale 2.1.1
New features
-
deltaargument in simulation functions:betaregscale_simulate()andbetaregscale_simulate_z()gain adeltaargument (defaultNULL) that forces all simulated observations to a specific censoring type: 0 (exact), 1 (left), 2 (right), or 3 (interval). This enables targeted Monte Carlo studies where the analyst controls the censoring structure.When
deltais non-NULL, the actual simulated values (y_raw = rbeta(n, a, b)) are preserved on the scale grid, and the forced censoring indicator is passed tocheck_response()as a vector. This ensures that each observation retains its covariate-driven variation with observation-specific endpoints.The returned data frame carries
attr(, "bs_prepared") = TRUEso thatbetaregscale(),betaregscale_loglik(), and all fitting functions use the pre-computedleft,right,yt, anddeltacolumns directly, bypassing the automatic boundary classification. Without this attribute, the fitting pipeline would re-classify the response from theycolumn alone, which would ignore the forced delta. -
deltaargument incheck_response(): accepts an integer vector of pre-specified censoring indicators, overriding the automatic boundary-based classification on a per-observation basis. The endpoint formulas adapt to non-boundary observations:delta condition left (l_i) right (u_i) 0 any y / K y / K 1 y = 0 eps lim / K 1 y != 0 eps (y + lim) / K 2 y = K (K - lim) / K 1 - eps 2 y != K (y - lim) / K 1 - eps 3 type “m” (y - lim) / K (y + lim) / K The distinction between boundary and non-boundary observations is essential: when delta = 1 is forced on a non-zero y, the upper bound uses the actual y value ((y + lim)/K) rather than the fixed boundary formula (lim/K). This preserves the information content of each observation.
Observation-specific endpoints in
bs_prepare(): the internal.compute_endpoints()helper now uses the same adaptive formulas ascheck_response()for analyst-forced left/right censoring on non-boundary scores. Previously, delta = 1 always producedright = lim/Kand delta = 2 always producedleft = (K - lim)/K, regardless of the actual y value.
Bug fixes
-
Simulation with forced
delta = 1ordelta = 2: the internal.build_simulated_response()helper previously replaced all y values with boundary values (y_grid = rep(0, n)for delta = 1,y_grid = rep(ncuts, n)for delta = 2). This produced degenerate data where every observation had identical endpoints (e.g., allleft = 0.995, right = 0.99999for delta = 2), destroying all covariate-driven variation and making regression fitting impossible.The fix preserves the actual simulated grid values (
y_grid = round(y_raw * ncuts)) and passes a forced delta vector tocheck_response(), which computes observation-specific endpoints using the actual y values. Missing
"bs_prepared"attribute on simulation output: whendeltawas forced, the simulation functions did not mark the output withattr(, "bs_prepared") = TRUE. As a result,betaregscale()would re-classify the response viacheck_response(), silently overwriting the forced delta with automatic boundary rules. The attribute is now set correctly.
Deprecations
- The
typeparameter ("m","l","r") is deprecated across all functions:betaregscale(),betaregscale_fit(),betaregscale_fit_z(),betaregscale_loglik(),betaregscale_loglik_z(),betaregscale_simulate(),betaregscale_simulate_z(),check_response(), andprepare_data(). Useprepare_data()to control interval geometry instead. The parameter still works but emits a deprecation warning when passed explicitly.
betaregscale 2.0.1
New features
-
bs_prepare()data preprocessing: new analyst-facing function that validates, classifies censoring, and rescales raw data before model fitting. Supports four flexible input modes: score-only, score + explicit delta, interval endpoints with NA patterns, and analyst-supplied left/right bounds. Prepared data is automatically detected bybetaregscale(). - Internal helper
.extract_response()enables transparent detection ofbs_prepare()-processed data across all fitting, log-likelihood, and starting-value functions. -
censoring_summary()now also accepts data frames frombs_prepare(). - New vignette section documenting all four data preparation modes.
betaregscale 2.0.0
Breaking changes
- Removed dependency on
bbmle. All model fitting now usesstats::optim()directly with analytical gradients via the C++ backend. - The
betaregscale_bbmle()function has been removed. - The
cumulativeparameter has been replaced by thedeltaindicator vector, which supports mixed censoring types within the same dataset. - Parameter
dadosrenamed todataacross all functions. - Simulation functions renamed:
betaregscale_simula_dados()is nowbetaregscale_simulate(), andbetaregscale_simula_dados_z()is nowbetaregscale_simulate_z().
New features
- Mixed censoring support: the complete likelihood (Eq. 2.24) now handles four censoring types simultaneously: exact (), left-censored (), right-censored (), and interval-censored ().
- C++ backend rewrite: log-likelihood and analytical gradient functions rewritten in C++ (RcppArmadillo) for numerically stable, high-performance evaluation.
-
betareg-style S3 interface:
coef()andvcov()now acceptmodel = c("full", "mean", "precision")argument. - New S3 methods:
nobs(),formula(),model.matrix(),confint(), andplot(). -
confint()provides Wald confidence intervals based on the asymptotic normal approximation (z-test, not t-test). -
plot()method with six diagnostic panels (residuals vs indices, Cook’s distance, residuals vs linear predictor, residuals vs fitted, half-normal envelope, predicted vs observed) and both base R and ggplot2 backends. -
censoring_summary()function for visual and tabular summaries of the censoring structure, with both base R and ggplot2 backends. -
predict()expanded with five types:"response","link","precision","variance", and"quantile". Supportsnewdatafor both fixed and variable dispersion models. -
residuals()supports five types:"response","pearson","rqr"(randomized quantile residuals),"weighted", and"sweighted". -
summary()output now shows separate coefficient tables for mean and precision submodels with Wald z-tests.
