Skip to content

cramR

Cram Method for Efficient Simultaneous Learning and Evaluation

v0.1.1 · Aug 24, 2025 · GPL-3

Description

Performs the Cram method, a general and efficient approach to simultaneous learning and evaluation using a generic machine learning algorithm. In a single pass of batched data, the proposed method repeatedly trains a machine learning algorithm and tests its empirical performance. Because it utilizes the entire sample for both learning and evaluation, cramming is significantly more data-efficient than sample-splitting. Unlike cross-validation, Cram evaluates the final learned model directly, providing sharper inference aligned with real-world deployment. The method naturally applies to both policy learning and contextual bandits, where decisions are based on individual features to maximize outcomes. The package includes cram_policy() for learning and evaluating individualized binary treatment rules, cram_ml() to train and assess the population-level performance of machine learning models, and cram_bandit() for on-policy evaluation of contextual bandit algorithms. For all three functions, the package provides estimates of the average outcome that would result if the model were deployed, along with standard errors and confidence intervals for these estimates. Details of the method are described in Jia, Imai, and Li (2024) <https://www.hbs.edu/ris/Publication%20Files/2403.07031v1_a83462e0-145b-4675-99d5-9754aa65d786.pdf> and Jia et al. (2025) <doi:10.48550/arXiv.2403.07031>.

Downloads

219

Last 30 days

14985th

479

Last 90 days

479

Last year

Trend: -15.8% (30d vs prior 30d)

CRAN Check Status

3 NOTE
11 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 NOTE
r-oldrel-macos-x86_64 NOTE
r-oldrel-windows-x86_64 NOTE
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (14 non-OK)
OK r-devel-linux-x86_64-debian-clang

*


            
OK r-devel-linux-x86_64-debian-gcc

*


            
OK r-devel-linux-x86_64-fedora-clang

*


            
OK r-devel-linux-x86_64-fedora-gcc

*


            
OK r-devel-macos-arm64

*


            
OK r-devel-windows-x86_64

*


            
NOTE r-oldrel-macos-arm64

installed package size

  installed size is  5.2Mb
  sub-directories of 1Mb or more:
    doc    2.2Mb
    help   2.4Mb
NOTE r-oldrel-macos-x86_64

installed package size

  installed size is  5.2Mb
  sub-directories of 1Mb or more:
    doc    2.2Mb
    help   2.4Mb
NOTE r-oldrel-windows-x86_64

installed package size

  installed size is  5.2Mb
  sub-directories of 1Mb or more:
    doc    2.2Mb
    help   2.4Mb
OK r-patched-linux-x86_64

*


            
OK r-release-linux-x86_64

*


            
OK r-release-macos-arm64

*


            
OK r-release-macos-x86_64

*


            
OK r-release-windows-x86_64

*


            

Check History

NOTE 11 OK · 3 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 9, 2026
NOTE r-oldrel-macos-arm64

installed package size

  installed size is  5.2Mb
  sub-directories of 1Mb or more:
    doc    2.2Mb
    help   2.4Mb
NOTE r-oldrel-macos-x86_64

installed package size

  installed size is  5.2Mb
  sub-directories of 1Mb or more:
    doc    2.2Mb
    help   2.4Mb
NOTE r-oldrel-windows-x86_64

installed package size

  installed size is  5.2Mb
  sub-directories of 1Mb or more:
    doc    2.2Mb
    help   2.4Mb

Dependency Network

Dependencies Reverse dependencies caret grf glmnet stats (>= 4.3.3) magrittr doParallel foreach DT data.table keras (>= 2.15.0) dplyr purrr R6 rjson R.devices +2 more dependencies cramR

Version History

new 0.1.1 Mar 9, 2026