Professional Documents
Culture Documents
Practica 2 Temperatura
Practica 2 Temperatura
library(readxl);library(tidyverse)
Clima_Madrid_2018<-read_excel("C:/Users/Descarga/Clima_Madrid_2018.xlsx")
datosPre<-as.data.frame(Clima_Madrid_2018$pressure)
datosPre
## Clima_Madrid_2018$pressure
#2
library(ggplot2)
ggplot(data = datosPre,mapping = aes(x= Clima_Madrid_2018$pressure))+
geom_histogram(bins = 8,fill="lightcyan",color="blue")+
theme_classic()+
scale_x_continuous(n.breaks = 8)+
labs(x="pressure",y="cantidad")
#3
library(fitdistrplus)
##
## Attaching package: 'MASS'
#m_weibull<- fitdist(datosPre$`Clima_Madrid_2018$pressure`,
"weibull",method = "mle")
#m_gamma<- fitdist(datosPre$`Clima_Madrid_2018$pressure`, "gamma",method
= "mle")
m_normal<- fitdist(datosPre$`Clima_Madrid_2018$pressure`, "norm",method =
"mle")
plot.legend<- c("norm")
gofstat(m_normal, fitnames = c("normal"))
## Goodness-of-fit statistics
## normal
## Kolmogorov-Smirnov statistic 0.1592717
## Cramer-von Mises statistic 50.4890805
## Anderson-Darling statistic 280.2473620
##
## Goodness-of-fit criteria
## normal
## Akaike's Information Criterion 70139.63
## Bayesian Information Criterion 70153.92
# Hist
denscomp(list(m_normal), legendtext = plot.legend,datacol =
"#FFE4E1",fitlwd = 0.8,plotstyle ="ggplot",breaks =8)+theme_classic()+
scale_x_continuous(n.breaks = 8)
## mean sd
## 1015.91920 10.11544
EX<-m_normal$estimate[1]
EX
## mean
## 1015.919
SX<-m_normal$estimate[2]
SX
## sd
## 10.11544
library(boot)
##
## Attaching package: 'boot'
## [1] 14.08055
hist(simulacion$t,
labels=TRUE,
col = "lightblue",
main = "",
xlab ="temperature",
ylab ="Cantidad",
ylim = c(0,70),
right = FALSE,
nclass = 5)
Intervalo<-boot.ci(simulacion,cont=0.95,type="norm")
Intervalo
abline(v = Intervalo$normal,col="red",lwd=2,lty=3)
data.frame(Parámetro=EX,Estimador=Estimador,Sesgo=Estimador-EX)
1
datos<-as.data.frame(Clima_Madrid_2018$Temperature)
datos
## Clima_Madrid_2018$Temperature
#2.
library(ggplot2)
ggplot(data = datos,mapping = aes(x = Clima_Madrid_2018$Temperature))+
geom_histogram(bins = 8,fill="lightcyan",color="blue")+
theme_classic()+
scale_x_continuous(n.breaks = 8)+
labs(x="temperature",y="Cantidad")
#m_weibull<- fitdist(datos$`Clima_Madrid_2018$Temperature`,
"weibull",method = "mle")
#m_gamma<- fitdist(datos$`Clima_Madrid_2018$Temperature`, "gamma",method
= "mle")
m_normal<- fitdist(datos$`Clima_Madrid_2018$Temperature`, "norm",method =
"mle")
plot.legend<- c("norm")
gofstat(m_normal, fitnames = c("normal"))
## Goodness-of-fit statistics
## normal
## Kolmogorov-Smirnov statistic 0.08248635
## Cramer-von Mises statistic 16.72664965
## Anderson-Darling statistic 100.18955159
##
## Goodness-of-fit criteria
## normal
## Akaike's Information Criterion 67939.7
## Bayesian Information Criterion 67954.0
# Hist
denscomp(list(m_normal), legendtext = plot.legend,datacol =
"#FFE4E1",fitlwd = 0.8,plotstyle ="ggplot",breaks =8)+theme_classic()+
scale_x_continuous(n.breaks = 8)
## mean sd
## 14.266637 8.997715
#5.
EX<-m_normal$estimate[1]
EX
## mean
## 14.26664
SX<-m_normal$estimate[2]
SX
## sd
## 8.997715
#6.
muestra<-data.frame(x=rnorm(n = 867,mean =14.26664 ,sd = 8.997715))
library(boot)
##
## Attaching package: 'boot'
## [1] 13.62256
hist(simulacion$t,
labels=TRUE,
col = "lightblue",
main = "",
xlab ="temperature",
ylab ="Cantidad",
ylim = c(0,70),
right = FALSE,
nclass = 5)
Intervalo<-boot.ci(simulacion,cont=0.95,type="norm")
Intervalo
abline(v = Intervalo$normal,col="red",lwd=2,lty=3)
data.frame(Parámetro=EX,Estimador=Estimador,Sesgo=Estimador-EX)