Untitled
unknown
plain_text
7 months ago
1.3 kB
0
Indexable
Never
import numpy as np import matplotlib.pyplot as plt # Generate random samples for proposer's offer and responder's acceptance threshold num_samples = 1000 proposer_offers = np.random.uniform(0, 100, num_samples) responder_thresholds = np.random.uniform(0, 100, num_samples) # Plot histograms of offer amounts and acceptance thresholds plt.figure(figsize=(12, 5)) plt.subplot(1, 2, 1) plt.hist(proposer_offers, bins=20, color='skyblue', edgecolor='black') plt.title('Histogram of Proposer Offers') plt.xlabel('Offer Amount') plt.ylabel('Frequency') plt.subplot(1, 2, 2) plt.hist(responder_thresholds, bins=20, color='salmon', edgecolor='black') plt.title('Histogram of Responder Acceptance Thresholds') plt.xlabel('Acceptance Threshold') plt.ylabel('Frequency') plt.tight_layout() plt.show() # Visualize relationship between offer amounts and acceptance/rejection outcomes plt.figure(figsize=(8, 6)) plt.scatter(proposer_offers, responder_thresholds, c=np.where(proposer_offers >= responder_thresholds, 'green', 'red'), alpha=0.5) plt.plot([0, 100], [0, 100], linestyle='--', color='gray') # Plot diagonal line for reference plt.xlabel('Proposer Offer Amount') plt.ylabel('Responder Acceptance Threshold') plt.title('Acceptance/Rejection Outcome') plt.xlim(0, 100) plt.ylim(0, 100) plt.grid(True) plt.show()
Leave a Comment