Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Python: Help with bestfit line and outliers

  1. Jul 7, 2010 #1

    DMT

    User Avatar

    I've been having some trouble with outliers messing up my best fit line on my scatter plot in python. I'm using numpy's polyfit function to calculate the slope and y intercept of the best fit line, however I always seem to get one or two points which throw off the slope enough to make quite a noticeable difference. I've already checked a few python references and did a lengthy google search, but haven't found a solution. Does anyone know of a good way to fix this problem without having to limit the interval or physically remove the bad points from my data?

    Edit: Also, knowing a way to take errors into account would be very helpful as well.

    Thanks!
     
    Last edited: Jul 7, 2010
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Loading...
Similar Threads for Python Help bestfit Date
Python (VPython) Can someone help me with my orbit simulator? Monday at 12:43 AM
Python What's wrong with my bisection method code? Dec 10, 2017
Python Help: Convert Matlab to Python code Dec 8, 2017
Python PYTHON help Dec 29, 2016