[R] Best Distribution

J. R. M. Hosking JRMHosking at gmail.com
Wed Oct 1 15:44:14 CEST 2014


On 2014-09-30 15:50, eliza botto wrote:
> Dear useRs,
> I have this following data
>> dput(Prec)
> c(42.2, 45.2, 46, 48, 54, 54.1, 59.4, 61, 62.2, 63.5, 65.024, 71.9, 73.4, 76.6, 76.708, 77.5, 77.724, 78, 81.3, 84.7, 84.836, 85.09, 88.2, 91.4, 94, 95.8, 96, 97.3, 101, 101, 101.5, 102.3, 102.87, 108.7, 109.5, 110.5, 110.7, 112, 114.3, 118.11, 121.412, 128.1, 131, 140, 142, 143.3, 151.4, 153.7, 189.4, 214.3)
> I want to fit gumbel and log-normal distribution on it on the same window to see which distribution fits it the best way.
> Thankyou very much in advance,
> Eliza 		 	   		
> 	[[alternative HTML version deleted]]
>


Package lmom has functions that make this kind of computation very 
straightforward.

library(lmom)
Prec<-c(42.2, 45.2, 46, 48, 54, 54.1, 59.4, 61, 62.2, 63.5, 65.024,
   71.9, 73.4, 76.6, 76.708, 77.5, 77.724, 78, 81.3, 84.7, 84.836,
   85.09, 88.2, 91.4, 94, 95.8, 96, 97.3, 101, 101, 101.5, 102.3,
   102.87, 108.7, 109.5, 110.5, 110.7, 112, 114.3, 118.11, 121.412,
   128.1, 131, 140, 142, 143.3, 151.4, 153.7, 189.4, 214.3)
evplot(Prec)                                        # plot data
evdistq(quagum, pelgum(samlmu(Prec)), col='green')  # add Gumbel fit
evdistq(qualn3, pelln3(samlmu(Prec), bound=0), col='blue') # lognormal
legend("topleft",c("Gumbel","lognormal"),lty=1,col=c("green","blue"))




J. R. M. Hosking



More information about the R-help mailing list