# Linear Regression: Fitting a Line to Data

In a previous post I implemented the Pearson Correlation Coefficient, a measure of how much one variable depends on another. The three sets of bivariate data I used for testing and demonstration are shown again below, along with their corresponding scatterplots. As you can see these scatterplots now have lines of best fit added, their gradients and heights being calculated using least-squares regression which is the subject of this article.

# Finding Prime Numbers – Sieve of Eratosthenes

Prime numbers have been understood at least since the Ancient Greeks, and possibly since the Ancient Egyptians. In modern times their study has intensified greatly due to their usefulness, notably in encryption, and because computers enable them to be calculated to a massively higher level than could be done by hand.

The best know (and according to Wikipedia still the most widely used) method for identifying them is the Sieve of Eratosthenes, which I will implement here in C.

# Pearson Correlation Coefficient

Correlation is the process of quantifying the relationship between two sets of values, and in this post I will be writing code in C to calculate possibly the best-known type of correlation - the Pearson Correlation Coefficient.