<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Shiny on Home</title><link>/tags/shiny/</link><description>Recent content in Shiny on Home</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 22 Nov 2025 00:00:00 +0000</lastBuildDate><atom:link href="/tags/shiny/" rel="self" type="application/rss+xml"/><item><title>Compound Simulation – Exploring Portfolio Uncertainty</title><link>/2025/compound-simulation-exploring-portfolio-uncertainty/</link><pubDate>Sat, 22 Nov 2025 00:00:00 +0000</pubDate><guid>/2025/compound-simulation-exploring-portfolio-uncertainty/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Financial planning is often built on a deterministic story: &lt;em&gt;“If I invest X € each month at 5 % per year, I’ll have Y € in 20 years.”&lt;/em&gt; But real markets are anything but deterministic. Price fluctuations, volatility, and unexpected shocks can significantly change outcomes.&lt;/p&gt;
&lt;p&gt;This new tool builds on the foundation of the &lt;a href="https://michard.io/2025/compound-simulation-exploring-portfolio-uncertainty/"&gt;Compound Interest Calculator&lt;/a&gt;, which takes a deterministic view of capital growth. This new tool introduces a probabilistic perspective by using Monte Carlo simulation to explore a spectrum of possible portfolio trajectories based on the users assumptions. Instead of a single projected curve, it generates a fan chart that visualizes uncertainty bands, the likelihood of reaching specific targets, and how sensitive outcomes are to your savings rate.&lt;/p&gt;
&lt;p&gt;This is not a crystal ball. It’s a scenario explorer — a way to understand how uncertain markets shape financial trajectories.&lt;/p&gt;
&lt;p&gt;You can try the web tool here:&lt;br&gt;
&lt;a href="https://compound-simulation.michard.io/" target="_blank" rel="noreferrer" class="download"&gt;
&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentcolor" class="clip" width="13" height="13" style="vertical-align: middle; margin-right: .3rem;"&gt;
&lt;path d="M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6V32c0-17.7-14.3-32-32-32H352zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"&gt;&lt;/path&gt;
&lt;/svg&gt;Open the Compound Simulation Tool&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="what-the-tool-does"&gt;What the Tool Does&lt;/h2&gt;
&lt;p&gt;The simulation is based on a small set of input parameters — initial capital, monthly contributions, expected return (μ), volatility (σ), investment horizon, and optionally a target value.&lt;/p&gt;
&lt;p&gt;Using these assumptions, the app runs multiple simulation paths and provides:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fan chart of portfolio trajectories – median, expected path, and uncertainty bands (percentiles).&lt;/li&gt;
&lt;li&gt;Distribution of end values – showing the spread of possible outcomes at the horizon.&lt;/li&gt;
&lt;li&gt;Target probability – the likelihood of reaching (or exceeding) your goal.&lt;/li&gt;
&lt;li&gt;Stress test – a downside scenario with halved returns and doubled volatility.&lt;/li&gt;
&lt;li&gt;Savings elasticity – the effect on median outcomes from marginally increasing monthly contributions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This shifts the focus from a single deterministic projection to a probabilistic view of potential futures.&lt;/p&gt;
&lt;h2 id="how-to-use-it-online"&gt;How to Use It Online&lt;/h2&gt;
&lt;p&gt;Running the hosted app is straightforward:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the simulation tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter your core parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Initial Capital [€]&lt;/li&gt;
&lt;li&gt;Monthly Savings [€]&lt;/li&gt;
&lt;li&gt;Annual Return μ&lt;/li&gt;
&lt;li&gt;Volatility σ&lt;/li&gt;
&lt;li&gt;Time Horizon (years)&lt;/li&gt;
&lt;li&gt;(Optional) Define a target and target date.&lt;/li&gt;
&lt;li&gt;(Optional) Enable the Stress Test to explore adverse scenarios.&lt;/li&gt;
&lt;li&gt;(Optional) Add a Savings Elasticity Increment (e.g. +€50/month) to assess sensitivity.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The output includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A fan chart showing uncertainty over time.&lt;/li&gt;
&lt;li&gt;A distribution histogram of end values.&lt;/li&gt;
&lt;li&gt;A target probability indicator.&lt;/li&gt;
&lt;li&gt;A sensitivity summary for additional contributions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="run-locally"&gt;Run Locally&lt;/h2&gt;
&lt;p&gt;If you want to host or modify the simulation app yourself:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Clone the repository&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/smichard/compound_simulation
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="2"&gt;
&lt;li&gt;Navigate to the project directory&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; compound_simulation
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="3"&gt;
&lt;li&gt;Build the container image
Run the following command to build an image named compound_simulation_app (or choose any name you prefer):&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;podman build -t compound_simulation_app -f Containerfile .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This command uses the provided Containerfile to set up the environment, including all required R packages for running the Shiny app.&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Start the app locally&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;podman run --rm -p 3838:3838 compound_simulation_app
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This launches a container and maps port 3838 inside the container to the same port on your host system.&lt;/p&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Access the app in your browser&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://localhost:3838/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You should now see the Compound Simulation app running locally.&lt;/p&gt;
&lt;h2 id="why-this-matters"&gt;Why This Matters&lt;/h2&gt;
&lt;p&gt;Uncertainty is real — any deterministic projection hides the range of plausible outcomes. Markets fluctuate, assumptions shift, and unexpected events can have a lasting impact. Probabilistic thinking helps make better decisions by accounting for both upside and downside scenarios instead of focusing on a single expected path.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Goal probability provides a tangible measure: “What are the chances I’ll reach €X by year Y?”&lt;/li&gt;
&lt;li&gt;Savings elasticity reveals whether increasing contributions might be more effective than simply chasing higher returns.&lt;/li&gt;
&lt;li&gt;For investors, educators, or anyone exploring financial planning under uncertainty, this tool complements the &lt;a href="https://michard.io/2025/compound-simulation-exploring-portfolio-uncertainty/"&gt;Compound Interest Calculator&lt;/a&gt; by adding a probabilistic layer to previously deterministic projections.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="summary"&gt;Summary&lt;/h2&gt;
&lt;p&gt;Compound Simulation brings uncertainty to the forefront. By combining Monte Carlo simulation, sensitivity analysis, and clear visualizations, it highlights that financial projections aren’t fixed—they’re distributions. The tool helps explore not only expected growth but also the range of potential outcomes and their probabilities.&lt;/p&gt;
&lt;p&gt;It can be used as a teaching aid, a scenario testing environment, or a personal planning companion. And since it’s open source, you can easily adapt it to your own assumptions, risk parameters, or visualization preferences.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Related Post - Compound Interest Calculator - &lt;a href="https://michard.io/2025/compound-simulation-exploring-portfolio-uncertainty/"&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Web App - &lt;a href="https://compound-simulation.michard.io/"&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub Repository - &lt;a href="https://github.com/smichard/compound_simulation"&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Compound Interest Calculator – Visualizing Capital Growth</title><link>/2025/compound-interest-calculator-visualizing-capital-growth/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>/2025/compound-interest-calculator-visualizing-capital-growth/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Understanding how capital develops over time is a cornerstone of financial planning. While compound interest formulas are straightforward on paper, the interplay between savings rate, interest, and time is often less intuitive. To address this, I built the Compound Interest Calculator – a Shiny app that visualizes how capital grows based on different input parameters.&lt;/p&gt;
&lt;p&gt;The tool illustrates not only the raw numbers but also the dynamics of savings and interest accumulation. It allows you to model different scenarios, compare strategies, and identify milestones such as when your savings generate more returns than your yearly contributions.&lt;/p&gt;
&lt;p&gt;The idea for this tool was sparked after watching a &lt;a href="https://www.youtube.com/watch?v=F3Q-1W4QEVI"&gt;YouTube video&lt;/a&gt; that explains why the first €100,000 is such a critical milestone in building wealth. There are many excellent videos and articles that explore this concept in depth. But to make it truly tangible — and to experiment interactively with savings rates, interest assumptions, and time horizons — I decided to build a tool of my own. The result: a simple, hands-on way to see compound interest in action and explore how various strategies may impact the growth of your capital over time.&lt;/p&gt;
&lt;p&gt;You can try the web tool here:&lt;br&gt;
&lt;a href="https://compound-calculator.michard.io" target="_blank" rel="noreferrer" class="download"&gt;
&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentcolor" class="clip" width="13" height="13" style="vertical-align: middle; margin-right: .3rem;"&gt;
&lt;path d="M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6V32c0-17.7-14.3-32-32-32H352zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"&gt;&lt;/path&gt;
&lt;/svg&gt; Open the Compound Interest Calculator &lt;/a&gt;&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;The easiest way to use the calculator is online (see above).&lt;br&gt;
If you want to run it locally, you’ll need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An environment capable of running containers, e.g. Podman, or&lt;/li&gt;
&lt;li&gt;R with Shiny installed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="getting-started"&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;The online version is straightforward:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the Compound Interest Calculator.&lt;/li&gt;
&lt;li&gt;Enter your investment parameters, e.g. start year, savings rate, interest rate, investment period.&lt;/li&gt;
&lt;li&gt;Click Calculate and explore the generated charts and tables.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="input-parameters"&gt;Input Parameters&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Start Year:&lt;/strong&gt; The year when the investment begins.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initial Capital:&lt;/strong&gt; The amount of money you start with.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Savings Rate:&lt;/strong&gt; The amount of money you plan to save regularly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Savings Interval:&lt;/strong&gt; The frequency at which you save the specified savings rate (either monthly or yearly).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Investment Period:&lt;/strong&gt; The total number of years you plan to invest.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interest Rate:&lt;/strong&gt; The annual interest rate (as a percentage) that your capital will earn.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Adjustment Rate:&lt;/strong&gt; The annual rate (as a percentage) at which your savings rate will increase.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Savings Suspension:&lt;/strong&gt; The number of years after which you plan to stop saving money.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Target Value:&lt;/strong&gt; A specific capital value you aim to achieve. The app will indicate when (or if) this value is reached.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="generated-diagrams"&gt;Generated Diagrams&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Overview:&lt;/strong&gt; Shows the growth of accumulated savings and total capital over time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Distribution:&lt;/strong&gt; Displays a pie chart showing the distribution between total savings and total interest earned.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Savings Rate:&lt;/strong&gt; Represents the annual savings rate in relation to the value of the generated interest each year. This visualization illustrates the development of both the savings rate and the generated interest over time. Additionally, it highlights the year when the generated interest surpasses the annual savings rate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Normalized Values:&lt;/strong&gt; Displays the values of the savings rate and generated interests, both normalized based on the annual growth comprised of the savings rate and yearly interests. This provides a clearer perspective on how each component contributes to the overall growth each year.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Goals:&lt;/strong&gt; Displays the development of total capital and highlights specific milestones, such as when the capital doubles from the initial investment. It also indicates when the user-defined target value is achieved.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Values:&lt;/strong&gt; A table that provides a detailed breakdown of the capital at the beginning of the year, savings amount per year, generated interest per year, and capital at the end of the year.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="run-locally"&gt;Run Locally&lt;/h2&gt;
&lt;p&gt;If you want to host the calculator yourself:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Clone this repository&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/smichard/compound_interest_calculator.git
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="2"&gt;
&lt;li&gt;Navigate to the project directory:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; compound_interest_calculator
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="3"&gt;
&lt;li&gt;Build the container image:
Run the following command to build a Docker image. Replace &lt;code&gt;my_app&lt;/code&gt; with a name of your choice for the image.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;podman build -t my_app -f Containerfile
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This command will use the provided Containerfile to build an image named &lt;code&gt;my_app&lt;/code&gt;. The process will install the necessary R packages and set up the environment for the Shiny app.&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Run the Shiny app locally:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After building the image, you can run the Shiny app locally using the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;podman run --rm -p 3838:3838 my_app
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This command will start a container from the &lt;code&gt;my_app&lt;/code&gt; image and map port 3838 of the container to port 3838 of your local machine.&lt;/p&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Access the Shiny app in a browser
Open a web browser and navigate to:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;http://localhost:3838/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You should now see your Shiny app running!&lt;/p&gt;
&lt;h2 id="summary"&gt;Summary&lt;/h2&gt;
&lt;p&gt;The Compound Interest Calculator helps bridge the gap between abstract formulas and practical insights. It turns the often-theoretical concept of compound growth into something tangible and interactive. By visualizing how capital evolves over time, it allows users to experiment with different savings rates, investment horizons, and interest assumptions — and to see immediately how these variables influence the trajectory of their capital.&lt;/p&gt;
&lt;p&gt;Whether used for personal financial planning, educational purposes, or illustrating investment concepts, the tool provides a clear and structured way to explore “what-if” scenarios. It highlights key inflection points — such as when generated interest surpasses annual savings — making the dynamics of compounding easier to grasp and communicate.&lt;/p&gt;
&lt;p&gt;Ultimately, the calculator is designed to make complex relationships between time, capital, and interest transparent, empowering users to make more informed, data-driven decisions about their long-term financial strategies.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;YouTube Video - Nischa: Why Net Worth Skyrockets After $100K - &lt;a href="https://www.youtube.com/watch?v=F3Q-1W4QEVI"&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Web App - &lt;a href="https://compound-calculator.michard.io/"&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub Repository - &lt;a href="https://github.com/smichard/compound_interest_calculator"&gt;link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>