You want to predict the price for renting an apartment in Warsaw?
Check out this apartment price prediction script that utilizes simple linear regression and this database to predict the price of an apartment.
For explanation of all the mathematics scroll down.
How does it work?
To predict the price of an apartment, linear regression has to be used. Linear regression is easy to employ when 2 variable functions are used; therefore, in this script the area of an apartment is presented as $X$ and price as $Y$.
To calculate the optimal line of regression, minimizing the total sum of squares of $Y$ is required. $SSy$ shows how big is the sum of all the differences of $Yi$ and $\overline{Y}$, how precise is the linear function. The parameters of the linear function are $\hat{\beta_0}$ and $\hat{\beta_1}$. The optimal parameters can be calculated in 3 steps.
Deriving the formula for partial derivatives of $\hat{\beta_0}$ and $\hat{\beta_1}$
-> It is done to determine the slope of the function at a given moment
Calculating zeroes of the two derivatives
-> $\frac{\partial f}{\partial x} = 0$ is a local minimum of a function
Solving the simultanious equations for $\hat{\beta_0}$ and $\hat{\beta_1}$
-> To derive the complete forumla for the linear regression $Y = \hat{\beta_1}X + \hat{\beta_0}$