Datos <- c(122,72.5,52,36.25,29.25,82.75,84.75,71.50,80.5,72,64.75,68.75,79.5,65.75,82.5,68,70,68.75,77.25,68.25,57.5,60.75,63,69.2,73.2,121,70.2,51.4,32.43,28.56,81.45,81.60,70.41,81.45,71.40,62.41,62.54,78.8,64.22,84.63,67,71.40,64.30,76.42,65.43,53.4,61.42,62,68.34,70.52)
Posible funcion
fun.distribucion <-function(k){
require(rriskDistributions) rta<-fit.cont(Datos)
return( rta ) }
fun.distribucion(Datos)
Solucion punto por punto
#Como saber si es una distribucion exponencial
ks.test(Datos,pexp, mean(Datos))
## Warning in ks.test(Datos, pexp, mean(Datos)): ties should not be present for the
## Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: Datos
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
#Como saber si es una distribucion normal
ks.test(Datos,pnorm, mean(Datos),sd(Datos))
## Warning in ks.test(Datos, pnorm, mean(Datos), sd(Datos)): ties should not be
## present for the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: Datos
## D = 0.15767, p-value = 0.1664
## alternative hypothesis: two-sided
#Como saber si es una distribucion uniforme
ks.test(Datos,punif, min(Datos),max(Datos))
## Warning in ks.test(Datos, punif, min(Datos), max(Datos)): ties should not be
## present for the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: Datos
## D = 0.35865, p-value = 5.184e-06
## alternative hypothesis: two-sided
#Como saber si es una distribucion Poisson
ks.test(Datos,ppois,mean(Datos))
## Warning in ks.test(Datos, ppois, mean(Datos)): ties should not be present for
## the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: Datos
## D = 0.11793, p-value = 0.4901
## alternative hypothesis: two-sided
#Como saber si es una distribucion log normal
ks.test(Datos,plnorm, mean(Datos),sd(Datos))
## Warning in ks.test(Datos, plnorm, mean(Datos), sd(Datos)): ties should not be
## present for the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: Datos
## D = 0.99991, p-value < 2.2e-16
## alternative hypothesis: two-sided
#Como saber si es una distribucion gamma
ks.test(Datos,pgamma, mean(Datos),var(Datos))
## Warning in ks.test(Datos, pgamma, mean(Datos), var(Datos)): ties should not be
## present for the Kolmogorov-Smirnov test
##
## One-sample Kolmogorov-Smirnov test
##
## data: Datos
## D = 1, p-value < 2.2e-16
## alternative hypothesis: two-sided
Como se construye una distribucion empirica En R se dispone de la función ecdf, para obtener la función de distribución empírica de una muestra cualquiera.
#Como se construye una distribucion empirica
ecdf(Datos)
## Empirical CDF
## Call: ecdf(Datos)
## x[1:47] = 28.56, 29.25, 32.43, ..., 121, 122