marginal: Estimate Marginal distribution

Description Usage Arguments Details Value

View source: R/marginal.R

Description

Estimates the marginal distribution of a univariate sample, either by MLE (if a parametric family is specified) or empirical distribution (edf, with kernel density pdf) otherwise.

Usage

1
2
3
4
5
6
7
8
9
marginal(
  x,
  dist.name = NULL,
  ecdf.split = NULL,
  init.val = NULL,
  in.range = NULL,
  soften.cdf = TRUE,
  eqf.type = 1
)

Arguments

x

Vector representing the univariate sample drawn from the distribution to be estimated.

dist.name

String; name of the parametric family of distributions, if you don't want the edf. Use R's naming conventions for distributions ahead of the d/p/q/r. For example, the Normal distribution would be "norm".

ecdf.split

Numeric; real number for which to fit the specified model for data above such number, and empirical distribution to be fit below.

init.val

If a parametric distribution is specified (through dist.name), this should be the initial value specification for the parameters. Could be (1) a vector, in which the order provided will correspond to the order given in the R documentation for that distribution, or (2) a list with names being the parameter names, or (3) remain NULL in which case default parameter values are used (if there even are defaults).

in.range

The same as the argument in rnlm – a function that takes the parameter values and returns TRUE if that value of the parameter is "proper"; FALSE otherwise.

soften.cdf

Logical; should the cdf be modified so that it never returns the boundary cases 0 or 1? (uses 0.5/n or 1-0.5/n instead, where n is amount of data)

eqf.type

If the empirical quantile function is being estimated, this argument specifies the type of quantile algorithm to use, as in the type argument of the quantile function. In particular, an integer between 1 and 9.

Details

Some noteworthy options for eqf.type are: 1 = inverse empirical cdf (default of marginal); 7 = default of quantile, a continuous function.

Value

If return.param = FALSE (default), output is a list of length three:

$cdf: The estimated distribution function

$qf: The estimated quantile function (inverse of the cdf estimate)

$pdf: The estimated density function or mass function. Gives a kernel density estimate if using the empirical distribution.


vincenzocoia/copsupp documentation built on Aug. 23, 2020, 7:37 a.m.