Research / Paper2Agent
> The Canadian Senate paper, as an agent
“A nonpartisan legislative chamber: The influence of the Canadian Senate” (Party Politics 27(5), 2021) asks what happens to a legislative chamber when parties let go of it. This page connects an AI agent to the paper’s actual analysis code, so you can re-run the models yourself, change how Senate independence is coded, and ask what happens to the results — in conversation, without installing R.
Connect
The server speaks the Model Context Protocol. Add this endpoint to any MCP-capable client:
https://mcp.abridgman.ca/senate/mcpClaude Code:
claude mcp add --transport http senate https://mcp.abridgman.ca/senate/mcpIn Claude or ChatGPT desktop and web clients, add it as a custom connector using the URL above. No account or key is needed.
Ask it things
- “Refit Table 1 and show me the Post-IAB × Independent Senator coefficient. Does it match the published paper?”
- “Re-run the models treating the Government Representatives as partisan. Which conclusions change?”
- “How much more lobbying did independent senators receive after the IAB, compared with MPs and partisan senators?”
- “Do the parallel trends and anticipation tests support the difference-in-differences design?”
What it can do
senate_fit_zinb_did_modelsRefits Table 1: four zero-inflated negative binomial difference-in-differences models of monthly lobbyist contacts.
Returns: Coefficients and fit statistics for the count and zero components, plus the Table 1 and Table A1 LaTeX.
senate_predict_iab_counterfactual_effectsFigure 2: predicted change in lobbying after the Independent Advisory Board, and predicted contacts as the Senate becomes more independent.
Returns: Per-group predictions and the figure.
senate_describe_lobbying_panelFigure 1 monthly contacts by chamber, the descriptive tables, and Senate composition over time.
Returns: Monthly series, descriptives and composition data.
senate_run_did_robustness_checksThe supplement’s robustness checks: parallel trends, anticipation leads, subsample exclusions, and linear models with year-month and legislator fixed effects.
Returns: Per-check coefficients and fit statistics.
Every tool runs on the paper’s legislator-month panel: 44,450 legislator-months from October 2010 to August 2019, matching lobbying registry records to Senators and MPs. Two switches change how Senate independence is coded; the defaults reproduce the published results. Calls take roughly 30 seconds to three minutes.
How it was built, and what was checked
The tools were generated with Paper2Agent, which wraps a paper’s own code rather than reimplementing it. Nothing here is a language model reproducing results from memory: each tool calls the original R, and the numbers are computed on request.
- Table 1, Table A1, the descriptive tables, and supplement Tables C1–C5 reproduce the published values exactly, to printed precision.
- Figure 2 reproduces the published increases of 73% for MPs, 28% for partisan senators and 134% for independent senators.
- Agents that did not write the code checked it: 98 tests against results from running the original code directly, plus acceptance calls in three separate environments.
- One finding from the conversion: the published results come from the analysis code as it stood in December 2019. A later revision changed how independence is coded, and the two do not agree. The defaults here follow the published version, and the alternative is available as a switch.
Limits
- The panel ends in August 2019; the series has not been extended past the published window.
- The public server analyses the published panel only, and is capped at two concurrent analyses. Result files stay on the server; the numbers come back in the response. Run it locally for the full toolset, including rebuilding the panel from a new lobbying-registry export.
- An agent can be wrong about what a number means. The paper and the supplement remain the reference.