logo

Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation

   

Added on  2023-05-31

8 Pages1041 Words397 Views
 | 
 | 
 | 
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
close all
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);
grid on
set(gcf,'name','Rent Distribution','numbertitle','off')
title('Rent Distribution', 'FontSize', 15);
edges =
1.4384e+06
Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation_1

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)
Y=341; %House Number- Home Address
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');
Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation_2

% 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):
C =
Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation_3

End of preview

Want to access all the pages? Upload your documents or become a member.