⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ker.m

📁 Neural Network in Finance (神经网络在金融界:赢得预言性的优势)全部原码。内容包括预测与估计
💻 M
字号:
function [ys,f1,f2,f3,h]=ker(y);
%  Purpose: Estimates a Univariate Density using Epanechnikov and
%           Gaussian Kernels. Bandwidth is selected  according to
%           Silverman's Plug-in-Rule.
%
%  Format:  [ys,f1,f2,f3,h]=3er(y);
%
%  Input:   y	T x 1     Variable to be analyzed
%	  
%  Output:  ys  T x 1     SORTED values of y
%	    f1  T x 1	  Empirical Density of SORTED values of y.
%			      f(x) is computed using the Epanechnikov Kernel.
%	    f2  T x 1	  Empirical Density of SORTED values of y.
%			      f(x) is computed using the Gaussian Kernel.
%	    f3  T x 1	  Gaussian Density of SORTED values of y with the
%			      same Mean and Variance.
%           h   Scalar    Optimal Bandwidth.
%
%  Suggestion:  plot(ys,[f1 f2 f3]) to see the results.
%
%  References:  Gallant, A.R. (1994). Class Notes. UNC.
%               Silverman, B. (1986). Density Estimation. Chapman & Hall.
%               Ullah, A. (1988). "Non-parametric Estimation of Econometric
%                  Functionals". Canadian Journal of Economics.

%  R=F3mulo A. Chumacero
%  Last update: 9/13/95

T=length(y);
m=mean(y);
s=std(y);
qr=(max(y)-min(y))/4;
h=0.9*(T^(-1/5))*min([s (qr/1.34)]);
ys=sort(y);
f3=pdf('norm',ys,m,s);
f1=zeros(T,1);
f2=zeros(T,1);
i=1;
while i<T+1;
    au=abs(ys(i,1)-ys)/h;
    e1=au < sqrt(5);
    f1=e1.*(0.75*(1-(0.2*au.*au))/((5^0.5)*h*T))+f1;
    f2=((1/(h*T))*(1/((2*pi)^0.5))*exp(-0.5*au.*au))+f2;
    i=i+1;
end;
f1 = f1 ./ sum(f1);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -