Calculando Desvio Padrao e Variança

Bom neste artigo vou postar uma classe simples que eu fiz para descobrir o Desvio Padrão e a Variança de dois valores

bom começamos pela classe, aonde acima de tudo pode colocar em uma api, ou na pasta classes, isso é indiferente.

mas segui a classe abaixo:


/**
*  @author: Kevin Felipe da Silva 
*  @since: 15/12/10
*  @version: 1.0
*/

class DesvioPadrao {

    protected $xi;
    protected $xi2;
    protected $n;

    public function calculaDesvio(array $x)
        {       
               $this->n = count($x);
       
               $this->xi =  array_sum($x) / $this->n;
          
           $this->xi2 = $this->calculaXi2($x,$this->xi);
       
           $resul = $this->valorDesvioPadrao($this->xi2, $this->n);
        return $resul;

    }
       
    public function calculaXi2(array $x, $xi)
    {

        foreach($x as $key => $value)
        {
            $xi2[] = $value - $xi;
        }


        foreach($xi2 as $key => $value)
        {
            $xi3[] = $value * $value;
        }
       
        $xi2Total = array_sum($xi3);
       
        return $xi2Total;
    }
   
    public function valorDesvioPadrao($xi, $n)
    {

        $s['varianca'] =  $xi / $n;
        $s['desviopadrao'] =  sqrt($xi);

       
        return $s;
    }
}

como usar:

Bom para usar temos que instanciar a classe
ex: em um arquivo chamado calculo.php iremos fazer assim

 
// Aqui iremos chamar a classe DesvioPadrao
require_once 'classes/DesvioPadrao.class.php';

//Instanciando a Classe DesvioPadrao
$exe = new DesvioPadrao();

// Pegando as notas em um array
$notas = array('7.5','7.7');

/* Aqui envia as notas para o metodo calculaDesvio
 aonde sera feito o calculo */
$resul = $exe->calculaDesvio($notas);

// Aqui você tera o resultado do Desvio Padrao e da Varianca dos valores
print_r($resul);

// Resultado da variança
echo $resul['varianca'];
// Resultado do Desvio Padrao
echo $resul['desviopadrao'];

God Bless

191 thoughts on “Calculando Desvio Padrao e Variança

  1. Hello there! This is kind of off topic but I need some help from an established
    blog. Is it difficult to set up your own blog?

    I’m not very techincal but I can figure things out pretty quick.

    I’m thinking about creating my own but I’m not sure where to begin. Do you have any
    ideas or suggestions? Many thanks

  2. It’s described the Volcano Vaporizer heats the complete dish, helping removing
    toxins which can be hazardous as documented with designs
    and blunts.

    Here is my blog … glass bongs etsy (Selma)

  3. Inside the 50mm- major chamber, orange glass and a blue circ perc slitted 3- perc split up smoke for a cooler, softer reach.

    Here is my site; glass bongs online cheap (Terri)

  4. With warmer weather and longer days, April is a great time to get some.

    Basically, it is relatively easy to upgrade the surrounding area of the fireplace,
    aside from the mantle. This can really help to lower the cost of air conditioning.

    Feel free to visit my web-site; femdom chat sites

  5. Provide us a call or come visit us in either spot and we will
    be pleased to assist you to find the piece of glass that suits toke needs and your smoke.

    Have a look at my web blog glass bubbler
    pipes uk (Brandon)

  6. Hi there! This is my first visit to your blog!
    We are a team of volunteers and starting a new project in a
    community in the same niche. Your blog provided us useful information to work on. You have
    done a marvellous job!

  7. Wow, amazing weblog layout! How long have you ever been running a blog
    for? you made running a blog glance easy. The overall
    glance of your web site is great, let alone the content!

  8. I absolutely love your site.. Pleasant colors & theme.
    Did you create this website yourself? Please reply back as I’m planning to
    create my own personal website and want to find out
    where you got this from or just what the theme
    is called. Appreciate it!

  9. Hiya! I know this is kinda off topic however I’d figured I’d ask.

    Would you be interested in trading links or maybe guest writing a blog article or vice-versa?
    My blog addresses a lot of the same subjects as yours and I feel we could greatly benefit from each other.
    If you are interested feel free to shoot me an email.
    I look forward to hearing from you! Great blog by the way!

  10. Wow, superb blog format! How long have you been blogging for?
    you made running a blog look easy. The full look of your web site is excellent, let alone the content material!

  11. When you engage a general contractor to work on your project,
    make certain that you locate one that agrees to a fixed price contract.
    A good accompaniment to your property would be adding pretty flowers, mulches, plants, vines,
    shrubs and some nice stones to give an updated look to your landscape.
    However, for each job, there are different kinds of home improvement contractors that you can hire.

    my web-site: dominatrix clothes (casper4gold.com)

  12. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make
    your point. You obviously know what youre talking about, why throw away
    your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?

    Visit my site: shoulder blade (Fred)

  13. Hi, I do believe this is an excellent site. I stumbledupon it ;
    ) I’m going to revisit once again since I bookmarked it.

    Money and freedom is the greatest way to change, may you
    be rich and continue to help others.

    Here is my homepage :: chiropractic treatments; Aidan,

  14. This in turn is sure to assist in enhancing the investment
    returns (ROI). For every organization having an online presence, availing Search Engine optimization solution is a
    must to support their continuous growth. They think that a website is enough to increase leads.

  15. SHIPTRONITE offers an assisted purchase service that enables you to purchase items from EU websites without having a
    EU credit card. This is since you will certainly not like your money to get wasted on some false company.
    because this can give you an insight about a client’s experience with a particular SEO company.

  16. The local SEO Company helps their client’s website to achieve high rankings in the search engines.

    For every organization having an online presence, availing Search Engine optimization solution is a must to support their continuous growth.
    Some business owners are squeamish when it comes to working with a local search engine optimization (SEO) company.

  17. The local SEO Company helps their client’s website to achieve high rankings in the search engines.
    For every organization having an online presence, availing Search Engine optimization solution is a must
    to support their continuous growth. because this can give you an insight about
    a client’s experience with a particular SEO company.

  18. This in turn is sure to assist in enhancing the investment returns (ROI).
    Then, once published, promote them through your
    social media outlets to widen your audience.
    check out for sustainable kewyord ranking and white hat seo on ~ [.

  19. Hi great website! Does running a blog similar to this require a lot of work?

    I’ve absolutely no expertise in computer programming but I had been hoping to start my own blog
    soon. Anyways, if you have any ideas or tips for new blog
    owners please share. I know this is off subject nevertheless I simply had to ask.
    Thank you!

    My site – neck injuries (Dinah)

  20. Fascinating blog! Is your theme custom made or did
    you download it from somewhere? A theme like yours
    with a few simple tweeks would really make my blog stand out.
    Please let me know where you got your theme. Thanks a lot

    Here is my homepage … improper neck (Justina)

  21. Have you ever thought about publishing an e-book or guest authoring on other websites?
    I have a blog centered on the same ideas you discuss and would love to have you
    share some stories/information. I know my visitors would enjoy your work.
    If you are even remotely interested, feel free
    to shoot me an email.

    My page lower back pain exercises (Lizzie)

  22. I’m not that much of a internet reader to be honest but your blogs really
    nice, keep it up! I’ll go ahead and bookmark your site to come back
    in the future. Many thanks

    Also visit my web page treating shoulder impingement; kv27.dk,

  23. I’ve been exploring for a little bit for any
    high quality articles or blog posts on this sort of area .
    Exploring in Yahoo I eventually stumbled upon this site.
    Studying this information So i am glad to exhibit that I’ve an incredibly just right uncanny feeling I found out
    exactly what I needed. I such a lot no doubt will make sure to
    do not disregard this web site and give it a glance on a relentless basis.

    Here is my web site; chiropractic help (http://www.ruthlessgatos.com)

  24. Hey there! I know this is kind of off topic but I was wondering if you knew where I
    could get a captcha plugin for my comment form? I’m using the same blog platform as yours and
    I’m having problems finding one? Thanks a lot!

    Here is my site: shoulder pain (Blanca)

  25. My brother suggested I would possibly like this website.
    He was once entirely right. This publish truly made my day.
    You cann’t consider just how so much time I had spent for
    this info! Thanks!

  26. Somebody essentially assist to make significantly posts I’d
    state. That is the first time I frequented your website page and up to now?
    I amazed with the analysis you made to make this particular submit incredible.
    Magnificent task!

  27. Its like you read my mind! You seem to know a lot about this,
    like you wrote the book in it or something. I think that you can do with some
    pics to drive the message home a little bit, but other than that,
    this is fantastic blog. An excellent read. I’ll certainly be back.

  28. Fantastic beat ! I wish to apprentice while you amend your website, how can i subscribe for a blog site?
    The account helped me a acceptable deal. I had been a little bit acquainted
    of this your broadcast offered bright clear idea

    Also visit my web page; free twitter followers, Bettina,

  29. Great work! That is the type of information that are meant to be shared
    around the web. Shame on the seek engines for not positioning this publish higher!

    Come on over and seek advice from my web site . Thank you =)

  30. I just could not leave your site prior to suggesting that I extremely enjoyed the usual info an individual supply in your
    visitors? Is gonna be back incessantly to check
    up on new posts

    my blog post: chronic back pain (Terrance)

  31. What’s Going down i am new to this, I stumbled upon this I have discovered It absolutely useful and it has helped me
    out loads. I’m hoping to give a contribution & aid
    other users like its helped me. Good job.

    my page; body pains (Florian)

  32. Hi, I do think this is an excellent site. I stumbledupon it 😉
    I am going to revisit yet again since I book marked it.
    Money and freedom is the best way to change, may you be rich and continue to help
    other people.

  33. Hi there i am kavin, its my first occasion to commenting anywhere, when i read this post
    i thought i could also make comment due to this
    sensible paragraph.

    Feel free to surf to my homepage … leg pains [Numbers]

  34. Nice blog here! Additionally your website quite a bit up
    very fast! What host are you using? Can I get your
    associate hyperlink on your host? I desire my website loaded
    up as fast as yours lol

  35. Link exchange is nothing else but it is only placing the other
    person’s webpage link on your page at appropriate place and other person will also do same in favor of you.

    my homepage: treating shoulder impingement (Laurene)

  36. Good Morning!

    We have recently launched the world’s first vape marketplace: Vapertunity

    It is free to join! When you join, you will be able to create a profile for your vape shop and add your products.

    To get started, head to https://vapertunity.com

    Get more exposure to vapers from around the world right now!

    P.S. Some good news. We are going to be launching our very own VAPERTUNITY coin very soon and we are going to have an air drop during which we will be giving away a lot of free coins. I will post you the details of the giveaway closer to the time.

    Cheers!

  37. hkjqtkkls,Thanks for ones marvelous posting! I actually enjoyed reading it, you will be a great author.I will always bookmark your blog and will asytfi,come back from now on. I want to encourage that you continue your great writing, have a nice afternoon!

  38. Hello, i read your blog occasionally and i own a similar one
    and i was just wondering if you get a lot of spam comments?
    If so how do you stop it, any plugin or anything you can suggest?
    I get so much lately it’s driving me crazy
    so any help is very much appreciated.

  39. htwobvdd Yeezy Shoes,Very informative useful, infect very precise and to the point. I’m a student a Business Education and surfing things on Google and found your website and found it very informative.

  40. We’re a group of volunteers and starting a new scheme in our community.

    Your site offered us with valuable info to work
    on. You have done an impressive job and our entire community
    will be grateful to you.

  41. I simply could not depart your web site before suggesting that I
    really loved the usual info an individual supply to your guests?
    Is gonna be back continuously in order to inspect new posts

  42. Thanks for the good writeup. It actually used to be a entertainment account it.
    Glance advanced to far delivered agreeable from you! By the way, how could we keep in touch?

  43. Howdy! I realize this is somewhat off-topic however I had to ask.
    Does building a well-established blog like
    yours require a massive amount work? I am brand new to operating
    a blog but I do write in my journal daily.
    I’d like to start a blog so I can share my own experience and views online.
    Please let me know if you have any suggestions or tips for new aspiring bloggers.
    Appreciate it!

  44. Globally, Spotify is still far ahead of Apple. As of December last year, Spotify said that there are 207 million active users worldwide, of which 96 million are paid users, or subscribers during the trial period, and the remaining Spotify active users have chosen a free advertising version of the service.

  45. Hi! Someone in my Myspace group shared this site with us so I came
    to look it over. I’m definitely loving the information. I’m book-marking and will be tweeting this to
    my followers! Great blog and terrific design.

  46. The American singles have to submit their photographs along with various other details like age, career, education, hobbies, future plans and so on. [url=http://aohurendeisterstr28.cryptom.site]ao huren deisterstr 28[/url] ” In a number of brief steps, he’s created age filter and he additionally talked about that he prefers people who’ve matching political and religious views (one other filter).

  47. In recent months, Trump has been strongly criticizing Powell’s monetary policy decision made by the Fed, and even said that “the Fed (risk hike) is crazy”. Trump accused that the result of Powell’s decision was that the stock market fell, saying that its steady interest rate hike in 2018 was “mad.”

  48. I do agree with all the concepts you’ve presented on your post. They’re really convincing and can definitely work. Nonetheless, the posts are very brief for beginners. Could you please lengthen them a little from next time? Thanks for the post.

  49. I think this is among the most important information for me. And i am glad reading your article. But wanna remark on few general things, The web site style is ideal, the articles is really excellent : D. Good job, cheers

  50. It’s awesome to pay a quick visit this website and reading the views of all mates on the
    topic of this piece of writing, while I am also zealous
    of getting knowledge.

  51. Yesterday, while I was at work, my sister stole my iPad and tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation. My iPad is now
    destroyed and she has 83 views. I know this is completely off topic but I
    had to share it with someone!

  52. I’m curious to find out what blog platform you happen to
    be using? I’m having some small security problems with my
    latest site and I would like to find something more secure.
    Do you have any solutions?

  53. Valuable information. Fortunate me I found your web site by accident, and I am surprised why this accident didn’t took place earlier!
    I bookmarked it.

  54. I simply couldn’t leave your website before
    suggesting that I extremely loved the standard info a person supply on your guests?
    Is gonna be again steadily in order to investigate cross-check new posts

  55. Pingback: Google
  56. Pingback: Google
  57. Great article! That is the kind of information that
    are supposed to be shared around the internet.
    Shame on the search engines for no longer positioning
    this publish upper! Come on over and discuss with my web site .
    Thanks =)

  58. While many Marvel fans were looking up theories and spoilers about Avengers: Endgame before its opening weekend, a whole other subset of people were quenching their thirst for Black Widow and Captain Marvel in… other ways. Pornhub reported that search traffic for Avengers and its main characters has skyrocketed in the days leading up to the film, further proving the old maxim (a.k.a. “Rule 34”) true: If there’s a topic out there that people even marginally care about, someone will make a porn about it.

  59. Pingback: prostate sex toy
  60. Pingback: cyberskin dong
  61. Prior to the 2019 NFL draft, Nick Bosa deleted tweets that were critical of Colin Kaepernick, Beyonce and the movie “Black Panther”, and supportive of President Donald Trump because he “might end up in San Francisco.”

  62. Pingback: male masturbator
  63. Pingback: anal vibrator
  64. Pingback: powerful vibe
  65. Pingback: sex toys
  66. Pingback: best anal vibrator
  67. Attractive section of content. I just stumbled upon your web site and in accession capital to
    assert that I get in fact enjoyed account your blog posts.

    Any way I will be subscribing to your feeds and even I achievement you access
    consistently fast.

  68. Hello to every single one, it’s really a nice for me to go
    to see this web site, it contains precious Information.

  69. Nice post. I was checking continuously this weblog and I’m inspired!
    Very useful information specially the final section :
    ) I maintain such information much. I was looking for this certain info for a very long time.
    Thank you and good luck.

  70. Your way of explaining the whole thing in this paragraph is actually pleasant, every one be
    capable of easily know it, Thanks a lot.

  71. Pingback: double dildo
  72. Pingback: rabbit vibrator
  73. Pingback: anal cleansing
  74. Pingback: 7 inches dong
  75. Do you have a spam problem on this blog; I also am a blogger, and I
    was wondering your situation; we have created some nice procedures and we are looking to exchange methods with others, please shoot
    me an email if interested.

  76. Amazing blog! Do you have any hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a little
    lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely confused ..

    Any recommendations? Thank you!

  77. Pingback: anal trainer kit
  78. Pingback: Easy cash loans
  79. Pingback: Kamagra Gold
  80. Pingback: huge dildo
  81. Pingback: Scrap car removal
  82. I was recommended this web site by my cousin. I’m not positive whether this publish is written via him as nobody else know such particular about
    my trouble. You are amazing! Thanks!

  83. Admiring the commitment you put into your site and
    detailed information you offer. It’s great to come across a blog every once in a while that isn’t the same outdated
    rehashed material. Excellent read! I’ve bookmarked your site and I’m including your RSS
    feeds to my Google account.

  84. Pingback: dp67bg manual
  85. Pingback: butt plug
  86. Hi, I do believe this is a great website. I stumbledupon it 😉 I am going
    to revisit yet again since I bookmarked it.
    Money and freedom is the best way to change, may you be rich and continue
    to guide other people.

  87. Pingback: ejaculating dildo
  88. Pingback: zero and span
  89. Pingback: Oliver Isaacs
  90. Pingback: satta matka
  91. Pingback: pussy stroker

Deixe uma resposta

O seu endereço de e-mail não será publicado.