1. The Financial Question

Statistics helps turn uncertain financial outcomes into quantities that can be compared.

Imagine a person deciding how to evaluate several hypothetical investments. The questions are:

  • What return has each investment produced on average?
  • How variable, or risky, are those returns?
  • How strongly does a fund move with the market?
  • How uncertain is the estimated market sensitivity?

Goal: use descriptive statistics, regression, confidence intervals, ggplot2, and Plotly to support a financial comparison.

2. A Self-Contained Finance Example

The example uses 60 hypothetical monthly observations (five years). The data are generated inside this Rmd file, so no external spreadsheet is required.

Portfolio Annualized mean return Annualized volatility Sharpe ratio
Fund 8.1% 12.1% 0.51
Bond 4.4% 4.6% 0.52
Growth 15.7% 19.9% 0.69
Balanced 6.6% 8.3% 0.56

Annualized mean return = monthly arithmetic mean × 12. Annualized volatility = monthly standard deviation × \(\sqrt{12}\). The 2% risk-free rate used in the Sharpe ratio is illustrative.

3. Math: Return and Mean

A one-period financial return can be written as

\[ R_t = \frac{P_t-P_{t-1}}{P_{t-1}}, \]

where \(P_t\) is the value at time \(t\).

For \(n\) observed returns, the sample mean estimates the typical return:

\[ \bar{R}=\frac{1}{n}\sum_{t=1}^{n}R_t. \]

The mean is useful for summarizing the center of historical returns, but it does not describe how widely those returns vary.

4. Math: Measuring Financial Risk

A common statistical measure of return variability is the sample standard deviation:

\[ s=\sqrt{\frac{1}{n-1}\sum_{t=1}^{n}(R_t-\bar{R})^2}. \]

For monthly data, a simplified annualized volatility measure is

\[ s_{annual}=s_{monthly}\sqrt{12}. \]

  • Larger \(s\) means returns are more spread out around the mean.
  • In this example, that spread is interpreted as volatility.
  • Mean return and volatility should be considered together rather than separately.

5. ggplot #1: Distribution of Fund Returns

The histogram shows why an average return should be interpreted together with a measure of spread.

6. ggplot #2: Fund Return vs. Market Return

The upward pattern suggests a positive association between the market return and the fund return.

7. Math: Simple Linear Regression

A simple financial regression models fund return as a function of market return:

\[ R_{fund,t}=\alpha+\beta R_{market,t}+\varepsilon_t. \]

  • \(\alpha\): estimated return not explained by the market in this simplified model.
  • \(\beta\): estimated sensitivity of the fund to market movements.
  • \(\varepsilon_t\): unexplained variation.

For this simulated sample,

\[ \hat{\beta}=\text{0.78}. \]

A positive \(\hat{\beta}\) means the fund tends to move in the same direction as the market.

8. Math: Confidence Interval for Market Sensitivity

A 95% confidence interval for the regression slope has the form

\[ \hat{\beta}\;\pm\;t_{0.975,\,n-2}\,SE(\hat{\beta}). \]

For this example, the 95% confidence interval is

\[ [\text{0.63},\;\text{0.93}]. \]

The interval communicates statistical uncertainty around the estimated market sensitivity.

The model’s \(R^2\) is 65%, so this one-factor regression explains about that percentage of the variation in the hypothetical fund returns.

9. Plotly: 3D Risk-Return Comparison

The interactive graph compares return, volatility, and risk-adjusted return at the same time.

10. R Code Used for the Regression Plot

# Estimate market sensitivity
fit <- lm(fund_return ~ market_return, data = finance)
confint(fit, "market_return", level = 0.95)

# Visualize the relationship
ggplot(finance, aes(x = market_return, y = fund_return)) +
  geom_point(alpha = 0.75) +
  geom_smooth(method = "lm", se = TRUE) +
  labs(x = "Market monthly return",
       y = "Fund monthly return") +
  theme_minimal()

The same model gives both a numerical estimate of \(\beta\) and a visual regression line.

11. Worked Financial Interpretation

Suppose a person has $10,000 and is studying the hypothetical fund.

From the simulated five-year sample:

  • Annualized arithmetic mean return: 8.1%
  • Annualized volatility: 12.1%
  • Estimated market beta: 0.78
  • Regression \(R^2\): 65%
  • Applying the sample annualized mean mechanically to $10,000 gives an illustrative one-year change of about $814, for a value near $10,814.

Interpretation: these numbers summarize simulated historical behavior. They do not guarantee a future return.

12. What Statistics Adds to a Financial Decision

Statistics does not remove uncertainty; it makes uncertainty easier to describe and compare.

Main takeaways

  • Mean summarizes typical return; standard deviation summarizes volatility.
  • Regression estimates how strongly an investment moves with a market benchmark.
  • A confidence interval shows uncertainty around the estimated slope.
  • Interactive visualization compares several risk-return profiles at once.

Limitations

  • The data are simulated and the annualization is simplified.
  • The regression uses only one market factor.
  • Real decisions may also consider fees, taxes, inflation, liquidity, time horizon, and diversification.
Statistics supports better-informed financial reasoning; it does not guarantee investment outcomes.