Calculating Standard Deviation in Visual Basic (2015)

  • Thread starter Thread starter error.Eiji
  • Start date Start date
E

error.Eiji

Guest
Hey guys, Eiji here, new to the forums!

I'm having a lot of trouble here trying to figure out how I can calculate the Standard Deviation. I've looked all over google and other threads including many other sites, and found nothing but bickering, vague concepts, or code that is only applicable in other contexts.

In my situation here, I am required to find the Lowest Value, Average, and Standard Deviation within the list of values (all inserted within a listbox of course).

I've basically managed to get the average and lowest number working (through trial and error, i still lack understanding of overall concept of the code)

Right now, I want to figure out how I can find Standard Deviation, but I don't know how I can line up a list of numbers separately to calculate. In this situation, I first want to take each number separately, subtract the average from each number, and then square the result FOR EACH NUMBER, SEPERATELY. Once I've squared each of the differences, I need to calculate the "variance" which is by adding up the squared differences and dividing them by the number count. Once I've found my variance, I must find the square root of my variance to find the Standard Deviation. This is to those who don't know what Standard Deviation is, but i'm pretty sure you all do, or have the ability to look it up.. So, how do I do that through code?

If possible, itd be great if we can work our way with the code I already have set, meaning I wouldnt have to touch any other line BEFORE Line 49, unless if it's just a small minor change like a Declaration Type or anything crucial of that sort. Because the Lowest Value and Average Value is already set stable, so if we can work our way around it and work from Line 49 down, that would be splendid.

Here's my code so far: (unfortunately i can't enter an image here yet lol, so here's the imgur link to my code)

View: http://imgur.com/uDe8TLw


I tested my program and all I know is that I'm not getting the standard deviation correctly.

Someone please help me, i've tried my best, and I'm really new to VB. My professor is foreign, she does not speak English too well and she likes to play 'blues clues'. I ask her and she LITERALLY would not want to help me, and tells me to figure it out completely on my own. Mind you I pay attention in class, and this material is not covered. I understand her methods and how it pushes us students to play around with vb, but this is far too complex for me for I haven't even covered the basic building blocks to how I can even use loops or arrays etc.


Thank you for your time guys!


__________________________

UPDATE

Thanks to Cor Ligthert, dbasnett and Frank L. Smith, I've managed to find the solution!

1033731.png

Thread is closed on my end, but for anyone else who may have similar inquiries related to having to calculate Standard Deviation, perhaps in a different format, may also utilize this post for further questions.

Awesome forums!! :)

Continue reading...
 
Back
Top