Standard Normal Distribution, Normal Distribution

Class Example

# Read Data File
bigCity <- read.csv("C:\\Users\\samy_\\Desktop\\R_Python_Machine Learning DataSets\\bigcity.csv")
attach(bigCity)

# Plot Histogram and Density Function
hist(log(u), probability = TRUE)
xx <- seq(min(log(u)), max(log(u)), length = 100)
lines(xx, dnorm(xx, mean = mean(log(u)), sd = sd(log(u))))

Function to check whether data is normal or not

qqnorm(u)

Since not normal use Transformation to make it normal

qqnorm(log(u))
qqline(log(u)) # line plot

z-score calculation

qnorm(0.975) # 95% Confidence Interval
## [1] 1.959964
qnorm(0.95) # 90% Confidence Interval
## [1] 1.644854
qnorm(0.995) # 99% Confidence Interval
## [1] 2.575829

Calculate Probablity

pnorm(75, 72, 6)
## [1] 0.6914625

Calculate the Probability for Class Examples

### Problem 1
p_morethan62 <- 1 - pnorm(62, 58, 4) 
print(p_morethan62)
## [1] 0.1586553
### Problem 2
p_lessthan62 <- pnorm(62, 58, 4)
print(p_lessthan62)
## [1] 0.8413447
### Problem 3
p_20_15 <- pnorm(22, 20, 4) - pnorm(15, 20, 4)
print(p_20_15)
## [1] 0.5858127

Normal Dist

x <- rnorm(1000, mean=100, sd=15)
hist(x, probability = TRUE)
xx <- seq(min(x), max(x), length=100)
lines(xx, dnorm(xx, mean=100, sd=15))