Posts

Showing posts from October, 2019

python statistics normal distribution continuous density

Image
Normal Distribution: Stats Class Code.



I was attempting to write the different formula's I would need for a normal distribution curve and the calculations we'd need for class.  There is a bit of success and a bit of failure in the code.  I may tweek it a bit more, so that someone could enter the a and b,  size of the curve, and the area range they want and it does the deviation, and mean calculations also, but this is enough for now.

As always, drop a comment if you see anything wrong, or that needs improvement.  Take the code, practice, break it, build it, have fun learning.

Lessons learned:
Now for this bit of code, I was sure I could use the formula I found in this Khan video to write my own python function to find the probability in a range under a curve.

Turns out, no, the math is way more complex for a continuous function.
I am leaving my function and the way it uses the formula in the code block.
I made an effort, but it failed.  I am under the assumption that scipy'…

Binomial deviation, mean, expected value, python Statistics class

Image
Binomials Deviation, Mean, Expected Value



Another stellar explanation by this Khan Academy teacher:
https://www.khanacademy.org/math/ap-statistics/random-variables-ap/binomial-mean-standard-deviation/v/finding-the-mean-and-standard-deviation-of-a-binomial-random-variable

The code has comments, but I highly encourage watching the referenced video for understanding.  I still have to look up these Bernoulli variables, and maybe check out doing something pythonistic for that too.   
So not much commentary on todays blog.

GIMME THE CODE --start code block-- # Binomial mean, deviation import math import sys # reference= https://www.khanacademy.org/math/ap-statistics/random-variables-ap/binomial-mean-standard-deviation/v/expected-value-of-binomial-variable # Binomail random variable X, is understood as: # 1) A sample set is finite # 2) The success and fail probabilities are constant, they do not change # 3) They probabilities are independant of one another. def return_ints(n, p): try: …

Stats class, binomial distribution Python

Image
A little background:

For my statistics class at the local community college, the teacher has us plug numbers into Excel to get answers, because well, we don't need to learn to do the formula.




I may be kinda a stickler about knowing the formula, while it's great Excel has a way to just plug in the numbers, I need to see the math.  I need to see and understand what's going on.

I'll come back for more testing on this, and more explanation.  The link below for khan academy will do a far superior job at explaining the math than I can.


Links
I don't know about you all, but when I looked at the SciPy and Numpy links, I had a hard time following.  Also, the formulas and methods I found return an array or an object.  I just need the result of that big hairy formula.  I must not be googling correctly.  If anyone can link me to the method in either one of these that just returns the results of that binomial distribution formula, it'd be much appreciated.  *Also, then I can…