## Loading required package: car
## Loading required package: carData
## Loading required package: sandwich
x <- seq(-3.3, 3.3, length.out=1000)
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(-1, 1)), col=c('#0080C0'), legend=FALSE)

plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(-2, 2)), col=c('red'), legend=FALSE)

plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(-3, 3)), col=c('skyblue'), legend=FALSE)

plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(-10, 0)), col=c('green'), legend=FALSE)

#Regra impirica da normal 68% 95,4% 99,7%
#x~N(mu,sigma)
#x~N(0,1)
#P(0<x<1) = 0,34
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(0, 1)), col=c('yellow'), legend=FALSE)

#x~N(0,1)
#P(-2<x<0) = 0,475
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(-2, 0)), col=c('yellow'), legend=FALSE)

#x~N(0,1)
#P(0<x<3) = 0,4985
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(0, 3)), col=c('tomato3'), legend=FALSE)

#x~N(0,1)
#P(0<x<infinito) = 0,5
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(0, 10)), col=c('tomato3'), legend=FALSE)

#x~N(0,1)
#P(1<x<3) = P(0<x<3) - P(0<x<1) = 0,4985 - 0,34 = 0,1585
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(0,1),c(1, 3)), col=c('red','skyblue'), legend=FALSE)

#x~N(0,1)
#P(2<x<3) = P(0<x<3) - P(0<x<2) = 0,4985 - 0,475 = 0,0235
plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(2, 3)), col=c('skyblue'), legend=FALSE)

plotDistr(x, dnorm(x, mean=0, sd=1), cdf=FALSE, xlab="x", ylab="Densidade",
regions=list(c(0,2),c(2, 3)), col=c('red','skyblue'), legend=FALSE)

u=seq(0,3.09,by=0.01)
p=pnorm(u)
p=p-0.5
m=matrix(p,ncol=10,byrow=TRUE)
m=round(m,4)
DT::datatable(m)