Algorithm:
Step 1. Read n
Step 2. sumx = 0
Step 3. sumxsq = 0
Step 4. sumy = 0
Step 5. sumxy = 0
Step 6. for i = 1 to n do
Step 7. Read x, y
Step 8. sumx = sumx + x
Step 9. sumxsq = Sumxsq + x2
Step 10. sumy = Sumy + y
Step 11. sumxy = sumxy + x * y end for
Step 12. denom = n * sumxsq – sumx * sumx
Step 13. a0 = (sumy * sumxsq – sumx * sumxy) / denom
Step 14. a1 = (n * sumxy - sumx * sumy) / denonm
Step 15. Write a1, a0
Step 16. Stop
Follow Simple Linear Regression
You Might Also Like
Bright Data - All in One Platform for Proxies and Web Scraping
Bright Data offers the highest quality proxies with automated session management, IP rotation, and advanced web unlocking technology. Enjoy reliable, fast performance with easy integration, a user-friendly dashboard, and enterprise-grade scaling. Powered by ethically-sourced residential IPs for seamless web scraping.
Rate This Project
Login To Rate This Project
User Reviews
Be the first to post a review of Simple Linear Regression!