mmzame

Code for "Linking Social and Personal Preferences: Theory and Experiment"

https://github.com/erikosorensen/mmzame

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.7%) to scientific vocabulary
Last synced: 9 months ago · JSON representation ·

Repository

Code for "Linking Social and Personal Preferences: Theory and Experiment"

Basic Info
  • Host: GitHub
  • Owner: ErikOSorensen
  • License: bsd-3-clause
  • Language: HTML
  • Default Branch: master
  • Size: 113 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 6 years ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

Analysis code for Linking Social and Personal Preferences: Theory and Experiment

Authors:

Abstract: The attitudes of a Decision Maker toward riskless and risky choices—both personal choices and social choices—enter virtually every realm of individual decision-making. This paper asks when it is possible to link these attitudes. We provide a simple formalization of this question and necessary and sufficient conditions that such a link exists. We also offer an experimental test of the theory in which subjects were confronted with choices (involving monetary outcomes) in three domains: risky personal choices, riskless social choices and risky social choices. Revealed preference tests show that subject choices are generally consistent with utility maximization within each choice domain but frequently involve at least some errors. We test for consistency across choice domains using a novel nonparametric revealed preference test that accounts for these errors.

Overview

The master file this replication package will:

  1. Install the required versions of the necessary R packages from CRAN.
  2. Downloads the necessary datafiles from Harvard Dataverse.
  3. Create all the displays in the paper as separate files (documented below).
  4. Create markdown documents for numbers referenced in the paper but not explicitly part of produced tables.

On a powerful desktop computer, the replicator should expect the code to run for about 12 hours.

Data Availability

The experimental data used to support the findings of this study were collected by the authors. All data, with documentation, have been deposited in the public domain at Harvard Dataverse:

  • Zame, William R.; Tungodden, Bertil; Sørensen, Erik Ø.; Kariv, Shachar; Cappelen, Alexander W., 2021, "Replication Data for: Linking Social and Personal Preferences: Theory and Experiment", https://doi.org/10.7910/DVN/LUF59R, Harvard Dataverse, V2.

We certify that the author(s) of the manuscript have legitimate access to and permission to use the data used in this manuscript, and the data are licensed under a Creative Commons/CC0 license. See LICENSE_CC0.txt for details.

The data file is downloaded when the targets plan is first run.

The files available (and automatically downloaded from Harvard Dataverse and put in a a cached "target") are:

| Filename | Content | |----------|---------| | mmzamedecisions.tab | Decisions for each individual. | | mmzamebackground.tab | Short survey of participant demographics. |

For reference, copies of the data, in Stata format, and with pdf codebooks are available in the data_and_documentation subdirectory of the replication package.

Computational requirements

Software Requirements

  • R, the code was last run with version 4.5.
    • renv, the code was last run with version 1.1.4 (system curl is a dependency of renv, should come with Windows 10 and Mac OSX, easily installable on linux).
    • Other libraries and dependencies specified in the renv.lock file will be installed into a project specific library when the master file is run.
    • rmarkdown will require system pandoc, which is easiest installed with Rstudio.
  • The run_pipeline.sh script uses bash scripting, which may require Linux.

Controlled randomness

Random seed is set in _targets.R, line 36.

Memory and Runtime Requirements

The code was last run on a Ubuntu 20.04.6 system, on a VMWare virtual desktop running on top of AMD EPYC 7543P 32-Core Processor. Memory requirements are limited, at around 200 MB per worker node. Disk use is very limited (at less than 0.5GB). Approximate time needed to reproduce all the analyses on this machine is about 12 hours.

With a less powerful system, it would be good to adjust the following line in main.R:

tar_make_future(workers = 26)

The number of workers should not be larger than the number of threads the computer can comfortably run in parallel. There are 20 long running worker nodes. Parallelization is handled by Henrik Bengtsson's future library. The full potential efficiency gains from parallelization are not achieved, but ordinary desktop computers will be fully occupied.

Description of programs/code

  • run_pipeline.sh: Top level shell script. Runs all code and write logs.
  • main.R: Top level R code to run and generate all outputs.
  • _targets.R: Specification of DAG for creating all outputs using Will Landau's targets package.
  • functions.R: Function definitions called by the targets defined in _targets.R.
  • renv.lock: Specification of necessary libraries (and version) for running the code.
  • .Rprofile: Ensures that renv loads local libraries.

The graphical displays are produced in the graphs/ directory (as .pdf-files). The tabular displays are produced in the tables/ directory (as .tex-files, some of which are edited for visual display to be part of the paper. The other numbers and descriptions produced are part of the vignettes that are rendered in the vignettes/ directory.

The code is organized such that the _targets.R specifies all computationally intensive outputs, with special targets ("vignettes") to create human readable output using markdown. The display items (tables and graphs) are produced as side-effects of the vignettes: The vignettes loads the calculated targets and writes .pdf and .tex files to disk in accordance with the table below.

License for Code

The code is licensed under a BSD-3-Clause license. See LICENSE_BSD-3-Clause.txt for details.

Instructions to Replicators

On a linux computer, from the command line, the replicator should run the top script

bash run_pipeline.sh

This will run the main.R script in the background, which will automate the creation of all results.

The first time it is run, this will install a local library of R packages from CRAN, download the data from Harvard Dataverse, and build all the targets specified in _targets.R (a specification of a directed acyclic graph of dependencies for generating all necessary displays and descriptions). Running the script for the first time, the replicatior should expect a substantial chain of dependencies to be installed on the local computer, dependending on compute power and internet connection, this migth take an hour +/-.

The targets system is smart about caching intermediate results, so while running main.R takes a considerable amount of time for the first run, minor adjustments to the output routines in the vignettes are do not require the heavy computations to be re-run, and running main.R for the second time is almost free of costs with respect to changes in the display layer if the tar_destroy() line in the main.R file is commented out..

List of tables and programs

The provided code reproduces all numbers provided in text in the paper. The table below indicates where and how the displays are produced. Note that while the point at which displays are save is recorded in the table below, there are dependencies (as described in _targets.R) such that it is always safest to run the main.R script to generate the displays. While .pdf figures are listed in the table below, the same figures are also exported as .eps figures (with the same basename).

| Display Item | Program |Line Number | Display file name | Note | |-------------------|--------------------------|-------------|----------------------------------|---------------------------------| | Table 1 | vignettes/longtableindividuals.Rmd | 175 | tables/maintable.tex | | | Table 2A | vignettes/testingtheory.Rmd | 187| tables/powerA.tex | | | Table 2B | vignettes/testingtheory.Rmd | 208 | tables/powerB.tex | | | Figure 1 | n.a. (no data) | | Figures1.pdf | (theoretical illustration) | | Figure 2 | n.a. (no data) | | Figures2.pdf | (theoretical illustration) | | Figure 3 |vignettes/aggregatebehavior.Rmd | 170 | graphs/aggregatechoices.pdf | | | Figure 4 |vignettes/individualbehavior.Rmd | 117 | graphs/logpricescatters.pdf | | | Figure 5 |vignettes/testingrationality.Rmd | 99 | graphs/empiricalcceis.pdf | | | Figure 6 |vignettes/testingrationality.Rmd | 151 | graphs/empiricalcceisandBronars.pdf | | | Figure 7 |vignettes/testingtheory.Rmd | 82 | graphs/prop3permutations.pdf | | | Appendix Table 1 | n.a. (no data) | | | (theoretical illustration) | | Appendix Table 2 | vignettes/backgroundtable.Rmd | 52 | tables/TableA1.tex | | | Appendix Table 3 | vignettes/longtableindividuals.Rmd | 236 | tables/main_tableC.tex | |

Owner

  • Name: Erik Ø. Sørensen
  • Login: ErikOSorensen
  • Kind: user
  • Location: Norway
  • Company: NHH Norwegian School of Economics

Professor of economics at NHH Norwegian School of Economics. Works on social preferences and applied econometrics.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  Analysis code for "Linking Social and Personal
  Preferences: Theory and Experiment"
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: William R.
    family-names: Zame
    email: zame@econ.ucla.edu
    affiliation: 'University of California, Los Angeles'
    orcid: 'https://orcid.org/0000-0002-3111-5842'
  - given-names: Bertil
    family-names: Tungodden
    email: bertil.tungodden@nhh.no
    affiliation: NHH Norwegian School of Economics
    orcid: 'https://orcid.org/0000-0002-4182-8491'
  - given-names: Erik Ø.
    family-names: Sørensen
    email: erik.sorensen@nhh.no
    affiliation: NHH Norwegian School of Economics
    orcid: 'https://orcid.org/0000-0002-7155-4188'
  - given-names: Shachar
    family-names: Kariv
    email: kariv@berkeley.edu
    affiliation: 'University of California, Berkeley'
    orcid: 'https://orcid.org/0000-0002-1382-3917'
  - given-names: Alexander W.
    family-names: Cappelen
    email: alexander.cappelen@nhh.no
    affiliation: NHH Norwegian School of Economics
    orcid: 'https://orcid.org/0000-0002-3489-7085'
identifiers:
  - type: doi
    value: 10.7910/DVN/LUF59R
    description: Contains the necessary data.
abstract: >+
  The attitudes of a Decision Maker toward riskless
  and risky choices—both personal choices and social
  choices—enter virtually every realm of individual
  decision-making. This paper asks when it is
  possible to link these attitudes. We provide a
  simple formalization of this question and necessary
  and sufficient conditions that such a link exists.


  We also offer an experimental test of the theory in
  which subjects were confronted with choices
  (involving monetary outcomes) in three domains:
  risky personal choices, riskless social choices and
  risky social choices. Revealed preference tests
  show that subject choices are generally consistent
  with utility maximization within each choice domain
  but frequently involve at least some errors. We
  test for consistency across choice domains using a
  novel nonparametric revealed preference test that
  accounts for these errors.


  The master file this replication package will:


  1. Install the required versions of the necessary
  `R` packages from CRAN.

  2. Downloads the necessary datafile from Harvard
  Dataverse.

  3. Create all the displays in the paper as separate
  files (documented below).

  4. Create markdown documents for numbers referenced
  in the paper but not explicitly part of produced
  tables.

license: BSD-3-Clause

GitHub Events

Total
  • Push event: 12
Last Year
  • Push event: 12