% importing excel data
% data1 36x10 double
data1 = xlsread('C:\Users\PGDM Test\Desktop\gowtham\Month_Comp_data.xlsx');
% imports the second sheet i.e. TCS
% data2 36x1 double
data2 = xlsread('C:\Users\PGDM Test\Desktop\gowtham\Month_Comp_data.xlsx', 'TCS');
% selecting particular range
% selects the cells from B2 to B14
% data3 13x1 double
data3 = xlsread('C:\Users\PGDM Test\Desktop\gowtham\Month_Comp_data.xlsx', 'TCS', 'B2:B14');
% plots the all rows of first column of data1
a1 = plot(data1(:,1));
% 'figure' command in between two plot command diplays plots in two
% different pages else only plot 2 will be displayed in absence of
% figure command
figure;
% plots the all rows of second column
a2 = plot(data1(:,2));
% returns the number of rows in a column. Here the length of column 1 is
% returned to len i.e. 36
len = length(data1(:,1));
% get the current price of the stocks
pt = data1(2:len,:);
% get the previous day prices of the stocks
pt_1 = data1(1:len-1,:);
% calucualte the continuous componding return i.e.
%log( current price/previous price)
% ret_cc 35x10 double
ret_cc = log(pt./pt_1);
% calculate the simple return
% simple return = current price / previous price
% ret_sim 35x10 double
ret_sim = (pt./pt_1);
% retuns of each company
asian_paints = ret_cc(:,1);
reddy = ret_cc(:,2);
icici = ret_cc(:,3);
itc = ret_cc(:,4);
% density plot of returns of each company
ksdensity(asian_paints);
figure
ksdensity(reddy);
figure
ksdensity(icici);
figure
ksdensity(itc);
% statistical analysis of asian paints
% mean of returns of asian paints
% asian_mean 0.007602870458122
asian_mean = mean(asian_paints);
% median of returns of asian paints
% asian_median -7.808330298679778e-04
asian_median = median(asian_paints);
% find the kurtosis
% asian_kurt 2.793589748452653
asian_kurt = kurtosis(asian_paints);
% skewness
% asian_skew -0.366401516942248 negatively skew
asian_skew = skewness(asian_paints);
% Augmented Dicky Fuller (ADF) test to find weather the distribution is
% stationary
[h pval stat] = adftest(asian_paints);
% h = 1 & pavl = 0.01 and stat = -5.287963764334884
% pval < 0.05 so reject null hypothesis i.e. series is unit root (not
% stationary)
% therefore asian_paints return series is stationary
% Jarque Bera test used to check weather the given series is in normal
% distribution or not
% u1: series is normal (null hypothesis)
% u2: series is not normal (alternative hypothesis)
% If h=1 and Pval <0.05 then reject the null
[h1 pval1 stat1] = jbtest(asian_paints);
% h1 = 0 , pval 1 = 0.5 and stat1 = 0.845257989353985
% h1 is zero therefore it is in normal distribution