Quick start guide to get you up and running with ANNEM in minutes
Install AgentsMCP directly from GitHub using devtools:
# Install devtools if you don't have it
if (!require(devtools)) install.packages("devtools")
# Install AgentsMCP from GitHub
devtools::install_github("avishekb9/AgentsMCP")
# Load the package
library(AgentsMCP)
Run your first ANNEM analysis with default parameters:
# Basic ANNEM analysis with default settings
results <- run_annem_analysis(
symbols = c("AAPL", "MSFT", "GOOGL"),
n_agents = 100, # Number of agents
n_steps = 50, # Simulation steps
verbose = TRUE # Show progress
)
# View summary of results
annem_summary(results)
The analysis returns a comprehensive list with multiple components:
# Access different parts of the results
names(results)
# [1] "market" "simulation_results"
# [3] "agent_performance" "network_metrics"
# [5] "benchmark_comparison" "validation_results"
# View agent performance by type
head(results$agent_performance)
# Check benchmark comparison
results$benchmark_comparison
# Network evolution metrics
head(results$network_metrics)
Generate comprehensive visualizations of your results:
# Generate all visualizations
plots <- generate_annem_report(results, save_plots = TRUE)
# Create specific plots
agent_plots <- plot_agent_performance(results$agent_performance)
network_plots <- plot_network_evolution(results$network_metrics)
wealth_plots <- plot_wealth_dynamics(results$simulation_results)
# Display plots
print(agent_plots$performance_dist)
print(network_plots$evolution)
Customize your analysis with advanced parameters:
# Advanced ANNEM analysis with custom settings
advanced_results <- run_annem_analysis(
symbols = c("AAPL", "MSFT", "GOOGL", "TSLA", "NVDA"),
n_agents = 1000,
n_steps = 250,
agent_distribution = list(
neural_momentum = 0.25,
contrarian_ai = 0.20,
fundamentalist_ml = 0.20,
adaptive_noise = 0.10,
social_network = 0.15,
meta_learning = 0.10
),
save_results = TRUE,
output_dir = "my_annem_results"
)
# Create individual agents
agent1 <- create_annem_agent("agent_001", "neural_momentum", 1000000)
agent2 <- create_annem_agent("agent_002", "contrarian_ai", 1500000)
# Create a market environment
market <- create_annem_market(n_agents = 500, symbols = c("AAPL", "MSFT"))
# Run simulation
sim_results <- market$run_simulation(n_steps = 100)
# Calculate performance metrics
returns <- rnorm(252, 0.08/252, 0.2/sqrt(252))
metrics <- calculate_performance_metrics(returns)
# Calculate Sharpe ratio
sharpe <- calculate_sharpe_ratio(returns)
# Benchmark comparison
predictions <- rnorm(100, 0.01, 0.02)
actual <- rnorm(100, 0.01, 0.03)
comparison <- compare_with_benchmarks(predictions, actual)
Now that you have AgentsMCP running, explore these resources:
If you encounter issues or have questions: