{
  "id": "beta",
  "version": "652b27fe7f6c",
  "status": "published",
  "name": "Beta Calculator",
  "question": "What is the stock's beta?",
  "summary": "Computes the beta of a stock from its returns and the market’s returns over the same periods: the slope of the regression line, with the correlation, R² and the intercept.",
  "category": "finance",
  "subcategory": "investing",
  "url": "https://www.acalculator.org/finance/beta-calculator",
  "markdown": "https://www.acalculator.org/finance/beta-calculator.md",
  "kind": "function",
  "method": "β = Σ(xₜ − x̄)(yₜ − ȳ) ÷ Σ(xₜ − x̄)², where xₜ are the market’s returns and yₜ the stock’s; intercept = ȳ − β × x̄; r = Σ(xₜ − x̄)(yₜ − ȳ) ÷ √(Σ(xₜ − x̄)² × Σ(yₜ − ȳ)²).",
  "assumptions": [
    "Both lists cover the same periods, in the same order, at the same frequency (for example monthly).",
    "Returns are typed as percents; no price or index level is looked up.",
    "Arithmetic is exact on the typed decimals; only the correlation uses a floating-point square root."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "asset": {
        "title": "Stock returns (%)",
        "description": "The stock’s return in each period, in percent, oldest first, separated by spaces or new lines.",
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "market": {
        "title": "Market returns (%)",
        "description": "The market index’s return in the same periods and the same order, in percent.",
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    }
  },
  "outputs": {
    "beta": {
      "label": "Beta (β)",
      "description": "The slope of the stock’s returns against the market’s: covariance ÷ market variance.",
      "format": "number"
    },
    "correlation": {
      "label": "Correlation (r)",
      "description": "How closely the returns follow a straight line, from −1 to 1.",
      "format": "number"
    },
    "rSquared": {
      "label": "R²",
      "description": "The share of the stock’s variance that the market explains: r².",
      "format": "number"
    },
    "intercept": {
      "label": "Intercept (return when the market is flat)",
      "description": "Mean stock return − β × mean market return, in percent per period.",
      "format": "percent"
    },
    "covariance": {
      "label": "Covariance of the returns (sample)",
      "description": "Σ(x − x̄)(y − ȳ) ÷ (n − 1), in percent squared.",
      "format": "number"
    },
    "variance": {
      "label": "Variance of the market returns (sample)",
      "description": "Σ(x − x̄)² ÷ (n − 1), in percent squared.",
      "format": "number"
    },
    "periods": {
      "label": "Periods",
      "description": "How many pairs of returns.",
      "format": "integer"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "asset": "1.5 3 -2 4 0.5",
      "market": "1 2 -1 3 0"
    },
    "outputs": {
      "beta": 1.45,
      "correlation": 0.9843241382880895,
      "rSquared": 0.9688940092165899,
      "intercept": -0.05,
      "covariance": 3.625,
      "variance": 2.5,
      "periods": 5
    },
    "text": "Over these 5 periods, the stock’s beta against the market is 1.45."
  },
  "examples": [
    {
      "given": {
        "asset": [
          1.5,
          3,
          -2,
          4,
          0.5
        ],
        "market": [
          1,
          2,
          -1,
          3,
          0
        ]
      },
      "expect": {
        "beta": 1.45,
        "intercept": -0.05,
        "correlation": 0.9843241382880895,
        "rSquared": 0.9688940092165899,
        "covariance": 3.625,
        "variance": 2.5,
        "periods": 5
      },
      "source": "OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation (b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², a = ȳ − b × x̄). https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation; OpenStax, Principles of Finance, 15.3 The Capital Asset Pricing Model (CAPM) (beta measures how much a stock moves with the market: the slope of the line through its monthly returns against the market’s; Delta Air Lines 1.39). https://openstax.org/books/principles-finance/pages/15-3-the-capital-asset-pricing-model-capm; hand calculation in content.mdx: Σ(x − x̄)(y − ȳ) = 14.5, Σ(x − x̄)² = 10, β = 1.45"
    },
    {
      "given": {
        "asset": [
          -2,
          4,
          1,
          6
        ],
        "market": [
          -1,
          2,
          0.5,
          3
        ]
      },
      "expect": {
        "beta": 2,
        "intercept": 0,
        "correlation": 1,
        "rSquared": 1
      },
      "source": "OpenStax, Principles of Finance, 15.3 The Capital Asset Pricing Model (CAPM) (beta measures how much a stock moves with the market: the slope of the line through its monthly returns against the market’s; Delta Air Lines 1.39). https://openstax.org/books/principles-finance/pages/15-3-the-capital-asset-pricing-model-capm (a beta of 2: a 10% market rise means a 20% rise in the stock); OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation (b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², a = ȳ − b × x̄). https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation"
    },
    {
      "given": {
        "asset": [
          2,
          -1,
          1,
          0
        ],
        "market": [
          -2,
          2,
          0,
          0
        ]
      },
      "expect": {
        "beta": -0.75,
        "intercept": 0.5,
        "correlation": -0.9486832980505138
      },
      "source": "OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation (b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², a = ȳ − b × x̄). https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation; hand calculation in content.mdx: Σ(x − x̄)(y − ȳ) = −6, Σ(x − x̄)² = 8, β = −0.75"
    }
  ],
  "sources": [
    "OpenStax, Principles of Finance, 15.3 The Capital Asset Pricing Model (CAPM): beta measures how much a stock moves with the market; the slope of the line through Delta Air Lines’ monthly returns against the S&P 500 (2018–2020) is 1.39, against 1.46 and 1.29 on two finance sites; with a beta of 2, a 10% market rise means a 20% rise in the stock. https://openstax.org/books/principles-finance/pages/15-3-the-capital-asset-pricing-model-capm (retrieved 2026-10-18)",
    "OpenStax, Principles of Finance, 15.5 Using Excel to Make Investment Decisions: monthly return = (this month’s price − last month’s price) ÷ last month’s price; beta as the slope of the best-fit line (Amazon 1.1477). https://openstax.org/books/principles-finance/pages/15-5-using-excel-to-make-investment-decisions (retrieved 2026-10-18)",
    "OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation: slope b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², intercept a = ȳ − b × x̄, and the correlation coefficient r. https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation (retrieved 2026-10-18)"
  ],
  "related": [
    "expected-return",
    "sharpe-ratio",
    "linear-regression",
    "covariance",
    "correlation-coefficient"
  ],
  "changelog": []
}
