AI-Based Fiscal & Monetary Policy Effect Simulator

AI-Based Fiscal & Monetary Policy Effect Simulator

Select policy stances to see their potential combined economic effects.

Fiscal Policy

Monetary Policy

AI-Powered Analysis of Potential Effects

Select policy choices above to see the AI-generated analysis of their potential combined impact on key economic indicators. The analysis is based on general economic principles and assumes a typical economic environment.

Based on the selected policy mix, here's a simplified AI-driven outlook on potential economic effects. Real-world outcomes can be more complex and influenced by many other factors.

`; htmlOutput += `

Economic Growth (GDP)

${analysisResult.gdp.reason}

`; htmlOutput += `

Inflation

${analysisResult.inflation.reason}

`; htmlOutput += `

Unemployment

${analysisResult.unemployment.reason}

`; htmlOutput += `

Market Interest Rates

${analysisResult.marketRates.reason}

`; htmlOutput += `

Currency Exchange Rate

${analysisResult.currency.reason}

`; analysisDetailsEl.innerHTML = htmlOutput; } // Event Listeners for policy selections policyElements.forEach(el => { if (el) { // Basic null check el.addEventListener('change', updateAnalysisUI); } else { console.error("A policy selection element was not found."); } }); // PDF Generation function generatePDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const reportDate = new Date().toLocaleString(); doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.text('Fiscal & Monetary Policy Effect Simulation Report', 105, 20, null, null, 'center'); doc.setFontSize(10); doc.setFont('helvetica', 'normal'); doc.text(`Report Generated: ${reportDate}`, 105, 28, null, null, 'center'); let yPos = 40; const lineSpacing = 7; const sectionSpacing = 10; const leftMargin = 15; const contentWidth = doc.internal.pageSize.getWidth() - (leftMargin * 2); function addSectionHeader(text) { doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.text(text, leftMargin, yPos); yPos += lineSpacing; doc.setFont('helvetica', 'normal'); doc.setFontSize(10); } function addPolicyItem(label, value) { doc.text(`${label}:`, leftMargin, yPos); doc.text(value, leftMargin + 55, yPos); // Adjust indent for value yPos += lineSpacing; } function addAnalysisItem(indicator, analysisText) { doc.setFont('helvetica', 'bold'); doc.text(indicator, leftMargin, yPos); yPos += (lineSpacing * 0.8); doc.setFont('helvetica', 'normal'); const lines = doc.splitTextToSize(analysisText, contentWidth); doc.text(lines, leftMargin + 5, yPos); yPos += (lines.length * (lineSpacing * 0.7)) + (lineSpacing * 0.5); // Adjust spacing based on lines } addSectionHeader('Selected Fiscal Policies:'); addPolicyItem('Government Spending', getSelectedPolicyText(govSpendingEl)); addPolicyItem('Taxation Levels', getSelectedPolicyText(taxationEl)); yPos += (lineSpacing / 2); addSectionHeader('Selected Monetary Policies:'); addPolicyItem('Central Bank Interest Rates', getSelectedPolicyText(interestRatesEl)); addPolicyItem('Money Supply', getSelectedPolicyText(moneySupplyEl)); yPos += sectionSpacing; addSectionHeader('AI-Powered Analysis of Potential Effects:'); const currentPolicies = { govSpending: govSpendingEl.value, taxation: taxationEl.value, interestRates: interestRatesEl.value, moneySupply: moneySupplyEl.value, }; const analysisForPdf = getPolicyAnalysis(currentPolicies); doc.setFontSize(9); // Smaller font for analysis details doc.text("Note: This analysis is a simplified interpretation based on general economic principles and does not account for specific contextual factors, magnitudes of policy changes, or time lags.", leftMargin, yPos, { maxWidth: contentWidth }); yPos += (lineSpacing * 2.5); addAnalysisItem('Economic Growth (GDP)', analysisForPdf.gdp.reason); if (yPos > doc.internal.pageSize.getHeight() - 30) { doc.addPage(); yPos = 20; } addAnalysisItem('Inflation', analysisForPdf.inflation.reason); if (yPos > doc.internal.pageSize.getHeight() - 30) { doc.addPage(); yPos = 20; } addAnalysisItem('Unemployment', analysisForPdf.unemployment.reason); if (yPos > doc.internal.pageSize.getHeight() - 30) { doc.addPage(); yPos = 20; } addAnalysisItem('Market Interest Rates', analysisForPdf.marketRates.reason); if (yPos > doc.internal.pageSize.getHeight() - 30) { doc.addPage(); yPos = 20; } addAnalysisItem('Currency Exchange Rate', analysisForPdf.currency.reason); // Footer (on potentially multiple pages) const totalPages = doc.internal.getNumberOfPages(); for (let i = 1; i <= totalPages; i++) { doc.setPage(i); doc.setFontSize(8); doc.text(`Page ${i} of ${totalPages}`, doc.internal.pageSize.getWidth() - 25, doc.internal.pageSize.getHeight() - 10); doc.text('Powered by AI-Based Policy Effect Simulator.', leftMargin, doc.internal.pageSize.getHeight() - 10); } doc.save(`Policy_Effect_Simulation_Report_${new Date().toISOString().slice(0,10)}.pdf`); } if (downloadPdfButtonEl) { // Null check downloadPdfButtonEl.addEventListener('click', generatePDF); } else { console.error("Download PDF Button element not found."); } // Initial UI update (optional, or wait for user interaction) updateAnalysisUI(); // Call once to initialize based on default selections });
Scroll to Top