Mohammad Ehsanul Karim
2005-Jun-08 10:40 UTC
[R] Fitting Theoretical Distributions to Daily Rainfall Data
Dear List Members, I need a bit help about fitting some theoretical distributions (such as geometric, exponential, lognormal or weibull distribution) to the following *dry spell*, *wet spell*, *cycles (Wet-Dry or Dry-Wet)* from my meteorological (daily rainfall) data http://www.angelfire.com/ab5/get5/R.rainfall.txt only for rainy seasen (july - september) of 14 years only: dryspell<-c(1,1,4,1,1,4,2,2,3,4,1,2,1,1,1,3,1,3, 2,3,1,2,3,3,2,2,6,2,1,1,3,1,2,1,4,4,1,1,2,1,1,2, 2,4,1,1,1,3,4,1,7,1,3,2,5,1,3,1,1,3,4,8,4,3,1,1, 1,2,3,1,1,2,1,1,2,2,2,3,3,13,13,7,1,1,1,1,7,3,2, 1,3,1,1,2,5,1,2,1,3,1,1,2,3,2,3,2,1,5,1,2,2,2,1, 9,2,2,1,1,4,5,1,1,3,1,3,3,2,1,1,1,17,1,4,5,1,1, 1,1,2,1,2,1,1,7,3,8,2,1,1,2,4,5,1,1,1,2,3,1,1,2, 1,1,3,2,3,1,1,1,3,6,4,1,2,1,2,2,4,2,4,2,1,2,1,3, 1,2,2,1,1,1,1,4,2,1,12,3,1,1,5,1,1,5,1,2,1,1,1,1, 5,3,1,1,3,1,1,6,10,1,1,1,2,1,3,2,2,5,1,1,2,2,1,2, 3,1,3,6,2,1,1,4,6,1,1,1,3,2,2,1,1,1,5,1,1,1,1,3, 1,2,1,7,1,3,1,3,4,1,1,3,4,3,1,4,4,1,3,1,5,3,1,2, 2,1,1,1,2,1,1,6,1,1,1,3,1,3,4,1,1,3,4,1,1,8,1) wetspell<-c(1,5,6,4,1,5,3,4,5,2,3,1,5,4,1,4,1,2,3 ,1,5,4,5,2,1,1,1,6,2,19,5,4,6,5,2,7,1,3,1,1,2,1, 3,8,2,3,1,2,5,1,3,8,9,1,1,7,1,2,3,7,9,4,4,1,2,3, 1,1,1,1,1,2,6,7,1,4,1,6,1,5,5,3,2,3,1,1,1,1,6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,2,6,4,4,6,3,4,2,6,3,3,4,3,15,3,2,2,7,3,4, 6,10,4,4,5,2,3,14,7,4) cycleDryWet<-c(2,6,10,5,2,9,5,6,8,6,4,3,6,5,2,7,2, 5,5,4,6,6,8,4,4,3,3,12,4,20,6,7,7,7,3,11,5,4,2,3,3, 2,5,10,3,7,2,3,6,4,7,9,16,2,4,9,6,3,6,8,10,7,8,9,6, 6,2,2,2,3,4,3,7,9,2,5,3,8,3,8,8,16,15,11,2,2,2,2,13, 4,5,3,4,4,6,8,8,3,8,2,4,4,2,9,6,7,4,4,3,8,2,14,3,10, 4,10,4,3,2,3,5,7,5,3,6,2,4,6,3,5,2,7,22,3,15,11,3,2, 2,10,4,8,3,8,5,8,9,12,10,3,2,3,5,14,4,4,8,4,4,4,4, 10,3,2,10,3,5,3,2,2,4,7,5,6,3,2,5,3,5,3,13,3,8,3, 5,6,2,7,9,2,6,2,6,10,10,6,3,15,7,2,3,12,10,4,6,5, 4,2,2,3,4,6,4,9,6,5,2,2,7,14,2,2,2,10,5,12,8,5,6, 7,6,5,7,3,4,4,6,12,14,3,7,5,5,8,9,7,2,6,3,4,3,3,4, 6,2,6,3,4,14,15,2,3,6,10,6,4,3,4,13,4,2,4,5,7,11, 10,5,2,4,2,6,6,5,3,4,3,6,3,2,5,3,10,8,2,2,5,5,2, 5,13,4,2,4,5,3,7,14,4) Using table() to each dryspell, wetspell, cycleWetDry, cycleDryWet we find the empirical distribution functions all of which seem to be positively skewed with long tail. Therefore, i'd like to fit geometric, exponential, lognormal or weibull distribution for each dryspell, wetspell, cycleWetDry, cycleDryWet. Better fit may be defined by higher p-values of goodness-of-fit tests. Is there any way i can do fit data to those theoretical distributions in R? Is there any existing program/function/package to solve such problem? Any suggestion, direction, references, help, replies will be highly appreciated. Thank you for your time. ---------------------------------- Mohammad Ehsanul Karim Web: http://snipurl.com/ehsan ISRT, University of Dhaka, BD ---------------------------------- __________________________________ Get on-the-go sports scores, stock quotes, news and more. Check it out!
Ken Knoblauch
2005-Jun-08 10:59 UTC
[R] Fitting Theoretical Distributions to Daily Rainfall Data
Have a look at the fit.dist function in Jim Lindsey's gnlm package at
http://popgen0146uns50.unimaas.nl/~jlindsey/rcode.html
fit.dist {gnlm} R Documentation
Fit Probability Distributions to Frequency Data
Description
fit.dist fits the distributions in Chapter 4 of Lindsey (1995, 2003 2nd edn):
binomial, beta-binomial, Poisson, negative binomial, geometric, zeta, normal,
log normal, inverse Gauss, logistic, Laplace, Cauchy, Student t, exponential,
Pareto, gamma, and Weibull to frequency (histogram) data, possibly plotting
the frequency polygon of fitted values with the histogram.
fitdistr from the MASS package works quite well, too.
>Dear List Members,
>
>I need a bit help about fitting some theoretical
>distributions (such as geometric, exponential,
>lognormal or weibull distribution)
____________________
Ken Knoblauch
Inserm U371, Cerveau et Vision
Department of Cognitive Neurosciences
18 avenue du Doyen Lepine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: 06 84 10 64 10
http://www.lyon.inserm.fr/371/
Reasonably Related Threads
- Sliding Window Time Series Analysis - hourly rainfall
- column-plot of rainfall data
- Assist me on how I can arrange trend data of rainfall and temperature for analysis
- distribution of daily rainfall values in binned categories
- Plot cumulative sums of rainfall per year