Answered step by step
Verified Expert Solution
Link Copied!

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:
Z=zscore(x);
This command shifts and scales the column vectors to be zero-mean and unit-variance. Also, plot
the columns of the Z 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 2D histogram. Use the following code to compute the 2D
histogram first and then to approximate the joint pdf, say, between the 1st and 2nd stocks (e.g.,
x1=A and x2=B). Turn this into a MATLAB function so that you can use it to approximate
all other joint pdf.s (1-3,dots,4-5). This code uses MATLAB's hist command to compute the
1-D histogram in an iterative way. The for loop segregates the stocks of X1 by the X1-value
bins. Then for each subset of X1 stocks, it creates a 1-D histogram of the corresponding X2
stocks and puts them into the appropriate bins in the 2-D histogram. It requires you to set bins,
which is the number of bins on each axis. You can use for instance: bins=16
Next, as for the marginal pdf approximation, we need to normalize the histogram so that the
joint pdf sums up to one:
pdf = n2d./(sum(sum(n2d)));
Finally, plot the pdf using one of the following options, so that the pdf is clearly visible.
1.Image Plot: h= imagesc (x1,x2,pdf); colorbar;
Surface Plot: , pdf Exercise # 1:
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 E. 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 5 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 single-file technical report (in pdf) containing comments,
discussions, MATLAB script and all outputs (plots, etc.) of your assignment.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

What is a petty cash receipt? Who should sign it?

Answered: 1 week ago