What should I do with this function NIG ?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Probability Density Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!