This is the replication materials for the paper titled: “Variable-r in sex ratios: Formulas in honor of Jim Vaupel” by Vladimir Canudas-Romo, Wen Su, Mike Hollingshaus. The data are sourced from the Human Mortality Database (HMD) and for the U.S. also: the U.S. Social Security Agency (SSA, Bell and Miller, 2005), the Centers for Disease Control and prevention (2020), and the U.S. Census Bureau (2016). The user will need to change the working directories as indicated at the top of the programs after the libraries( ): into a folder where the HMD data is stored and a folder where the U.S. given data (USA2010100.txt and USA2020100.txt) is stored. The two U.S. data for 2010 (USA2010100.txt) and 2020 (USA2020100.txt) include for each age and by sex their corresponding: Population and birth counts, as well as their population proportion and cohort probabilities of survival and migration. Also for each age the sex ratios and the sex ratios at birth, and for cohort survival and cohort migration are included. All calculations are made in the open-sourced software R 4.2. Here is a list of files with their functionality, please run in this order: 1) Functions.R -> Functions to carry out the decomposition 2) Fig1sexratio_trend -> Figure 1 in the manuscript 3) Fig2sexratio_comp_trend.R -> Figure 2 in the manuscript for selected countries 4) Fig3decomp_results.R -> creates Figure 3 in the manuscript and other figures in the Appendix