metalog: Fit the metalog distribution to data

Description Usage Arguments Value Examples

View source: R/metalog.R

Description

Fit the metalog distribution to data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
metalog(
  x,
  bounds = c(0, 1),
  boundedness = "u",
  term_limit = 13,
  term_lower_bound = 2,
  step_len = 0.01,
  probs = NA,
  fit_method = "any",
  save_data = FALSE
)

Arguments

x

vector of numeric data

bounds

numeric vector specifying lower or upper bounds, none required if the distribution is unbounded

boundedness

character string specifying unbounded, semi-bounded upper, semi-bounded lower or bounded; accepts values u, su, sl and b (default: 'u')

term_limit

integer between 3 and 30, specifying the number of metalog distributions to generate. Larger term distributions have more flexibility (default: 13)

term_lower_bound

(Optional) the smallest term to generate, used to minimize computation of unwanted terms must be less than term_limit (default is 2)

step_len

(Optional) size of steps to summarize the distribution (between 0 and 0.01) this is only used if the data vector length is greater than 100. Use this if a specific fine grid fit is required. (default is 0.01)

probs

(Optional) probability quantiles, same length as x

fit_method

(Optional) preferred method of fitting distribution: accepts values OLS, LP or any (defaults to any)

save_data

(Optional) Save the original data within the metalog object. This must be done if the distribution is to be updated with new data later.

Value

A metalog object with elements

params

A list of the parameters used to create the metalog object

dataValues

a dataframe with the first column the raw data, second column the cumulative probabilities and the third the z vector

Y

The Y matrix values for each quantile and term

A

a dataframe of coefficients for each metalog distribution

M

a dataframe of quantiles (M) and probabilities (m) indexed for each term (i.e. M3,m3 for the third term)

GridPlotCDF()

a function that displays a grid plot of the CDF for each term

VGridPlotPDF()

a function that displays a gird plot of the PDF for each term

Validation

a vector of yes/no indicators of the valid distributions for each term

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Load example data
## Not run: 
data("fishSize")

# Create a bounded metalog object
myMetalog <- metalog(fishSize$FishSize,
                     bounds=c(0, 60),
                     boundedness = 'b',
                     term_limit = 13)

## End(Not run)

isaacfab/RMetalog documentation built on Jan. 26, 2021, 6:44 a.m.