Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 1.62 KB

README.md

File metadata and controls

54 lines (40 loc) · 1.62 KB

Linear Stats

This Python program reads data from a file and calculates two key statistics: the Linear Regression Line and the Pearson Correlation Coefficient. The data file contains one value per line, which represents the y-values of a graph, while the x-values are the line numbers (starting from 0).

The program expects the data to be provided in a file where each line contains a single number, like this:

189
113
121
114
145
110
...

Example of the program output:

Linear Regression Line: y = 3.456789x + 1.234567
Pearson Correlation Coefficient: 0.9876543210

Usage

  1. Make sure Python is installed on your system (version 3.6 or higher).
  2. Install the required dependencies:
pip install numpy scipy
  1. run the program, using:
python3 app.py data.txt

Testing

To test the program, run ./bin/linear-stats followed by python3 app.py data.txt, and compare the results of the tester with my program. The bin program modifies data.txt each time it runs, so feel free to test multiple times. Happy testing!

Concepts

Linear Regression Line

linear/concept linear/formula

Pearson Correlation Coefficient

linear/concept linear/formula