![]() Note that, in this case, the X with a line over the top, or “X Bar,” refers to the average X value, while X subscript i refers to each individual X value. That’s all there is to it! If we can apply these formulas, we can do linear regression in SQL! Turns out, the formulas for these are pretty simple – thanks, Wikipedia! We only really need to calculate two values in order to make this happen – B0 (our intercept) and B1 (our slope). Simple linear regression is basically the process of finding the equation of a line (slope and intercept) that is the best fit for a series of data. This method would send you on your way without having to bring your data into an external tool. Of course, doing regression in SQL also has (some) practical use as well! For example, suppose you wanted to identify which city in a database of temperature records had the biggest warming trend in the last month. In the book Data Smart, John Foreman introduces a bunch of awesome methodologies by walking you through how to build them in Excel…
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |