Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

RUM_replication

Replication package for "Approximating Choice Data by Discrete Choice Models" (Chang, Narita & Saito).

This package is created with the help of Claude.

The repository is organised one directory per exhibit, named after the exhibit's LaTeX \label{} so that a grep in the manuscript and the folder name always agree. Each exhibit directory is self-contained: it holds the code that produces the exhibit, the aggregated numbers, and the LaTeX fragment for the paper.

data/          inputs — the two datasets, built from source by script
dvd/           exhibits estimated on the Amazon DVD data
fish/          exhibits estimated on the fishing-site data

data/ — inputs

Everything downstream reads from here; no script hard-codes characteristics. Each subfolder has one prepare_*.R that regenerates its CSVs from the source, plus a README documenting provenance and construction.

folder build script what it produces
data/dvd/ prepare_dvd_data.R dvd_J4_K2.csv (main text, |J|=4) and dvd_J10_K3.csv (appendix, |J|=10), derived from farias2009_table2.csv — a hand transcription of Table 2 of Farias, Jagabathula & Shah (2009), itself reproduced in the paper as tab:amazon_dvd
data/fish/ prepare_fish_data.R fish_individual.csv (4,728 rows = 1,182 individuals × 4 modes), fish_aggregated.csv, fish_empirical_cp.csv and fish_J4_K2.csv, all from the Fishing dataset in the R package mlogit

dvd/ and fish/ — the exhibits

Both folders have the same shape; they differ only in the dataset the exhibits sit on.

dvd/ — DVD products, |J| = 4 (main text) or 10 (appendix):

folder exhibit
tbl_apx_error1/ approximation errors to rho^pi, no fixed effects
tbl_apx_error2/ the same with a grid of fixed effects (the large one — a 9,261-point grid × 6 cases × 2 degrees)
tbl_subs/ substitution / unrepresentable-ranking exercise
fig_approx_error_J10/ the appendix figure at `

fish/ — fishing-site choice, |J| = 4:

folder exhibit
tbl_fish_apx_error1/ fish counterpart of tbl_apx_error1
tbl_fish_apx_error2/ fish counterpart of tbl_apx_error2, with fish's own six unrepresentable rankings
tbl_fish_subs/ fish counterpart of tbl_subs
tbl_in_sample_d1/ in-sample fit: our EM against six benchmark discrete-choice models, over 50 train/test splits
tbl_out_sample/ out-of-sample fit — no computation of its own; it collects the same run as tbl_in_sample_d1

What lives inside an exhibit folder

<dataset>/<paper label>/
    README.md      where the exhibit appears in the paper, its design and
                   settings, and how to run it
    code/          the estimation scripts (Python for greedy/EM, R for the
                   benchmark models), the SLURM submit scripts, collect.R and
                   make_tex.R
    output/        aggregated results — <label>.csv, plus the figure PNG where
                   there is one
    table_latex/   <label>.tex, the fragment for the manuscript

Two conventions worth knowing:

  • code/ always splits into three roles: submit_*.sh fans the work out over a SLURM array, collect.R aggregates the per-task results into the exhibit's single CSV, and make_tex.R turns that CSV into the LaTeX fragment. The collectors stop with a clear message when no results are present, so running one early is harmless.
  • Printed values are truncated, not rounded. Every make_tex.R formats with floor(x * 1000) / 1000 at three decimals, and each generated .tex says so in its own note. The output/*.csv files carry the unrounded figures.

A few exhibits carry extra folders for their own bookkeeping:

  • fish/tbl_fish_apx_error2/to_do_list_GREEDY/ — the per-(case, degree) task lists that drive the twelve greedy arrays, generated by code/make_todo_list_GREEDY.R.
  • fish/tbl_in_sample_d1/output/ — the only exhibit whose per-task artefacts are kept: splits/ (the 50 train/test partitions), em_input/ (those splits converted to the Python EM's input format) and raw/ (per-task benchmark and EM results). The two fit tables are one computation: submit_benchmarks.sh runs the R models, then submit_em.sh runs the Python EM on their output, and each of the two exhibits then runs its own collect.R.

Running an exhibit

Submit from the exhibit directory — --output paths in the submit scripts resolve relative to wherever you run sbatch:

cd dvd/tbl_apx_error1
sbatch code/submit_greedy.sh && sbatch code/submit_em_vertices.sh
Rscript code/collect.R      # -> output/tbl_apx_error1.csv
Rscript code/make_tex.R     # -> table_latex/tbl_apx_error1.tex

Each exhibit's own README gives its exact submit sequence, array sizes, and the settings its collector expects.

Not included

Exhibits that need no computation: fig:aff_ind and fig:P_r (inline TikZ), the Notation table, and tab:amazon_dvd (the transcription of Farias et al. 2009, which is kept as data at data/dvd/farias2009_table2.csv).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages