{
  "name": "Worked example: study hours and test score, least-squares fit (n = 8)",
  "description": "Illustrative teaching data (invented, not from a study) for eight students with fitted values, residuals and the deviation products used to compute the least-squares slope 3.8929 and intercept 47.6071; computed by the page author using the formulas in OpenStax Introductory Statistics section 12.3.",
  "page": "https://casrai.org/guides/slope-linear-regression",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-26T16:20:00Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Observation",
      "unit": "",
      "description": ""
    },
    {
      "name": "Weekly study hours (x)",
      "unit": "hours",
      "description": ""
    },
    {
      "name": "Test score (y)",
      "unit": "points",
      "description": ""
    },
    {
      "name": "Fitted score",
      "unit": "points",
      "description": ""
    },
    {
      "name": "Residual",
      "unit": "points",
      "description": ""
    },
    {
      "name": "(x - mean x)^2",
      "unit": "",
      "description": ""
    },
    {
      "name": "(x - mean x)(y - mean y)",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Observation": "Student 1",
      "Weekly study hours (x)": 1,
      "Test score (y)": 52,
      "Fitted score": 51.5,
      "Residual": 0.5,
      "(x - mean x)^2": 12.25,
      "(x - mean x)(y - mean y)": 45.938
    },
    {
      "Observation": "Student 2",
      "Weekly study hours (x)": 2,
      "Test score (y)": 55,
      "Fitted score": 55.39,
      "Residual": -0.39,
      "(x - mean x)^2": 6.25,
      "(x - mean x)(y - mean y)": 25.312
    },
    {
      "Observation": "Student 3",
      "Weekly study hours (x)": 3,
      "Test score (y)": 61,
      "Fitted score": 59.29,
      "Residual": 1.71,
      "(x - mean x)^2": 2.25,
      "(x - mean x)(y - mean y)": 6.188
    },
    {
      "Observation": "Student 4",
      "Weekly study hours (x)": 4,
      "Test score (y)": 60,
      "Fitted score": 63.18,
      "Residual": -3.18,
      "(x - mean x)^2": 0.25,
      "(x - mean x)(y - mean y)": 2.562
    },
    {
      "Observation": "Student 5",
      "Weekly study hours (x)": 5,
      "Test score (y)": 68,
      "Fitted score": 67.07,
      "Residual": 0.93,
      "(x - mean x)^2": 0.25,
      "(x - mean x)(y - mean y)": 1.438
    },
    {
      "Observation": "Student 6",
      "Weekly study hours (x)": 6,
      "Test score (y)": 71,
      "Fitted score": 70.96,
      "Residual": 0.04,
      "(x - mean x)^2": 2.25,
      "(x - mean x)(y - mean y)": 8.812
    },
    {
      "Observation": "Student 7",
      "Weekly study hours (x)": 7,
      "Test score (y)": 75,
      "Fitted score": 74.86,
      "Residual": 0.14,
      "(x - mean x)^2": 6.25,
      "(x - mean x)(y - mean y)": 24.688
    },
    {
      "Observation": "Student 8",
      "Weekly study hours (x)": 8,
      "Test score (y)": 79,
      "Fitted score": 78.75,
      "Residual": 0.25,
      "(x - mean x)^2": 12.25,
      "(x - mean x)(y - mean y)": 48.562
    }
  ],
  "sources": [
    {
      "title": "OpenStax Introductory Statistics, 12.3 The Regression Equation",
      "url": "https://openstax.org/books/introductory-statistics/pages/12-3-the-regression-equation",
      "accessed": "2026-11-12"
    }
  ]
}