%global __brp_check_rpaths %{nil} %global __requires_exclude ^libmpi %global packname hdbayes %global packver 0.2.0 %global rlibdir /usr/local/lib/R/library Name: R-CRAN-%{packname} Version: 0.2.0 Release: 1%{?dist}%{?buildtag} Summary: Bayesian Analysis of Generalized Linear Models with Historical Data License: MIT + file LICENSE URL: https://cran.r-project.org/package=%{packname} Source0: %{url}&version=%{packver}#/%{packname}_%{packver}.tar.gz BuildRequires: R-devel >= 4.2.0 Requires: R-core >= 4.2.0 BuildRequires: R-CRAN-instantiate >= 0.1.0 BuildRequires: R-CRAN-callr BuildRequires: R-CRAN-fs BuildRequires: R-CRAN-formula.tools BuildRequires: R-stats BuildRequires: R-CRAN-posterior BuildRequires: R-CRAN-enrichwith BuildRequires: R-CRAN-bridgesampling BuildRequires: R-CRAN-mvtnorm BuildRequires: R-CRAN-loo Requires: R-CRAN-instantiate >= 0.1.0 Requires: R-CRAN-callr Requires: R-CRAN-fs Requires: R-CRAN-formula.tools Requires: R-stats Requires: R-CRAN-posterior Requires: R-CRAN-enrichwith Requires: R-CRAN-bridgesampling Requires: R-CRAN-mvtnorm Requires: R-CRAN-loo %description User-friendly functions for leveraging (multiple) historical data set(s) in Bayesian analysis of generalized linear models (GLMs) and survival models, along with support for Bayesian model averaging (BMA). The package provides functions for sampling from posterior distributions under various informative priors, including the prior induced by the Bayesian hierarchical model, power prior by Ibrahim and Chen (2000) , normalized power prior by Duan et al. (2006) , normalized asymptotic power prior by Ibrahim et al. (2015) , commensurate prior by Hobbs et al. (2011) , robust meta-analytic-predictive prior by Schmidli et al. (2014) , latent exchangeability prior by Alt et al. (2024) , and a normal (or half-normal) prior. The package also includes functions for computing model averaging weights, such as BMA, pseudo-BMA, pseudo-BMA with the Bayesian bootstrap, and stacking (Yao et al., 2018 ), as well as for generating posterior samples from the ensemble distributions to reflect model uncertainty. In addition to GLMs, the package supports survival models including: (1) accelerated failure time (AFT) models, (2) piecewise exponential (PWE) models, i.e., proportional hazards models with piecewise constant baseline hazards, and (3) mixture cure rate models that assume a common probability of cure across subjects, paired with a PWE model for the non-cured population. Functions for computing marginal log-likelihoods under each implemented prior are also included. The package compiles all the 'CmdStan' models once during installation using the 'instantiate' package. %prep %setup -q -c -n %{packname} # fix end of executable files find -type f -executable -exec grep -Iq . {} \; -exec sed -i -e '$a\' {} \; # prevent binary stripping [ -d %{packname}/src ] && find %{packname}/src -type f -exec \ sed -i 's@/usr/bin/strip@/usr/bin/true@g' {} \; || true [ -d %{packname}/src ] && find %{packname}/src/Make* -type f -exec \ sed -i 's@-g0@@g' {} \; || true # don't allow local prefix in executable scripts find -type f -executable -exec sed -Ei 's@#!( )*/usr/local/bin@#!/usr/bin@g' {} \; %build %install mkdir -p %{buildroot}%{rlibdir} %{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname} test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so) rm -f %{buildroot}%{rlibdir}/R.css # remove buildroot from installed files find %{buildroot}%{rlibdir} -type f -exec sed -i "s@%{buildroot}@@g" {} \; %files %{rlibdir}/%{packname}