ワンクリックで
pyrsm-simulate
Build, run, and interpret Monte Carlo simulations with pyrsm.model.simulate
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Build, run, and interpret Monte Carlo simulations with pyrsm.model.simulate
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create custom plots from a polars DataFrame in Python using the pyrsm library's `visualize` function — a plotnine wrapper supporting 8 geom types (dist / hist / density / scatter / bar / line / box / violin) with full control over aesthetics (color / fill / shape / group / linetype), faceting (facet_wrap / facet_grid), aggregation, smoothing (lm / loess), jitter, titles, and multiple x/y variables. The return value is a `plotnine.ggplot` object for one plot or a plotnine composition for multiple plots, and users can extend the result with plotnine layers — scales, themes, geom_smooth, geom_vline, custom labels — making plotnine extensibility a first-class part of this skill. Triggers include phrases like "scatter plot of x vs y", "histogram of price", "box plot of price by cut", "line chart over time, colored by region", "facet by category", "add a regression line", "use plotnine to plot", "density plot of carat by cut", or any request for a specific plot in a marketing/business analytics context.
Combine two polars DataFrames in Python using the pyrsm library's `combine` function — supporting inner / left / right / full / semi / anti joins, vertical and horizontal binds, and set operations (intersect / union / setdiff). Use this skill whenever a student or analyst wants to merge two tables on a key, stack two tables of the same schema, identify rows that appear in both tables (or in one but not the other), or work with the pyrsm package for any two-DataFrame combining task. The output is a polars DataFrame the user can keep chaining onto. Triggers include phrases like "join these two tables", "merge on customer_id", "left join", "stack two datasets", "concatenate rows", "find rows in A but not in B", "anti join to find unmatched", "set intersection of two tables", "bind columns side by side", or any mention of combining two tabular datasets in a marketing/business analytics context.
Compare means of a numeric variable across two or more groups in Python using the pyrsm library's `compare_means` class. Use this skill whenever a student or analyst wants to run a two-sample t-test, a paired t-test, or an ANOVA-style set of pairwise comparisons; switch to a Wilcoxon rank-sum / signed-rank test for skewed or small samples; apply Bonferroni adjustment to control family-wise error across multiple comparisons; choose between independent and paired samples; or work with the pyrsm package for any group-mean-comparison task — even if they don't explicitly say "pyrsm" or "compare_means". Triggers include phrases like "compare means across groups", "t-test between two groups", "ANOVA across professor ranks", "is salary different by sex/discipline", "before-after paired test", "Wilcoxon rank-sum test", "Bonferroni adjustment", "pairwise comparisons with multiple-testing correction", or any mention of comparing a continuous outcome across categorical groups in a marketing/business analytics class.
Compare proportions of a categorical outcome across two or more groups in Python using the pyrsm library's `compare_props` class. Use this skill whenever a student or analyst wants to test if the proportion of a "success" level (yes / churned / clicked / survived) differs across groups defined by another categorical variable, focus on specific pair comparisons via `comb`, apply Bonferroni adjustment, validate the chi-squared cell-count assumption, or work with the pyrsm package for any group-proportion-comparison task — even if they don't explicitly say "pyrsm" or "compare_props". Triggers include phrases like "compare proportions across groups", "does survival rate differ by class", "did the click-rate change between A and B and C", "two-proportion z-test", "is the yes-rate the same for males and females", "pairwise proportion comparisons with adjustment", or any mention of comparing a binary outcome across two or more categorical groups in a marketing/business analytics class.
Compute and interpret correlation matrices in Python using the pyrsm library's `correlation` class. Use this skill whenever a student or analyst wants to measure the strength and direction of pairwise relationships among numeric variables, choose between Pearson, Spearman, Kendall, or polychoric correlation, build a scatter-matrix visualization with significance stars, screen for multicollinearity in a dataset before fitting a regression, or work with the pyrsm package for any correlation task — even if they don't explicitly say "pyrsm" or "correlation". Triggers include phrases like "how correlated are X and Y", "compute a correlation matrix", "is there a relationship between these variables", "check for multicollinearity", "Pearson vs Spearman", "what's the rank correlation", "scatter matrix with regression lines", or any mention of measuring pairwise linear/monotonic association among continuous variables in a marketing/business analytics class.
Build and interpret two-way contingency tables and chi-squared tests of independence in Python using the pyrsm library's `cross_tabs` class. Use this skill whenever a student or analyst wants to test whether two categorical variables are associated, build observed/expected/chi-squared/standardized-deviation tables, identify which cells drive an omnibus rejection, compute row/column/total percentages, validate the expected-cell-count assumption, or work with the pyrsm package for any contingency-table task — even if they don't explicitly say "pyrsm" or "cross_tabs". Triggers include phrases like "is X associated with Y", "chi-square test of independence", "cross-tab", "contingency table", "does income predict newspaper choice", "which cells contribute to the chi-squared", "standardized residuals", "expected vs observed frequencies", "row percentages vs column percentages", or any mention of analyzing the relationship between two categorical variables in a marketing/business analytics class.
| name | pyrsm-simulate |
| description | Build, run, and interpret Monte Carlo simulations with pyrsm.model.simulate |
pyrsm.model.simulate)This skill teaches how to express an uncertain business problem as a Monte Carlo workbook of named distributions plus derived formulas, run thousands of draws, and turn the per-column summary into a decision- grade interpretation. It is the standard tool whenever a Radiant student needs to reason about uncertainty, risk, or repeated outcomes without fitting a statistical model.
Reach for simulate when the prompt names uncertainty and asks for a
probability, a distribution, or a robust choice:
Do not use Monte Carlo when:
pyrsm.model.dtree and roll back expected values exactly.regress, logistic,
rforest, or xgboost.A simulation is a small JSON-safe workbook with two ordered sections. The deterministic planner reasons about both sections so the question cards reference variable / formula names directly.
variablesEach entry is one named random (or constant) input. Use the smallest distribution that is honest about the uncertainty:
kind | Required fields | Use for |
|---|---|---|
constant | value | Knowns, base parameters, scenario flags |
normal | mean, sd | Symmetric noise, additive errors |
uniform | low, high | "Anywhere in this range, no preference" |
binomial | n, p | Counts of successes in n independent trials |
poisson | mean | Counts of independent arrivals/events |
lognormal | mean, sd | Strictly positive, right-skewed magnitudes |
discrete | values, probs | Named scenarios with explicit probabilities |
sequence | values | Deterministic per-period sweeps in repeated runs |
Probabilities on a discrete variable should sum to 1.
formulasEach formula is {name, expr} and is evaluated in order against the
sampled columns. Expressions support + - * / **, parentheses, the
standard math functions, comparisons (< <= > >= == !=) and logical
operators. Comparisons produce boolean columns that double as risk
flags. The compiler rejects attribute access, imports, and arbitrary
function calls, so formulas are safe to evaluate.
Pattern: lift every meaningful intermediate (demand, revenue, cost, profit) into a named formula. Lifting makes the planner's cards specific and lets the user click straight through to a sensitivity grid on the right variable.
name: Pricing demo
runs: 5000
seed: 1234
variables:
- {name: price, kind: discrete, values: [6, 8], probs: [0.3, 0.7]}
- {name: demand_error, kind: normal, mean: 0, sd: 100}
- {name: var_cost, kind: constant, value: 5}
- {name: fixed_cost, kind: constant, value: 1000}
formulas:
- {name: demand, expr: 1000 - 50 * price + demand_error}
- {name: profit, expr: demand * (price - var_cost) - fixed_cost}
- {name: loss, expr: profit < 0}
After simulate.run:
summary_rows shows mean, sd, p5, p50, p95, and (for
boolean formulas) the probability of True.histograms provides per-column bin counts the UI renders directly.python_code is the Polars-native reproducibility text.Use simulate.repeat.run when the question mentions accumulation over
time or a portfolio of independent trials. Two questions tell the
planner what to do:
{
"type": "simulate.repeat.run",
"spec": {"...": "same workbook"},
"periods": 12,
"resample": ["demand_error"]
}
Repeat aggregates each formula across periods so totals, averages, and risk flags are first-class outputs.
The canonical risk question is "What is the probability that profit is negative?" Express it as a boolean formula and read the summary:
formulas:
- {name: profit, expr: revenue - cost}
- {name: loss, expr: profit < 0}
The pro-builder planner promotes this pattern automatically when the prompt mentions risk, loss, or threshold language.
When the workbook contains a controllable input (price, staffing,
capacity), surface it as a constant variable so the user can sweep it.
The planner proposes a sensitivity / grid action when:
Grid search is not yet a built-in pyrsm action; the planner asks for
realistic min/max/step and the host code stitches together a series of
simulate.run calls per cell.
If the prompt mentions arrivals, waiting, service times, capacity, abandonment, or shifts, the planner should classify it as a future process/queue submode and ask:
Do not expose SimPy or Ciw abstractions directly; the future submode will ship its own typed action and pyrsm helpers.