1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Brain cramp on this averaging

  1. Dec 29, 2005 #1


    User Avatar
    Gold Member

    My website posts my movie reviews and rates them from 1 - 5. I want to post an average*, and I can't figure out how to do it.

    Rating Number of movies

    I can't figure out how to average* them without biasing them in favour of the higher numbers.

    (*by average, I mean I should get approx 3.? / 5 .)
  2. jcsd
  3. Dec 29, 2005 #2
    When I average them out I get about 3.36 which I would think is approximately 3.
  4. Dec 29, 2005 #3


    User Avatar
    Science Advisor

    dunno why this is a problem. avg. is
    [tex]\overline{s}=\sum n_is_i/\sum n_i[/tex]
    This doesn't "bias" to high scores: consider if you had 6 1's and 6 5's and nothing else. You would get avg.=(1*6+5*6)/(1+5)=3 exactly as expected, so what do you mean by this "bias"?
  5. Dec 29, 2005 #4


    User Avatar
    Homework Helper
    Gold Member

    This is where I am confused.

    What do you mean by "bias"?
  6. Dec 29, 2005 #5


    User Avatar
    Gold Member

    OK, so

    (5*12)+(4*37)+(3*41)+(2+10)+(1*6) = 357
    1+2+3+4+5 = 15

    357/15 = 23.8
  7. Dec 29, 2005 #6


    User Avatar
    Gold Member



    It's just 357 / 107.

  8. Dec 29, 2005 #7
    Don't divide by the sum of the "choices" divide by the number of total ratings

    ie. ((6*1)+(10*2)+(41*3)+(37*4)+(12*5))/(6+10+41+37+12) which is about 3.36
  9. Dec 29, 2005 #8


    User Avatar
    Gold Member

    I've had it right all along and I keep second-guesing my code. (This is not even the first time I've tried to "fix" it.)

    It's been saying 3.3 for a long time now, but that's not because it's "stuck" or broken, that's because 3.3 *is* the point of convergence, and subsequent entries are strongly averaging around it.

    BTW, for those interested, my reviews and ratings page is http://www.davesbrain.ca/reviews.php" [Broken]. It is database driven, and I am rather proud of it.
    Last edited by a moderator: May 2, 2017
  10. Dec 30, 2005 #9


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Last edited by a moderator: Apr 21, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Brain cramp averaging Date
I Average chord length of a circle Oct 24, 2017
Common Core 32 -12? please help my brain! Mar 4, 2014
Brain Teaser Jul 26, 2010
Brain teaser I can't get out Jun 19, 2009
My brain is fried and I need help Aug 12, 2008