Limited-time offer! Save up to 50% Off | Solutions starting at \$6 each

# Statistics and data analysis PDF

Added on - 22 Nov 2021

• 8

Pages

• 1036

Words

• 25

Views

• 0

• Save

Share

Showing pages 1 to 3 of 8 pages
HW Assignment 1....................................................................................................................................1
QUESTION 4.............................................................................................................................................1
QUESTION 5.............................................................................................................................................2
QUESTION 6.............................................................................................................................................4
QUESTION 7.............................................................................................................................................5
HW Assignment 1
...Statistics and data Analysis
...@ student Name
...@ student Details
clear
closeall
clc
QUESTION 4
...Rent distributions in Randomistan
% Stochastic Heights (SH) and Random Grove (RG)
SHp=12e3;
RGp=18e3;
SH_mean=5100;%RCU
RG_mean=3700;%RCU
rent_median=4000;%RCU
%Plotting histogram
figure(1)
Arent=SHp.*rand(100,1)+RGp.*rand(100,1);
rentdist=Arent;
clmnRent=sum(Arent,1);
edges=min(clmnRent):max(clmnRent)
counts=histc(clmnRent,edges)
RentSum=sum(counts(:))
normalizedOut1=counts/RentSum;
bar(edges,normalizedOut1,'BarWidth',1);
gridon
set(gcf,'name','Rent Distribution','numbertitle','off')
title('Rent Distribution','FontSize', 15);
edges =
1.4384e+06
counts =
1
RentSum =
1
QUESTION 5
...COVARIANCE AND INDEPENDENCE
X=11;%Sum of the digits of the date you were born on(Not including the year)
A=[36 25 38 46 55 68 72 55 36 38];%finite probability space
B=[67 45 22 48 91 46 52 61 58 55];
rng(0,'twister');
% To obtain the statistical parameters of the different sections
stats=[mean(A) std(A) var(A)];
disp(' Mean Std. Devtn Variance')
disp(stats)
%To determine the covariance of the probability space
disp('covariance=cov(X,Y):');
C=cov(X,Y)
if(C==0)
disp('Not Correlated');
else
disp('Correlated');
end
%Testing if it is independent
Z1=[X;Y];
Zt1=transpose(Z1);
disp('To determine statistical independence of the random variables')
[r,pt]=corrcoef(Zt1)
%Testing if it is independent
Z=[A;B];
Zt=transpose(Z);
disp('To determine statistical independence of the random variables')
[r,pt]=corrcoef(Zt)
% Part B
disp('covariance=cov(A,B):');
Prt=cov(A,B)
if(Prt==0)
disp('Not Correlated');
else
disp('Correlated');
end
% Explanation: The rand() function is used to generate random elements
...which occupy the same probability space such that their values tend to
...form a relationship which shows correlation.
Mean Std. Devtn Variance
46.9000 15.2129 231.4333
covariance=cov(X,Y):