Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Perform statistical normalization: zero mean + unit variance First, perform the MATLAB instruction: Z = zscore ( x ) ; This command shifts and scales
Perform statistical normalization: zero mean unit variance
First, perform the MATLAB instruction:
zscore;
This command shifts and scales the column vectors to be zeromean and unitvariance. Also, plot
the columns of the matrix and discuss what you see. Is each column zero mean and unit variance?
Verify
Compute and plot the joint pdf
Recall that we can use histograms to "approximate" the true pdf However, there is no standard
MATLAB command to generate a D histogram. Use the following code to compute the D
histogram first and then to approximate the joint pdf say, between the st and nd stocks eg
A and Turn this into a MATLAB function so that you can use it to approximate
all other joint pdfs dots, This code uses MATLAB's hist command to compute the
D histogram in an iterative way. The for loop segregates the stocks of X by the Xvalue
bins. Then for each subset of X stocks, it creates a D histogram of the corresponding X
stocks and puts them into the appropriate bins in the D histogram. It requires you to set bins,
which is the number of bins on each axis. You can use for instance: bins
Next, as for the marginal pdf approximation, we need to normalize the histogram so that the
joint pdf sums up to one:
pdf ndsumsumnd;
Finally, plot the pdf using one of the following options, so that the pdf is clearly visible.
Image Plot: imagesc ; colorbar;
Surface Plot: pdf Exercise # :
Joint Distribution and Correlation
The weekly rates of return for five stocks listed on the New York Stock Exchange are given in the
file Stocks.dat. Call these stock column vectors: A B C D and Let the data matrix be
B C D E In this assignment, first you will approximate the joint distribution of the pair of stocks.
Then you will find the covariance and correlation between each pair of stocks using the
approximated probability distribution functions pdfs and directly over the data sample
covariance too. The idea is to find out which two stocks have the highest correlation and how to
use this information for investment.
Here are the main steps:
Load the data file provided 'Stocks.dat' in MATLAB.
Visualize plot each of the stocks. OUTPUT: Stock plots.
Perform statistical normalization zero mean, unit variance of each stock data vector
OUTPUT: Plots of all normalized stocks
Approximate the joint pdf for your data. OUTPUT: Two different plots of your joint pdf
Compute the covariance matrix and the correlation coefficient by a from the joint pdfs that
are estimated b directly from the sample covariance matrix OUTPUTS: the estimated
correlation from the joint pdfs and estimated correlation matrix from pdfs and the sample
correlation matrix.
You should create ONLY one singlefile technical report in pdf containing comments,
discussions, MATLAB script and all outputs plots etc. of your assignment.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started