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562,0.683,0.844,0.811,0.341,0.699,0.749,0.562,0.572,0.641,0.316,0.886,0.544,0.621,0.299,0.755,0.818,0.760,0.396,0.395,0.745,0.809,0.597,0.195,0.802,0.648,0.637)
descdist(x)
## summary statistics
## ------
## min: 1.5 max: 3.9
## median: 2.8
## mean: 2.7965
## estimated sd: 0.5063792
## estimated skewness: -0.3135622
## estimated kurtosis: 2.622658
norma<- fitdist(x, "norm",method=c("mle"))
summary(norma)
## Fitting of the distribution ' norm ' by maximum likelihood
## Parameters :
## estimate Std. Error
## mean 2.7965000 0.03571679
## sd 0.5051116 0.02525514
## Loglikelihood: -147.1925 AIC: 298.3851 BIC: 304.9817
## Correlation matrix:
## mean sd
## mean 1 0
## sd 0 1
plot(norma)
lonor<-fitdist(x, "lnorm",method="mle")
summary(lonor)
## Fitting of the distribution ' lnorm ' by maximum likelihood
## Parameters :
## estimate Std. Error
## meanlog 1.0106087 0.013660126
## sdlog 0.1931833 0.009658003
## Loglikelihood: -157.0863 AIC: 318.1727 BIC: 324.7693
## Correlation matrix:
## meanlog sdlog
## meanlog 1 0
## sdlog 0 1
plot(lonor)
gama<-fitdist(x, "gamma",method="mle")
summary(gama)
## Fitting of the distribution ' gamma ' by maximum likelihood
## Parameters :
## estimate Std. Error
## shape 28.31569 2.815052
## rate 10.12546 1.015592
## Loglikelihood: -152.7337 AIC: 309.4673 BIC: 316.0639
## Correlation matrix:
## shape rate
## shape 1.000000 0.991185
## rate 0.991185 1.000000
plot(gama)
expo<-fitdist(x, "exp",method="mle")
summary(expo)
## Fitting of the distribution ' exp ' by maximum likelihood
## Parameters :
## estimate Std. Error
## rate 0.3575898 0.02528522
## Loglikelihood: -405.6737 AIC: 813.3475 BIC: 816.6458
plot(expo)
wei<-fitdist(x, "weibull",method="mle")
summary(wei)
## Fitting of the distribution ' weibull ' by maximum likelihood
## Parameters :
## estimate Std. Error
## shape 6.459228 0.35802826
## scale 3.003726 0.03464716
## Loglikelihood: -144.3051 AIC: 292.6102 BIC: 299.2068
## Correlation matrix:
## shape scale
## shape 1.0000000 0.3150358
## scale 0.3150358 1.0000000
plot(wei)
logi<-fitdist(x, "logis",method="mle")
summary(logi)
## Fitting of the distribution ' logis ' by maximum likelihood
## Parameters :
## estimate Std. Error
## location 2.8162287 0.03609619
## scale 0.2915427 0.01709282
## Loglikelihood: -150.5521 AIC: 305.1042 BIC: 311.7008
## Correlation matrix:
## location scale
## location 1.00000000 -0.03287957
## scale -0.03287957 1.00000000
plot(logi)
cau<-fitdist(x,"cauchy",method="mle")
summary(cau)
## Fitting of the distribution ' cauchy ' by maximum likelihood
## Parameters :
## estimate Std. Error
## location 2.8507454 0.03475877
## scale 0.3054818 0.02760045
## Loglikelihood: -184.5937 AIC: 373.1874 BIC: 379.784
## Correlation matrix:
## location scale
## location 1.00000000 -0.03630391
## scale -0.03630391 1.00000000
plot(cau)
uni<-fitdist(x,"unif",method=c("mle"))
summary(uni)
## Fitting of the distribution ' unif ' by maximum likelihood
## Parameters :
## estimate Std. Error
## min 1.5 NA
## max 3.9 NA
## Loglikelihood: -175.0937 AIC: 354.1875 BIC: 360.7841
## Correlation matrix:
## [1] NA
plot(uni)
tria<-fitdist(x,"triang", method="mge", start = list(min=1, mode=2,max=3))
## Warning in checkparamlist(arg_startfix$start.arg, arg_startfix$fix.arg, : Some
## parameter names have no starting/fixed value but have a default value: mean.
## Warning in fitdist(x, "triang", method = "mge", start = list(min = 1, mode =
## 2, : maximum GOF estimation has a default 'gof' argument set to 'CvM'
summary(tria)
## Fitting of the distribution ' triang ' by maximum goodness-of-fit
## Parameters :
## estimate
## min 1.528082
## mode 2.975057
## max 3.904715
## Loglikelihood: -Inf AIC: Inf BIC: Inf
plot(tria)
gum<-fitdist(x, "gumbel", start=list(a=1, b=1))
summary(gum)
## Fitting of the distribution ' gumbel ' by maximum likelihood
## Parameters :
## estimate Std. Error
## a 2.5368439 0.03884157
## b 0.5170181 0.02633735
## Loglikelihood: -168.5112 AIC: 341.0224 BIC: 347.619
## Correlation matrix:
## a b
## a 1.0000000 0.3377982
## b 0.3377982 1.0000000
plot(gum)
memp <- function(x, order) mean(x^order)
pare<-fitdist(x,"pareto",method="mme",order=c(1, 2), memp="memp",
start=list(shape=10, scale=10))
summary(pare)
## Fitting of the distribution ' pareto ' by matching moments
## Parameters :
## estimate
## shape 171.2104
## scale 343.0643
## Loglikelihood: -418.5859 AIC: 841.1717 BIC: 847.7684
plot(pare)
gofstat(list(norma,lonor,gama,expo,wei,logi,cau,uni,tria,gum,pare), fitnames=c("Normal","Lognormal","Gamma","Exponencial","Weibull","Logistica","Cauchy","Uniforme","Triangular","Gumbel", "Pareto"))
## Goodness-of-fit statistics
## Normal Lognormal Gamma Exponencial
## Kolmogorov-Smirnov statistic 0.07862959 0.1177429 0.1045063 0.4496348
## Cramer-von Mises statistic 0.16888519 0.4726891 0.3470975 13.0714087
## Anderson-Darling statistic 1.04372638 2.8200607 2.0822445 61.7881324
## Weibull Logistica Cauchy Uniforme
## Kolmogorov-Smirnov statistic 0.05539806 0.06756679 0.09823015 0.1883333
## Cramer-von Mises statistic 0.08622222 0.13090674 0.32228902 2.0345833
## Anderson-Darling statistic 0.53814834 1.02424231 3.19523015 Inf
## Triangular Gumbel Pareto
## Kolmogorov-Smirnov statistic 0.06411800 0.1427094 0.566786
## Cramer-von Mises statistic 0.09115283 0.7506348 21.969231
## Anderson-Darling statistic Inf 4.5633078 99.751608
##
## Goodness-of-fit criteria
## Normal Lognormal Gamma Exponencial Weibull
## Akaike's Information Criterion 298.3851 318.1727 309.4673 813.3475 292.6102
## Bayesian Information Criterion 304.9817 324.7693 316.0639 816.6458 299.2068
## Logistica Cauchy Uniforme Triangular Gumbel
## Akaike's Information Criterion 305.1042 373.1874 354.1875 Inf 341.0224
## Bayesian Information Criterion 311.7008 379.7840 360.7841 Inf 347.6190
## Pareto
## Akaike's Information Criterion 841.1717
## Bayesian Information Criterion 847.7684
bet <- fitdist(z, "beta")
summary(bet)
## Fitting of the distribution ' beta ' by maximum likelihood
## Parameters :
## estimate Std. Error
## shape1 4.356784 0.8587149
## shape2 2.741216 0.5224440
## Loglikelihood: 18.70325 AIC: -33.40651 BIC: -29.58246
## Correlation matrix:
## shape1 shape2
## shape1 1.000000 0.863448
## shape2 0.863448 1.000000
plot(bet)
gofstat(bet)
## Goodness-of-fit statistics
## 1-mle-beta
## Kolmogorov-Smirnov statistic 0.1145806
## Cramer-von Mises statistic 0.1290490
## Anderson-Darling statistic 0.7738691
##
## Goodness-of-fit criteria
## 1-mle-beta
## Akaike's Information Criterion -33.40651
## Bayesian Information Criterion -29.58246
gve<-fevd(x)
gve
##
## fevd(x = x)
##
## [1] "Estimation Method used: MLE"
##
##
## Negative Log-Likelihood Value: 143.5896
##
##
## Estimated parameters:
## location scale shape
## 2.6436507 0.5296699 -0.3888485
##
## Standard Error Estimates:
## location scale shape
## 0.04053423 0.02923480 0.03871168
##
## Estimated parameter covariance matrix.
## location scale shape
## location 0.0016430239 -0.0001819496 -0.0005669438
## scale -0.0001819496 0.0008546733 -0.0007356433
## shape -0.0005669438 -0.0007356433 0.0014985940
##
## AIC = 293.1791
##
## BIC = 303.0741
plot(gve)
bino<-fitdist(y,"binom",fix.arg=list(size=50), start=list(prob=0.3))
summary(bino)
## Fitting of the distribution ' binom ' by maximum likelihood
## Parameters :
## estimate Std. Error
## prob 0.06240494 0.004836805
## Fixed parameters:
## value
## size 50
## Loglikelihood: -90.49827 AIC: 182.9965 BIC: 184.9086
plot(bino)
poi<- fitdist(y,discrete=TRUE,"pois")
summary(poi)
## Fitting of the distribution ' pois ' by maximum likelihood
## Parameters :
## estimate Std. Error
## lambda 3.12 0.2497999
## Loglikelihood: -90.96812 AIC: 183.9362 BIC: 185.8483
plot(poi)
geo<-fitdist(y,"geom")
summary(geo)
## Fitting of the distribution ' geom ' by maximum likelihood
## Parameters :
## estimate Std. Error
## prob 0.2427184 0.02987038
## Loglikelihood: -114.1638 AIC: 230.3276 BIC: 232.2396
plot(geo)
binone<- fitdist(y,"nbinom")
summary(binone)
## Fitting of the distribution ' nbinom ' by maximum likelihood
## Parameters :
## estimate Std. Error
## size 1.725944e+07 44.5879400
## mu 3.119957e+00 0.2497965
## Loglikelihood: -90.96812 AIC: 185.9362 BIC: 189.7603
## Correlation matrix:
## size mu
## size 1.000000e+00 3.956981e-08
## mu 3.956981e-08 1.000000e+00
plot(binone)
gofstat(list(bino,poi,geo,binone),fitnames=c("Binomial","Poisson","Geométrica", "Binomial negativa"))
## Chi-squared statistic: 2.050607 2.145677 22.72921 2.145629
## Degree of freedom of the Chi-squared distribution: 3 3 3 2
## Chi-squared p-value: 0.5619697 0.5427274 4.598621e-05 0.3420444
## the p-value may be wrong with some theoretical counts < 5
## Chi-squared table:
## obscounts theo Binomial theo Poisson theo Geométrica
## <= 2 21 19.451377 19.842465 28.285885
## <= 3 10 11.523982 11.175932 5.270416
## <= 4 8 9.012476 8.717227 3.991189
## <= 5 8 5.518685 5.439550 3.022454
## > 5 3 4.493480 4.824826 9.430056
## theo Binomial negativa
## <= 2 19.842928
## <= 3 11.175950
## <= 4 8.717120
## <= 5 5.439408
## > 5 4.824593
##
## Goodness-of-fit criteria
## Binomial Poisson Geométrica Binomial negativa
## Akaike's Information Criterion 182.9965 183.9362 230.3276 185.9362
## Bayesian Information Criterion 184.9086 185.8483 232.2396 189.7603
Paquetes utilizados:
library(fitdistrplus)
library(stats4)
library(MASS)
library(actuar)
library(mc2d)
|-|-|-|
O.M.F.
|-|-|-|