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.
-
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.
No installation is required. Simply download the files and open the 'index.html' file in your web browser.
-
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.
-
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.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request with your improvements