# mdpd

mdpd computes Minimum Distance Power Divergence statistics

## Syntax

• res=mdpd(y, alpha)example
• res=mdpd(y, alpha,Name,Value)example

## Description

The Power Divergence for a density function $f$ and observations $y_1 , \ldots , y_n$ is defined as $\Delta(f,\alpha) = \int_R f^{1+\alpha}(y) dy - (1+1/\alpha) \sum_{i=1}^n f^\alpha(y_i)/n$ for $\alpha > 0$ $\Delta(f,0) = -\sum_{i=1}^n \log f(y_i)/n$ for $\alpha = 0$.

 res =mdpd(y, alpha) mdpd with all default arguments.

 res =mdpd(y, alpha, Name, Value) Student T with 5 degrees of freedom.

## Examples

expand all

### mdpd with all default arguments.

rng('default')
y =randn(10,1);
out=mdpd(y,0.2);

### Student T with 5 degrees of freedom.

rng('default')
y =randn(10,1);
mdpd(y,0.1,'densfunc',@tpdf,'theta',5)
ans =

-8.7846



## Related Examples

expand all

### Change lower and upper integration limits.

rng('default')
% Generate 10 numbers from Uniform.
y =mtR(10,0);
out=mdpd(y,0.1,'densfunc',@tpdf,'theta',5, 'lower',-Inf,'upper',Inf);
expectedRes = -8.870156744130417;
assert(isequal(round(out,7), round(expectedRes,7)), 'Error: MATLAB did not output the expected result!')

### Change lower and upper integration limits and relatve tolerance.

Change lower and upper integration limits.

rng('default')
% Generate 10 numbers from Uniform.
y =mtR(10,0);
out=mdpd(y,0.1,'densfunc',@tpdf,'theta',5, 'lower',-Inf,'upper',Inf,'RelTol',1e-15);
expectedRes =  -8.870156744130275;
assert(isequal(round(out,7), round(expectedRes,7)), 'Error: MATLAB did not output the expected result!')

## Input Arguments

### y — Response variable. Vector.

A vector with n elements that contains the response variable. It can be either a row or a column vector.

Data Types: double

### alpha — Numeric for the power divergence parameter. Non negative scalar.

It can be shown that as the tuning parameter $\alpha$ increases the robustness of the Minimum Density Power Divergence estimator increases while its efficiency decreases (Basu et al., 1998).

Data Types: double

### Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as  Name1,Value1,...,NameN,ValueN.

Example:  'densfunc', @tpdf , 'lower',0 , 'upper',10 , 'theta', [10 100] , 'RelTol', 1e-12 , 'AbsTol', 1e-9 

### densfunc —handle to the function computing the theoretical density.function handle.

Function handle which defines the function to be integrated from lower to upper. The default density function is the standard normal distribution.

Example:  'densfunc', @tpdf 

Data Types: handle

### lower —Lower bound of the domain of the density function.scalar.

The default value of lower is 1.

Example:  'lower',0 

Data Types: double

### upper —Upper bound of the domain of the density function.scalar.

The default value of upper is Inf.

Example:  'upper',10 

Data Types: double

### theta —The parameters of the distribution given as a vector.numeric vector.

The default values of theta is [0 1] given that the default density function is the standard normal distribution.

Example:  'theta', [10 100] 

Data Types: double

### RelTol —Relative error tolerance.non negative scalar.

Relative error tolerance, specified as the comma-separated pair consisting of 'RelTol' and a nonnegative real number.

mpdm uses the relative error tolerance to limit an estimate of the relative error, |q - Q| / min(|q|,|Q|), where q is the computed value of the integral and Q is the (unknown) exact value.

The default value of RelTol is 1e-6.

Example:  'RelTol', 1e-12 

Data Types: double

### AbsTol —Absolute error tolernace.non negative scalar.

Absolute error tolerance, specified as the comma-separated pair consisting of 'AbsTol' and a nonnegative real number.

mpdm uses the absolute error tolerance to limit an estimate of the absolute error, |q - Q|, where q is the computed value of the integral and Q is the (unknown) exact value.

This can be useful when q or Q becomes close to zero and the relative tolerance risks to go to infinity.

The default value of AbsTol is 1e-12.

Example:  'AbsTol', 1e-9 

Data Types: double

## Output Arguments

### res —power divergence against the density function densfunc. Scalar

Value of power divergence wrt the density specified in densfunc.

Data Types - double.

## References

Basu, A., Harris, I.R., Hjort, N.L. and Jones, M.C., (1998), Robust and efficient estimation by minimizing a density power divergence, Biometrika, 85, pp. 549-559.

Riani, M. Atkinson, A.C., Corbellini A. and Perrotta A. (2020), Robust Regression with Density Power Divergence: Theory, Comparisons and Data Analysis, submitted.