Learn R Programming

pacheck (version 0.2.2)

fit_dist: Fit distribution to parameter

Description

This function fits statistical distributions to a user-defined parameter.

Usage

fit_dist(df, param, dist = c("norm", "beta", "gamma", "lnorm"))

Value

A list with two objects:

  • Statistical_fit: a dataframe containing the statistical fit criteria of the fitted distributions.

  • Dist_parameters: a dataframe containing the parameter value of the fitted distributions.

Arguments

df

a dataframe.

param

character. Name of variable of the dataframe on which to fit the distributions.

dist

character or vector of character. Determine which distribution to fit on the density plot.

Details

The available distributions are: "norm" (normal), "beta", "gamma", "lnorm" (lognormal). The arguments of the lists are "AIC" which contains the Akaike Information Criteria for each fitted distribution and "Dist_parameters" which contains the parameters of the fitted distributions. The distributions are fitted using the fitdistrplus::fitdist()

Examples

Run this code
# Fitting normal and beta distribution to the "u_pfs" variable of the example dataframe.
data(df_pa)
fit_dist(df = df_pa,
         param = "u_pfs",
         dist = c("norm", "beta"))

Run the code above in your browser using DataLab