Extraia deste conjunto de dados, os valores referentes ao mês de março.
clim_dou <- read.csv2("C:/Users/Carol/Dropbox/UFGD/2019.01_Disciplinas/Topicos de Estatistica/4_Aula/clim_dou.csv")
#head(clim_dou)
mar = subset(clim_dou, Meses==3)
require(ggplot2)
## Loading required package: ggplot2
ggplot(mar, aes(x = Tem_max)) +
geom_histogram(aes(y = ..density..),
binwidth = 1, # Amplitude da classe
fill = 'dodgerblue',
color = 'black') +
labs(title = "Distribuição da temperatura máxima diária",
x = "Temperatura Máxima (º C) em Março",
y = "Densidade") +
geom_density(alpha = 0.5)+ # Linha de densidade
stat_function(fun = dnorm, color='red', size = 2,
args = list(mean = mean(mar$Tem_max),
sd = sd(mar$Tem_max)))+
theme_light()
mean(mar$Tem_max)
## [1] 31.44524
sd(mar$Tem_max)
## [1] 2.711143
pnorm(q = 33, # x=36
mean = mean(mar$Tem_max), # Média
sd = sd(mar$Tem_max), # Desvio padrão
lower.tail = FALSE # Calcula P[X > x]
)
## [1] 0.2831636
pnorm(q = 26, # x=36
mean = mean(mar$Tem_max), # Média
sd = sd(mar$Tem_max), # Desvio padrão
lower.tail = TRUE # Calcula P[X ??? x]
)
## [1] 0.02229677
pnorm(q = c(30, 36), # x=36
mean = mean(mar$Tem_max), # Média
sd = sd(mar$Tem_max), # Desvio padrão
lower.tail = TRUE # Calcula P[X ??? x]
)
## [1] 0.2969906 0.9535227
0.9535227-0.2969906
## [1] 0.6565321
require(ggplot2)
ggplot(mar, aes(x = Tem_min)) +
geom_histogram(aes(y = ..density..),
binwidth = 1, # Amplitude da classe
fill = 'dodgerblue',
color = 'black') +
labs(title = "Distribuição da temperatura mínima diária",
x = "Temperatura Mínima (º C) em Março",
y = "Densidade") +
geom_density(alpha = 0.5)+ # Linha de densidade
stat_function(fun = dnorm, color='red', size = 2,
args = list(mean = mean(mar$Tem_min),
sd = sd(mar$Tem_min)))+
theme_light()
mean(mar$Tem_min)
## [1] 20.05335
sd(mar$Tem_min)
## [1] 2.108374
pnorm(q = 17, # x=36
mean = mean(mar$Tem_min), # Média
sd = sd(mar$Tem_min), # Desvio padrão
lower.tail = TRUE # Calcula P[X ??? x]
)
## [1] 0.07378035
pnorm(q = c(15, 18), # x=36
mean = mean(mar$Tem_min), # Média
sd = sd(mar$Tem_min), # Desvio padrão
lower.tail = TRUE # Calcula P[X ??? x]
)
## [1] 0.008269474 0.165052527
0.165052527 - 0.008269474
## [1] 0.1567831
femeas <- 0:16
probabilidade <- dbinom(x=femeas, # Quantidade de sucessos
size = 16, # Quantidade de nascimento
prob=5/9) # Probabilidade a priori de sucesso
plot(femeas, probabilidade,
type='h', # Desenha uma linha vertical
col='red', # Cor da linha
lwd=3) # Espessura da linha/ponto
pbinom(q=12, # Quantidade de fêmeas
size=16, # Quantidade total de filhores
prob=5/9, # Probabilidade inicial de fêmea
lower.tail = FALSE #P[X> x]
)
## [1] 0.03107061
set.seed(33)
cap <- rpois(n=30, lambda = 2.80)
cap
## [1] 2 2 3 5 4 3 2 2 0 1 3 2 1 2 4 4 4 2 1 5 3 0 3 2 6 4 3 2 4 2
peixes <- data.frame('cap' = cap)
ggplot(peixes, aes(x = as.factor(cap), y=..count../sum(..count..),
fill = as.factor(cap))) +
geom_bar(width=0.1) +
labs(title = "Peixes capturados por hora",
x = "Quantidade de peixes",
y = "Frequência",
fill='QTD peixes')
mean(peixes$cap)
## [1] 2.7
sd(peixes$cap)
## [1] 1.441981
dpois(x = 2,
lambda = mean(peixes$cap))
## [1] 0.2449641
ppois(q = 3,
lambda = mean(peixes$cap),
lower.tail = FALSE)
## [1] 0.2859078
pbinom(q=5,
size=18,
prob=0.70,
lower.tail = FALSE #P[X> x]
)
## [1] 0.9997309
dbinom(x=10,
size=18,
prob=0.70 )
## [1] 0.08109758
pbinom(q=14,
size=18,
prob=0.70,
lower.tail = TRUE
)
## [1] 0.8354495
ppois(q = 9,
lambda = 8,
lower.tail = FALSE) #P[X > x]
## [1] 0.2833757
ppois(q = 8,
lambda = 8,
lower.tail = TRUE) # P[X ??? x],
## [1] 0.5925473