Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Iterative Macro for Monte Carlo Simulation

davidwwyche
6 - Meteoroid

I am trying to develop an iterative macros to create a Monte Carlo-like simulation.

 

The example I am starting with is a fantasy football simulation, but I plan to use a similar model for work (allocating volumes to specific customer-supplier relationships to model profitability sensitivity).

 

My constraints are this:

12 teams

11 weeks

X number of seasons.

A) Teams can only play each other once per season

B) Teams must play 1 and only 1 team each week

 

 

My input appends Teams-Opponents-Weeks-Seasons.  So for a 10 season simulation, my dataset is 14,520 records (teams cannot paly themselves).  Which looks like this (I am coding combinations of teams, opponents, seasons, and weeks accordingly so I can remove in the macro):

davidwwyche_0-1668814790495.png

 

I have attached my macro which shows how I am randomly selecting a record and removing any records conflicting with my constraints.

 

When I run through my final workflow, duplicate records (switching teams and opponents satisfying the condition that if team a is playing team b, then team b must also play team a), I am still left with null values, like the below (cross tabbed with team # across the top):

 

davidwwyche_1-1668815198333.png

 

 

I should have exactly enough rows to randomly select all matchups necessary and satisfy my conditions, so I can't figure out why I am creating null matchups.

 

Any help appreciated.

3 REPLIES 3
DavidSta
Alteryx
Alteryx

Hi @davidwwyche,

 

can you maybe share your complete workflow including the data, otherwise it might be hard for the community to help.

 

Best regards,

David

Adrian_T
Alteryx Alumni (Retired)

Hey @davidwwyche,

 

I would suggest taking a look at the out of the box Prescriptive Analytics tools that runs the Monte Carlo Simulation:

 

  • Simulation Sampling Tool: Allows random draws for given variables; you can sample from existing data for a variable directly, estimate best fitting parametric distribution, specify or “draw” the parametric distribution
  • Simulation Scoring Tool: Provides predicted values given uncertain predictors, and provides measures associated with the uncertainty surrounding a model’s predictions
  • Simulation Summary Tool: Delivers an interactive dashboard and a standard report of the simulation results

You can find these tools here:

Adrian_T_0-1669018223494.png

 

davidwwyche
6 - Meteoroid

Attached is the sample set generation workflow (just appending inputs to arrive at all possible outcomes, by week).  

 

I just run that through the macro I attached earlier

Labels