Monday, 18 March 2019

Revisiting R and R Studio: The Normal/ Gaussian Distribution.


Binomial vs Normal Distribution

The Normal/ Gaussian Distribution is just the Binomial distribution but Extended to very large N (Sample Size), logical probabilities, and it is continuous. That is a key point of Understanding: Binomial Distribution: Discrete Normal/ Gaussian Distribution: Continuous.

An application of the normal/ Gaussian distribution can be found in Noise modelling. Noise is so random, so unpredictable that as a whole we treat it as a distribution of probabilistic values that may appear, centered on the mean.

Sometimes its high, sometimes its low most of the times we don't really know. So we roll the dice.





On some level, this is a Normal Distribution that crackle and hiss through your microphone, emanating from the blue sky beyond your window.

The Normal/ Gaussian Distribution is modeled on a bell curve with 0 being on the left. 1 being on the right. It reads cumulatively from left to right. with the mean being the center. Plugging in different statistics we can shift the mean left or right.

Here are some sample Gaussian distribution bell curve:




Playing with the mean shifts the graph around, playing with the standard deviations makes it compressed or expanded

These are the commands used to generate these graphs, we have to plot first then we can play with points:

> x <- seq(from=-4,to=4,len=100)
> plot(x,dnorm(x),pch=16,ylim=c(0,0.6),type='l',main='some Gaussian distributions')
# Prepare some Gaussian distributions

> points(x, dnorm(x, mean = 1), col = 'red', type = 'l')
> points(x, dnorm(x, mean = 2), col = 'green', type = 'l')
> points(x, dnorm(x, sd = 2), col = 'blue', type = 'l')
> points(x, dnorm(x, mean = -1 , sd = 2), col = 'purple', type = 'l')
> points(x, dnorm(x, mean = -1 , sd = 2), col = 'orange', type = 'l')
> points(x, dnorm(x, mean = -1.5 , sd = 2), col = 'cyan', type = 'l')
> points(x, dnorm(x, mean = -2 , sd = 2), col = 'magenta', type = 'l')
# plot distributions of various shapes and sizes

We can use R to further Explore the Normal Distribution with some simple commands. Lets check them out.

...

we can use pnorm(X) function to key in an X value and find the cumulative area of the graph. The area returned is the cumulative probabilities from the left side of the graph until the keyed in X value.

Example:

pnorm(-1000) = 0 # no probability of happening? 

pnorm(-10) = 7.619853e-24 # fairly low probability of Happening

pnorm(-1.75) = 0.04005916 # low probability of happening

pnorm(0) = 0.5 # Half probability

pnorm(8) = 0.8413447 # fairly high probability of happening

pnorm(1000) = 1 very # High likely probability of happening


...

Normal/ Gaussian Distribution is a key concept in Hypothesis Testing where our objective isn't to test whether to accept a null hypothesis but to determine whether to reject it or fail to reject it.

This will involve something called a p-value...

No comments:

Post a Comment

Diaries of an Aspiring Astrophysicist (DAS Astro) Podcast

Diaries of an Aspiring Astrophysicist Episode 1: The last year has been weird Episode 2: Cosmic Collisions and Gravitational Wa...