Skip to content

Rabinnnn/Linear-Stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LINEAR-STATS

Description

This is a program built on the previously done 'math-skills' program. It focusses on Linear Regression Line and the Pearson Correlation Coefficient to print various statistical calculations. The program is created using Golang.

File System

1. maths

The directory has 2 files:

  • average.go: contains the function calculates the mean of values provided.
  • linearRegression.go: contains the function that calculates linear regression.

2. data.txt

The file contains sample dataset in the following format: 189 113 121 114 145 110 ...

3. main.go

This is the entry point for the program. It calculates and displays the Linear Regression Line and Pearson Correlation Coefficient. The output should be in the following format:

Linear Regression Line: y = x + Pearson Correlation Coefficient:

The values in between the single angle quotation marks (< >) should be a decimal number. The values for the Linear Regression Line should have 6 decimal places, while the Pearson Correlation Coefficient value should have 10 decimal places.

Execute

  • Clone the repo:
$ git clone https://learn.zone01kisumu.ke/git/rotieno/linear-stats.git
  • Navigate to the directory:
$ cd linear-stats
  • To run the program use the following command:
$ go run main.go data.txt
  • You can use the following tester to check if your program is working correctly: https://assets.01-edu.org/stats-projects/stat-bin-dockerized.zip

  • Once you've downloaded it and extracted the file, navigate to the 'stat-bin' directory, copy the 'bin' folder and paste it in your program's directory.

  • Run the tester using the command below:

$ ./bin/linear-stats

Then run your program using:

$ go run main.go data.txt

The results should be the same. Repeat the steps 3 more times to test new data sets.

Author

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This is a program that prints various statistical calculations. It focusses on Linear Regression Line and Pearson Correlation Coefficient. It takes a file with numeric data, computes a best-fit line, and calculates the Pearson correlation coefficient, which quantifies how strongly the xaxis and yaxis are linearly related.

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages