Skip to content

This calculator will take a set of data points, compute the best-fit line using linear regression, and display the slope, intercept, and a plot of the data points with the regression line.

License

Notifications You must be signed in to change notification settings

vivekv2810/Linear-Regression-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Linear Regression Calculator

This is a simple web-based Linear Regression Calculator built with HTML, CSS, and JavaScript. The calculator allows users to input pairs of data points and calculates the best-fit linear equation using the least squares method. The result includes the equation of the line and a visual plot of the data points along with the regression line.

Features

  • Responsive Design: The calculator features a clean, responsive design with an attractive green-blue gradient theme.

  • Input Validation: The app validates the input to ensure that the user provides valid data points before performing calculations.

  • Interactive Hover Effects: Interactive elements like the text area, buttons, and canvas have hover effects, enhancing the user experience.

  • Real-Time Plotting: After calculating the regression, the calculator plots the data points and the best-fit line on a canvas.

Installation

No installation is required. Simply download the files and open the 'index.html' file in your web browser.

Usage

  • Input Data: Enter your data points in the text area. Each data point should be in the format x,y, with one point per line. For example:

    1,2

    2,3

    3,5

    4,4

    5,6

  • Calculate Regression: Click the "Calculate Regression" button to calculate the best-fit linear equation.

  • View Results: The equation of the regression line will be displayed, and the data points along with the regression line will be plotted on the canvas below.

  • Error Handling: If no values are entered or if the values are not in the correct format, an error message will be displayed prompting the user to enter valid values.

Files

  • index.html: The main HTML file that contains the structure of the calculator.

  • styles.css: The CSS file that styles the calculator, including the gradient background, hover effects, and layout.

  • script.js: The JavaScript file that handles the logic for calculating the linear regression, validating inputs, and plotting the data.

Example

Screenshot 2024-08-08 110926

Contributing

If you'd like to contribute to this project, feel free to fork the repository and submit a pull request with your improvements

About

This calculator will take a set of data points, compute the best-fit line using linear regression, and display the slope, intercept, and a plot of the data points with the regression line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published