clear all
close all
%--------------------
%load C:\STAT|Descriptive\Descriptivedat\lynx.mat
% The Canadian lynx data set used in time series modelling is the annual record of the number 
% of the Canadian lynx "trapped" in the Mackenzie River district of the North-West Canada for
% the period 1821–1934. These data are actually the total fur returns, or total sales, from the
% London archives of the Hudson's Bay Company in the years of 1821–1891 and 1887–1913; 
% and those for 1915 to 1934 are from detailed statements supplied by the Company's Fur 
% Trade Department in Winnipeg; those for 1892–1896 and 1914 are from a series of returns
% for the MacKenzie River District; those for the years 1863–1927 were supplied by Ch. French,
% then Fur Trade Commissioner of the Company in Canada. 

lynx=...
[269, 321, 585, 871, 1475, 2821, 3928, 5943, 4950, 2577, 523, 98, 184, 279, 409, 2285, 2685, 3409, ...
1824, 409, 151, 45, 68, 213, 546, 1033, 2129, 2536, 957, 361, 377, 225, 360, 731, 1638, 2725, ...
2871, 2119, 684, 299, 236, 245, 552, 1623, 3311, 6721, 4254, 687, 255, 473, 358, 784, 1594, ...
 1676, 2251, 1426, 756, 299, 201, 229, 469, 736, 2042, 2811, 4431, 2511, 389, 73, 39, 49, 59, ...
188, 377, 1292, 4031, 3495, 587, 105, 153, 387, 758, 1307, 3465, 6991, 6313, 3794, 1836, 345, ...
382, 808, 1388, 2713, 3800, 3091, 2985, 3790, 674, 81, 80, 108, 229, 399, 1132, 2432, 3574, ...
2935, 1537, 529, 485, 662, 1000, 1590, 2657, 3396];

x = 1821:1934;
figure(1)
%---------------------------------------
  lw = 2; 
  set(0, 'DefaultAxesFontSize', 14);
  fs = 13;
  msize = 5;
%---------------------------------------
plot(x,lynx/1000,'linewidth',lw)
hold on
plot(x,lynx/1000,'or','markersize',msize)
xlabel('year', 'fontweight', 'bold', 'fontsize', fs)
ylabel('number (in 1000s)', 'fontweight', 'bold', 'fontsize', fs)
%-------------

figure(2)
%x = autocorr(lynx, 40);  
x=acorr(lynx, 40);
stem((0:39), x,'fill',':')
%hold on
%plot((0:39)',1.96/sqrt(length(lynx))*linspace(1,1,40), 'g--')
%plot((0:39)',-1.96/sqrt(length(lynx))*linspace(1,1,40), 'g--')
xlabel('lag', 'fontweight', 'bold', 'fontsize', fs)
ylabel('autocorrelation', 'fontweight', 'bold', 'fontsize', fs)
