Regression Visualization

Phase 1: Data Input and Validation

  • Implement user input for x and y coordinates via console or CSV file import.
  • Validate numeric inputs and ensure the number of x and y values match.
  • Handle missing or malformed data gracefully with informative error messages.

Functional Result: Program stores valid points from both CLI and file, rejecting invalid inputs without crashing.


Phase 2: Regression Coefficient Calculation and Statistics

  • Compute coefficients for linear regression ((y = mx + b)) using least squares.
  • Compute coefficients for logarithmic regression ((y = a \cdot \ln(x) + b)) using transformed inputs.
  • Calculate additional statistics for both regression types: R², residuals, and standard error.
  • Handle edge cases such as x ≤ 0 for logarithmic regression or insufficient data points.

Functional Result: Program outputs correct coefficients and statistics for both linear and logarithmic regression.


Phase 3: Equation Display and Reporting

  • Display regression equations in a readable format, rounded to 3 decimals:

    • Linear: y = mx + b
    • Logarithmic: y = a*ln(x) + b
  • Allow optional generation of a text or CSV report containing all equations, coefficients, and statistics.

  • Ensure proper formatting and clarity for both types.

Functional Result: Users can view and save formatted equations and statistics for both regression types.


Phase 4: GUI and Interactive Plotting

  • Build a GUI using Tkinter or PyQt:

    • Input fields for manual data entry and buttons for CSV import/export.
    • Buttons to select regression type (linear or logarithmic).
    • Plot original points and the regression line using matplotlib.
    • Include dynamic features like zooming and changing the line colors.
  • Ensure proper labels, titles, and legends on plots.

Functional Result: Users can interactively select regression type, see the fitted line over the data points, and verify calculations visually.