What should I do with this function NIG ?

4 views (last 30 days)
aik jiayin
aik jiayin on 3 Mar 2018
Edited: aik jiayin on 3 Mar 2018
data=xlsread('logreturns')
function y = nigpdf(data, alpha, beta, mu, delta)
% NIGpdf Probability density function (PDF) for Normal-Inverse-Gaussian distribution.
% y = NIGpdf(x, alpha, beta, mu, delta) returns the pdf of the
% Normal-Inverse-Gaussian distribution with the parameter beta which
% determines the skewness, alpha the shape parameter, mu the location parameter
% and delta scale parameter, evaluated at the values in x.
% % alpha, beta, mu, delta could be scalar or vector for time varying distribution.
% alpha and delta must be positive values.
% alpha > beta must hold.
%% The pdf
% transform input into column vector
data = data(:)';
p = (delta * alpha / pi) .* exp(delta * sqrt(alpha.^2 - beta.^2));
xbar = data - mu;
z = sqrt(delta.^2 + xbar .* xbar);
K = besselk(1, (alpha .* z));
y = p ./ z .* K .* exp(beta .* (data - mu));
Function definitions are not permitted in this context.

Answers (0)

Categories

Find more on Probability Density Functions in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!