Package: OptHoldoutSize 0.1.0.3

OptHoldoutSize: Estimation of Optimal Size for a Holdout Set for Updating a Predictive Score

Predictive scores must be updated with care, because actions taken on the basis of existing risk scores causes bias in risk estimates from the updated score. A holdout set is a straightforward way to manage this problem: a proportion of the population is 'held-out' from computation of the previous risk score. This package provides tools to estimate a size for this holdout set and associated errors. Comprehensive vignettes are included. Please see: Haidar-Wehbe S, Emerson SR, Aslett LJM, Liley J (2022) <doi:10.48550/arXiv.2202.06374> (in Annals of Applied Statistics) for details of methods.

Authors:Sami Haidar-Wehbe [aut], Sam Emerson [aut], Louis Aslett [aut], James Liley [cre, aut]

OptHoldoutSize_0.1.0.3.tar.gz
OptHoldoutSize_0.1.0.3.zip(r-4.7-any)OptHoldoutSize_0.1.0.3.zip(r-4.6-any)OptHoldoutSize_0.1.0.3.zip(r-4.5-any)
OptHoldoutSize_0.1.0.3.tgz(r-4.6-any)OptHoldoutSize_0.1.0.3.tgz(r-4.5-any)
OptHoldoutSize_0.1.0.3.tar.gz(r-4.7-any)OptHoldoutSize_0.1.0.3.tar.gz(r-4.6-any)
OptHoldoutSize_0.1.0.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
OptHoldoutSize/json (API)

# Install 'OptHoldoutSize' in R:
install.packages('OptHoldoutSize', repos = c('https://jamesliley.r-universe.dev', 'https://cloud.r-project.org'))
Datasets:

On CRAN:

Conda:

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

3.48 score 7 scripts 404 downloads 30 exports 8 dependencies

Last updated from:67fbe7362a. Checks:7 WARNING, 2 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develWARNING149
source / vignettesOK193
linux-releaseWARNING166
macos-releaseWARNING117
macos-oldrelWARNING116
windows-develWARNING158
windows-releaseWARNING99
windows-oldrelWARNING78
wasm-releaseOK92

Exports:add_aspre_interactionsaspreaspre_k2ci_mincostci_ohscov_fnerror_ohs_emulationexp_imp_fngen_base_coefsgen_predsgen_respgrad_mincost_powerlawgrad_nstar_powerlawlogisticlogitmodel_predictmodel_trainmu_fnnext_noptimal_holdout_sizeoptimal_holdout_size_emulationoracle_predpowerlawpowersolvepowersolve_generalpowersolve_sepsi_fnsens10sim_random_aspresplit_data

Dependencies:latticeMatrixmatrixStatsmnormtmvtnormrangerRcppRcppEigen

ASPRE example
Introduction | Estimation of optimal holdout size | Parameters $N$ and $k_1$ | Simulation of dataset | Computation of OHS using parametric method | Start with estimates of k2 at 10 values of n | Candidate values for n | Starting value for theta | Rough estimate for variance of k2 | Successively add new points | Resample k2(n), to avoid double-dipping effect | Transform to total cost | Save | Begin as for parametric approach | Transform estimated k2 to costs

Last update: 2026-10-09
Started: 2022-02-09

Comparison of algorithms
Introduction | Setup | Assumptions throughout | General setup | Demonstration of algorithms | Parametric assumptions | Simulate data | Resample values d | Estimate a,b, and c from values nset and d | Estimate optimal holdout sizes using parametric method | Estimate optimal holdout sizes using semi-parametric (emulation) method | To draw plot: | These are our sets of training sizes and k2 estimates, which will be built up. | Go up to this many points | Estimate parameters | Find next suggested point, parametric assumptions satisfied | Find next suggested point, parametric assumptions not satisfied | New estimates of k2 | Update data | Sys.sleep(10) | To draw plot with np points (np can be set using the button) | Estimate parameters for parametric part of semi-parametric method | First panel | Second panel | Rates of convergence | Load datasets of 'next point' | Maximum number of training set sizes we will consider | Generate random 'next points' | Initialise matrices of records | ohs_array[n,i,j,k,l] is | using the first n training set sizes | the ith resample | using the jth version of k2 (j=1: pTRUE, j=2: pFALSE) | using the kth algorithm (k=1: parametric, k=2: semiparametric/emulation) | using the lth method of selecting next points (l=1: random, l=2: systematic) | Resamplings for parametric algorithm, random next point | Resamplings for semiparametric/emulation algorithm, random next point | Resamplings for parametric algorithm, nonrandom (systematic) next point | Resamplings for semiparametric/emulation algorithm, nonrandom (systematic) next point | Load data | Settings | Plot drawing function | Set up plot parameters | Number of estimates | Initialise | Plot medians | Ranges | Coarsening factor: coarsen OHS estimates to nearest value | Record lengths of rounded OHS numbers | Plot ranges | Add legend | Bottom panel setup | Root mean square errors | Draw lines | Extract matrices from aray | True OHS | True functions l

Last update: 2025-04-09
Started: 2022-02-09

Simulated example
Introduction | Setup | Assumptions | General setup | Results | Emergence of optimal holdout size | Cost of true negative, false positive etc for computing total cost | Generate coefficients for underlying model and for predictions in h.o. set | Set ground truth coefficients, and the accuracy at baseline | Run simulation | If ninters>0, append coefficients for interaction terms to coefficients | Collate and save all data | Load data | Holdout set size in absolute terms | Colour intensities | Draw cost function | Cost values | Initialise plot for cost function | Plot Cost line | Standard Deviation Bands | Add legend | Draw k2 function | Evaluate k2(n)*(N-n) | Evaluate k2 | Scalinge factor (for plotting) | Initialise plot for k2 function | Line for estimated k2(n) | Add standard deviation of k2(n). | Line for estimated k2(n)*(N-n) | Add standard deviation for k2(n)*(N-n) | Draw k1*n function | Evaluate k1 | Line for estimated k1*n | Add standard deviation. Note this is scaled by (nobs-n_ho) | Loop through values of 'families' and 'interactions'

Last update: 2025-04-09
Started: 2022-02-09

Readme and manuals

Help Manual

Help pageTopics
Add interaction terms corresponding to ASPRE modeladd_aspre_interactions
Computes ASPRE scoreaspre
Emulation-based OHS estimation for ASPREaspre_emulation
Cost estimating function in ASPRE simulationaspre_k2
Parametric-based OHS estimation for ASPREaspre_parametric
Data for example on asymptotic confidence interval for OHS.ci_cover_a_yn
Data for example on asymptotic confidence interval for min cost.ci_cover_cost_a_yn
Data for example on empirical confidence interval for min cost.ci_cover_cost_e_yn
Data for example on empirical confidence interval for OHS.ci_cover_e_yn
Confidence interval for minimum total cost, when estimated using parametric methodci_mincost
Confidence interval for optimal holdout size, when estimated using parametric methodci_ohs
Covariance function for Gaussian processcov_fn
Data for vignette showing general exampledata_example_simulation
Data for 'next point' demonstration vignette on algorithm comparison using emulation algorithmdata_nextpoint_em
Data for 'next point' demonstration vignette on algorithm comparison using parametric algorithmdata_nextpoint_par
Measure of error for emulation-based OHS emulationerror_ohs_emulation
Expected improvementexp_imp_fn
Coefficients for imperfect risk scoregen_base_coefs
Generate matrix of random observationsgen_preds
Generate responsegen_resp
Gradient of minimum cost (power law)grad_mincost_powerlaw
Gradient of optimal holdout size (power law)grad_nstar_powerlaw
Logisticlogistic
Logitlogit
Make predictionsmodel_predict
Train model (wrapper)model_train
Updating function for mean.mu_fn
Finds best value of n to sample nextnext_n
Data for vignette on algorithm comparisonohs_array
Data for vignette on algorithm comparisonohs_resample
Estimate optimal holdout size under parametric assumptionsoptimal_holdout_size
Estimate optimal holdout size under semi-parametric assumptionsoptimal_holdout_size_emulation
Generate responsesoracle_pred
Parameters of reported ASPRE datasetparams_aspre
Plot estimated cost functionplot.optholdoutsize
Plot estimated cost function using emulation (semiparametric)plot.optholdoutsize_emul
Power law functionpowerlaw
Fit power law curvepowersolve
General solver for power law curvepowersolve_general
Standard error matrix for learning curve parameters (power law)powersolve_se
Updating function for variance.psi_fn
Sensitivity at theshold quantile 10%sens10
Simulate random dataset similar to ASPRE training datasim_random_aspre
Split datasplit_data