Skip to content
    Greek Mathematician Mascot - Daskalos
    Mathimatikos

    60% off your first year

    Terms

    Student Pro: €35.60 for the first year instead of €89

    Teacher Pro: €75.60 for the first year instead of €189

    Code LAG60. One use per account. Renews automatically at the regular price. Cancel anytime.

    View plans

    Linear regression and Pearson correlation

    Find the least squares line, the Pearson coefficient, and R² for pairs of numerical observations.

    Calculate the result

    From 2 to 50 values. Separate the values with a Greek question mark (;), space, or newline. For decimals, use a comma or a period.

    Write one y value for each x, in the same order.

    y^=a+bxb=SxySxxr=SxySxxSyy

    Worked example

    Problem

    Find the least-squares line and the Pearson correlation coefficient for the pairs (1, 2), (2, 4), (3, 5), and (4, 7).

    The fitted line is ŷ = 0.5 + 1.6x. The Pearson correlation coefficient is approximately 0.9923.

    1. Find the centered moments

      Sxx=5,Sxy=8,Syy=13
    2. Calculate the slope and intercept

      b=85=1.6,a=4.5−1.6⋅2.5=0.5
    3. Compute Pearson

      r=865≈0.9923
    Ask AI for a step-by-step solution

    Common mistake

    A strong linear correlation does not prove causality. Variation in x is needed for a unique slope, and variation in both variables is needed for Pearson.