📄 mfe_distrib.m
字号:
%MFE_DISTRIB Illustrates Case Study 2.6.3.
%
% Type "mfe_distrib" at the command line to open a GUI which illustrates
% Case Study 2.6.3 from [1].
%
% Note, that only the second column of the loaded data file is used.
%
% Reference(s):
% [1] R.Weron (2007) "Modeling and Forecasting Electricity Loads and
% Prices: A Statistical Approach", Wiley, Chichester.
% Written by Adam Misiorek and Rafal Weron (2006.09.22)
% Copyright (c) 2006 by Rafal Weron
% Initialize GUI window
close all;
clear all;
startpath=cd;
addpath(startpath);
mainf=figure('menubar','none',...
'name','Case Study 2.6.3',...
'numbertitle','off',...
'position',[350 300 605 170],...
'DeleteFcn','rmpath(startpath);close all;clear all;');
% Read names of data files in the current directory
[files,folders]=readf;
% Initialize controls for opening/loading data files
filesl=uicontrol('parent',mainf,...
'style','listbox',...
'position',[15 70 180 90],...
'string',files);
apath=uicontrol('parent',mainf,...
'style','text',...
'position',[15 10 575 15],...
'HorizontalAlignment','left',...
'string',cd);
% use only second column of data file
uicontrol('parent',mainf,...
'style','push',...
'position',[50 40 110 25],...
'string','Open/Load',...
'callback',['auxv=get(filesl,''value'');if ismember(auxv,folders);cd(files{auxv});',...
'[files,folders]=readf;set(filesl,''value'',1,''string'',files);set(apath,''string'',cd);',...
'else;data=load(files{auxv});data=data(:,2);radiobut=''none'';set(gof,''enable'',''on'');',...
'set(none,''enable'',''on'');set(dif,''enable'',''on'');set(ret,''enable'',''on'');end;']);
% Initialize radio buttons which switch between no preprocessing (none),
% taking first differences (dif) and taking logarithmic returns (ret)
uicontrol('parent',mainf,...
'style','frame',...
'position',[220 60 90 100],...
'BackgroundColor',[0.5 0.5 0.5]);
none=uicontrol('parent',mainf,...
'style','radio',...
'position',[230 130 70 20],...
'string','none',...
'value',1,...
'enable','off',...
'callback',['onlyone(none,dif,ret);radiobut=''none'';']);
dif=uicontrol('parent',mainf,...
'style','radio',...
'position',[230 100 70 20],...
'string','diff',...
'value',0,...
'enable','off',...
'callback',['onlyone(dif,none,ret);radiobut=''dif'';']);
ret=uicontrol('parent',mainf,...
'style','radio',...
'position',[230 70 70 20],...
'string','returns',...
'value',0,...
'enable','off',...
'callback',['onlyone(ret,none,dif);radiobut=''ret'';']);
% Initialize fitted distributions checkboxes
uicontrol('parent',mainf,...
'style','frame',...
'position',[325 35 110 125],...
'BackgroundColor',[0.5 0.5 0.5]);
dists=zeros(4,1);
dists(1)=uicontrol('parent',mainf,...
'style','checkbox',...
'position',[335 135 90 14],...
'string','Gaussian',...
'value',1);
dists(2)=uicontrol('parent',mainf,...
'style','checkbox',...
'position',[335 105 90 14],...
'string','Hyperbolic',...
'value',1);
dists(3)=uicontrol('parent',mainf,...
'style','checkbox',...
'position',[335 75 90 14],...
'string','NIG',...
'value',1);
dists(4)=uicontrol('parent',mainf,...
'style','checkbox',...
'position',[335 45 90 14],...
'string','Alpha-stable',...
'value',1);
% Initialize empirical distribution function (edf) checkbox
edft=uicontrol('parent',mainf,...
'style','checkbox',...
'position',[450 135 140 14],...
'string','run EDF tests',...
'value',1);
% Initialize checkbox for removing weekly seasonality via the moving
% average technique
rems=uicontrol('parent',mainf,...
'style','checkbox',...
'position',[450 105 140 14],...
'string','remove 7-day cycle',...
'value',1);
% Initialize the Run button
gof=uicontrol('parent',mainf,...
'style','push',...
'position',[450 70 140 25],...
'string','Run',...
'enable','off',...
'callback','mfe_distrib_aux(data,dists,edft,radiobut,rems)');
% Initialize the Close button
uicontrol('parent',mainf,...
'style','push',...
'position',[450 40 140 25],...
'string','Close',...
'BackgroundColor',[0.75 0.75 0.75],...
'callback','delete(gcf);');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -