<jupyter_start><jupyter_text>How much would somebody converted to veganism via Twitter reduce demand for animal products? To keep it simple, only looking at food rather than eg clothing<jupyter_code>import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
import seaborn as sns

from IPython.core.display import display, HTML<jupyter_output><empty_output><jupyter_text>prompted by Tweet:<jupyter_code>display(HTML('<img src="images/tweet.png" , width=500/>'))<jupyter_output><empty_output><jupyter_text>1. Average lifespan - average age of Twitter user = years of animal consumption savedAverage lifespan: presume the converted user is in US<jupyter_code>display(HTML('<img src="https://api.backlinko.com/app/uploads/2021/05/twitter-users-by-country-768x584.webp" title="Twitter users by country" , width=500/>'))<jupyter_output><empty_output><jupyter_text>Average age of Twitter user (presume US is representative)https://www.statista.com/statistics/192703/age-distribution-of-users-on-twitter-in-the-united-states/<jupyter_code>age_groups = {
'13-17': 6.6,
'18-24': 17.1,
'25-34': 38.5,
'35-49': 20.7,
'50+': 17.1}
labels = age_groups.keys()
y_pos = np.arange(len(labels))
values = age_groups.values()

ax = plt.bar(y_pos, values, align='center', alpha=0.8)
plt.xticks(y_pos, labels)
plt.ylabel('%')
plt.title('Twitter users by age')

plt.show()
# simplified: linear interpolation to get average age
before_median = age_groups['13-17'] + age_groups['18-24']
average_age_twt_user = (((50 - before_median) / age_groups['25-34']) * (34-24)) + 24
print(f"Average age of Twitter user: {average_age_twt_user:.0f} years old")<jupyter_output>Average age of Twitter user: 31 years old<jupyter_text>average life expectancy (remaining lifespan) of a 31-year old American is 47.5 years: 45 years for men, 50 years for womenhttps://www.health.ny.gov/health_care/medicaid/publications/docs/adm/06adm-5att8.pdf![image.png](images/life_expectancy.png)<jupyter_code>life_expectancy = 47.5<jupyter_output><empty_output><jupyter_text>consumption of beef, dairy, lamb, chicken, eggshttps://www.nationalchickencouncil.org/about-the-industry/statistics/per-capita-consumption-of-poultry-and-livestock-1965-to-estimated-2012-in-pounds/fish from https://aboutseafood.com/about/top-ten-list-for-seafood-consumption/<jupyter_code>labels = ['Beef', 'Pork', 'Chicken', 'Turkey', 'Fish & Shell-Fish']
values = [57., 49.9, 98.8, 15.3, 16.1]
animal_pounds_consumed = dict(zip(labels, values))
animal_pounds_consumed
labels = animal_pounds_consumed.keys()
y_pos = np.arange(len(labels))
values = animal_pounds_consumed.values()

ax = plt.bar(y_pos, values, align='center', alpha=0.8)
plt.bar_label(ax, label_type = 'center', padding=0)
plt.xticks(y_pos, labels)
plt.ylabel('pounds consumed per year')
plt.title('US: animal meat consumed per year, lbs')

plt.show()
#https://www.statista.com/statistics/183678/per-capita-consumption-of-eggs-in-the-us-since-2000/
eggs = 285 # units
# https://unitedegg.com/facts-stats/#:~:text=U.S.%20Egg%20Production%20and%20Hen%20Population&text=The%20U.S.%20had%20325%20million,produces%20296%20eggs%20per%20year.
eggs_per_chicken_per_year = 296
# https://www.idfa.org/news/u-s-dairy-consumption-beats-expectations-in-2020-and-continues-to-surge-upward-despite-disruption-caused-by-pandemic#:~:text=Last%20year%2C%20the%20average%20American,person%20over%20the%20previous%20year.
dairy = 655 # lbs
# https://www.statista.com/statistics/194935/quantity-of-milk-produced-per-cow-in-the-us-since-1999/
milk_per_cow_pa = 24265
dairy_life = 4 # years of milking before slaughter (assuming milk from 2 years, slaughtered at 6)
# assume (crudely) that 10% of beef is cull dairy, so as not to overcount
# https://academic.oup.com/jas/article-abstract/99/7/skab192/6298574
# not currently used, but will be if more sophisticated
cull_dairy = .1
# https://www.telegraph.co.uk/news/earth/earthnews/3353985/One-third-of-fish-caught-worldwide-used-as-animal-feed.html#:~:text=One%2Dthird%20of%20fish%20caught,directly%20nourish%20humans%2C%20scientists%20claim.
# not currently used, but will be if more sophisticated
fish_animal_feed = 1/3
# https://aboutseafood.com/about/top-ten-list-for-seafood-consumption/
fish_consumed = { # all in lbs per year
    'shrimp':4.6,
    'salmon':2.55,
    'tuna':2.1,
}
total_fish_consumed = 16.1
fish_consumed['other'] = (1 - (sum(fish_consumed.values()) / total_fish_consumed)) * total_fish_consumed
sum(fish_consumed.values()) == total_fish_consumed
fish_weights_lbs = {
    'shrimp': (1/45), # https://stripedspatula.com/shrimp-sizes/
    'salmon': 10, # https://www.fws.gov/fisheries/freshwater-fish-of-america/atlantic_salmon.html
    'tuna': 200, # https://www.mass.gov/service-details/learn-about-atlantic-bluefin-tuna
    'other': 2, # guess, given makeup
}
# calculated weighted average weight fish & shellfish
fish_consumed_per_year = dict()
for fish, weight in fish_consumed.items():
    fish_consumed_per_year[fish] = weight / fish_weights_lbs[fish]
fish_consumed_per_year
labels = fish_consumed_per_year.keys()
y_pos = np.arange(len(labels))
values = fish_consumed_per_year.values()

ax = plt.bar(y_pos, values, align='center', alpha=0.8)
plt.bar_label(ax, label_type = 'center', padding=8)
plt.xticks(y_pos, labels)
plt.ylabel('fish per year')
plt.title('US: fish consumed per year')

plt.show()
# carcass weights deboned and trimmed, in lbs
carcass_weights = {
    'Beef': 500, # https://extension.tennessee.edu/publications/documents/pb1822.pdf
    'Pork': 140, # https://www.gourmetsleuth.com/articles/detail/pork-cut-yield-per-hog
    'Chicken': 3, # http://jaysonlusk.com/blog/2021/6/17/beef-chicken-and-carbon - assume 3lbs meat from 4.5lbs carcass
    'Turkey': 8, # https://www.forbes.com/sites/bethhoffman/2012/11/16/stop-buy-a-smaller-turkey/
}
cows_saved_per_year = animal_pounds_consumed['Beef'] / carcass_weights['Beef']
cows_saved = cows_saved_per_year * life_expectancy

# this is from beef, now calculated dairy
dairy_cows_saved = dairy / milk_per_cow_pa * life_expectancy

total_cows_saved = cows_saved + dairy_cows_saved
print(f"cows not killed per person: {total_cows_saved:.1f}")
pigs_saved_per_year = animal_pounds_consumed['Pork'] / carcass_weights['Pork']
pigs_saved = pigs_saved_per_year * life_expectancy
print(f"pigs not killed per person: {pigs_saved:.1f}")
chickens_saved_per_year = animal_pounds_consumed['Chicken'] / carcass_weights['Chicken']
chickens_saved = chickens_saved_per_year * life_expectancy

# add layers saved
layers_saved_per_year = eggs / eggs_per_chicken_per_year
layers_saved = layers_saved_per_year * life_expectancy

total_chickens_saved = chickens_saved + layers_saved
print(f"chickens not killed per person: {total_chickens_saved:.0f}, of which {chickens_saved:.0f} from meat and {layers_saved:.0f} from eggs")
total_fish_and_shellfish_consumed_per_year = sum(fish_consumed_per_year.values())
print(f"shrimp consumed per year: {fish_consumed_per_year['shrimp']:.0f}")
print(f"fish consumed per year: {(total_fish_and_shellfish_consumed_per_year - fish_consumed_per_year['shrimp']):.1f}\n")
total_fish_and_shellfish_saved = total_fish_and_shellfish_consumed_per_year * life_expectancy
for fish, pa in fish_consumed_per_year.items():
    print(f"{fish} not killed per person: {(pa * life_expectancy):.1f}")
(sum(fish_consumed_per_year.values()) - fish_consumed_per_year['shrimp']) * life_expectancy
to_chart = {
    'shrimp': fish_consumed_per_year['shrimp'] * life_expectancy,
    'chicken': total_chickens_saved,
    'pigs': pigs_saved,
    'cows': total_cows_saved,
    'fish': (sum(fish_consumed_per_year.values()) - fish_consumed_per_year['shrimp']) * life_expectancy,
}
labels = to_chart.keys()
y_pos = np.arange(len(labels))
values = to_chart.values()

ax = plt.bar(y_pos, values, align='center', alpha=0.8)
plt.bar_label(ax, label_type = 'center', padding=8, fmt="%.0f")
plt.xticks(y_pos, labels)
plt.ylabel('not consumed over remaining lifespan')
plt.title('Animals not consumed over remaining lifespan')

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13769192669638436, 'fraction_numerical': 0.039499752352649825, 'mean_word_length': 6.198752228163993, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 18, 'lorem ipsum': 0, 'www.': 11, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '233779', 'license': 'Apache-2.0', 'n_tokens_mistral': 3271, 'n_tokens_neox': 2969, 'n_words': 534, 'path': 'animals saved by one less human eating animal products.ipynb', 'repo_name': 'AlistairHaimes/one-more-vegan', 'size': '8076'}