A list a functions to fit data to probability distributions

Authors: Florian Kobierska Baffie [aut, cre]

Version: 0.1

License: MIT

Description

This package was developed for the FlomKart project. It contains functions to fit probability distributions to flood data. The following distributions are implemented: - Generalized extreme value (gev) - Generalized logistics (gl) - Gumbel (gumbel) - Gamma (gamma) - Pearson III (pearson) Four parameter estimation methods are available: - Maximum likelihood (mle) - Linear moments (Lmom) - Ordinary moments (mom) - Bayesian inference (bayes) All functions are named distr_method (i.e. gl_bayes)

Imports

evd, ismev, pracma, nsRFA, MASS, fitdistrplus, plyr

Suggests

testthat, packagedocs

r suppressWarnings(suppressMessages( library(fitdistrib, quietly = TRUE, warn.conflicts = FALSE, verbose = FALSE ) ))

Package Functions

gamma_bayes

Fitting the gamma distribution with Bayesian inference

Function to fit the gamma distribution with bayes method This is a dummy function because this method has not been implemented yet

Usage

gamma_bayes(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

gamma_Lmom

Fitting the gamma distribution with Lmom

Function to fit the gamma distribution with the linear moment method

Usage

gamma_Lmom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters (2) and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gamma_Lmom(test_data)
plot_density(test_data, param = estimate, distr = "gamma")

gamma_mle

Fitting the gamma distribution with MLE

Function to fit the gamma distribution with the maximum likelihood method

Usage

gamma_mle(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters (2) and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gamma_mle(test_data)
plot_density(test_data, param = estimate, distr = "gamma")

gamma_mom

Fitting the gamma distribution with mom

Function to fit the gamma distribution with the ordinary moments method

Usage

gamma_mom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters (2) and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gamma_mom(test_data)
plot_density(test_data, param = estimate, distr = "gamma")

get_posterior_gev

Calculating the posterior predictive distribution

Function to calculate the posterior predictive distribution after calling gev_bayes

Usage

get_posterior_gev(mmrp, mupars, spars, kpars)

Arguments

(mmrp,
mupars, spars, kpars) parameters returned by gev_bayes. mupars, spars, kpars are the ensemble of param$estimate

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

get_posterior_gl

Calculating the posterior predictive distribution for GL

Function to calculate the posterior predictive distribution after calling gev_bayes

Usage

get_posterior_gl(mmrp, mupars, spars, kpars)

Arguments

(mmrp,
mupars, spars, kpars) parameters returned by gev_bayes. mupars, spars, kpars are the ensemble of param$estimate

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

get_posterior_gumbel

Calculating the posterior predictive distribution

Function to calculate the posterior predictive distribution after calling gumbel_bayes

Usage

get_posterior_gumbel(mmrp, mupars, spars)

Arguments

(mmrp,
mupars, spars) parameters returned by gumbel_bayes. mupars, spars are the ensemble of param$estimate

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

get_posterior_PEARSON

Calculating the posterior predictive distribution

Function to calculate the posterior predictive distribution after calling pearson_bayes

Usage

get_posterior_PEARSON(mmrp, mupars, spars, kpars)

Arguments

(mmrp,
mupars, spars, kpars) parameters returned by pearson_bayes. mupars, spars, kpars are the ensemble of param$estimate

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

gev_bayes

Fitting the GEV distribution with Bayesian inference

Function to fit the GEV distribution with BayesianMCMC method WE assume that the shape parameter only has a prior with mean zero and standard deviation 0.2 (dnorm(x[3], 0, 0.2))

Usage

gev_bayes(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gev_bayes(test_data)
plot_density(test_data, param = estimate, distr = "gev")

gev_Lmom

Fitting the GEV distribution with Lmom

Function to fit the GEV distribution with the linear moment method

Usage

gev_Lmom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se). Standard error is not yet implemented

Examples

library(FlomKart)
estimate = gev_Lmom(test_data)
plot_density(test_data, param = estimate, distr = "gev")

See also

gev_mle, gev_mom

gev_mle

Fitting the GEV distribution with MLE

Function to fit the GEV distribution with the maximum likelihood method

Usage

gev_mle(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gev_mle(test_data)
plot_density(test_data, param = estimate, distr = "gev")

See also

gev_Lmom, gev_mom

gev_mom

Fitting the GEV distribution with mom

Function to fit the GEV distribution with the ordinary moments method

Usage

gev_mom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se) Standard error is not yet implemented

Examples

library(FlomKart)
estimate = gev_mom(test_data)
plot_density(test_data, param = estimate, distr = "gev")

See also

gev_Lmom, gev_mle

gl_bayes

Fitting the GL distribution with Bayesian inference

Function to fit the Generalized Logistics distribution with BayesianMCMC method We assume that the shape parameter only has a prior with mean zero and standard deviation 0.2 (dnorm(x[3], 0, 0.2))

Usage

gl_bayes(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gl_bayes(test_data)
plot_density(test_data, param = estimate, distr = "gl")

gl_Lmom

Fitting the GL distribution with Lmom

Function to fit the Generalized Logistics distribution with the linear moments method

Usage

gl_Lmom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gl_Lmom(test_data)
plot_density(test_data, param = estimate, distr = "gl")

gl_mle

Fitting the GL distribution with MLE

Function to fit the GL distribution with the maximum likelihood method. This function was copied from Kolbjorn's initial file

Usage

gl_mle(xdat, ydat = NULL, mul = NULL, sigl = NULL, shl = NULL, mulink = identity, siglink = identity, shlink = identity, muinit = NULL, siginit = NULL, shinit = NULL, show = TRUE, method = "Nelder-Mead", maxit = 10000, ...)

Arguments

...
Function to fit the GL distribution with the maximum likelihood method. This function was copied from Kolbjorn's initial file

Value

param Estimated parameters and standard error returned as a list($estimate, $se) Standard error is not yet implemented

Examples

library(FlomKart)
estimate = gl_mle(test_data)
plot_density(test_data, param = estimate, distr = "gl")

gl_mom

Fitting the GL distribution with mom

Function to fit the Generalized Logistics distribution with the ordinary moments method

Usage

gl_mom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se). Standard error is not yet implemented

Examples

library(FlomKart)
estimate = gl_mom(test_data)
plot_density(test_data, param = estimate, distr = "gl")

gumbel_bayes

Fitting the Gumbel distribution with Bayesian inference

Function to fit the Gumbel distribution with BayesianMCMC method We do not provide a prior for the BayesianMCMC function

Usage

gumbel_bayes(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gumbel_bayes(test_data)
plot_density(test_data, param = estimate, distr = "gumbel")

gumbel_Lmom

Fitting the Gumbel distribution with Lmom

Function to fit the Gumbel distribution with the linear moment method

Usage

gumbel_Lmom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters (2) and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gumbel_Lmom(test_data)
plot_density(test_data, param = estimate, distr = "gumbel")

gumbel_mle

Fitting the Gumbel distribution with MLE

Function to fit the Gumbel distribution with the maximum likelihood method

Usage

gumbel_mle(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters (2) and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gumbel_mle(test_data)
plot_density(test_data, param = estimate, distr = "gumbel")

gumbel_mom

Fitting the Gumbel distribution with mom

Function to fit the Gumbel distribution with the ordinary moments method

Usage

gumbel_mom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters (2) and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = gumbel_mom(test_data)
plot_density(test_data, param = estimate, distr = "gumbel")

pearson_bayes

Fitting the pearson distribution with Bayesian inference

Function to fit the pearson distribution with BayesianMCMC method WE assume that the shape parameter only has a prior with mean zero and standard deviation 0.2 (dnorm(x[3], 0, 0.2))

Usage

pearson_bayes(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = pearson_bayes(test_data)
plot_density(test_data, param = estimate, distr = "pearson")

pearson_Lmom

Fitting the pearson distribution with Lmom

Function to fit the pearson distribution with the linear moment method

Usage

pearson_Lmom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se). Standard error is not yet implemented

Examples

library(FlomKart)
estimate = pearson_Lmom(test_data)
plot_density(test_data, param = estimate, distr = "pearson")

pearson_mle

Fitting the pearson distribution with MLE

Function to fit the pearson distribution with the maximum likelihood method

Usage

pearson_mle(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se)

Examples

library(FlomKart)
estimate = pearson_mle(test_data)
plot_density(test_data, param = estimate, distr = "pearson")

pearson_mom

Fitting the pearson distribution with mom

Function to fit the pearson distribution with the ordinary moments method

Usage

pearson_mom(dat)

Arguments

dat
the data that needs fitting (i.e. flood data)

Value

param Estimated parameters and standard error returned as a list($estimate, $se) Standard error is not yet implemented

Examples

library(FlomKart)
estimate = pearson_mom(test_data)
plot_density(test_data, param = estimate, distr = "pearson")


NVE/fitdistrib documentation built on May 7, 2019, 6:04 p.m.