+1 (315) 557-6473 

Quantitative analysis homework solution

The solution provided below is based on quantitative analysis. We have used probabilities, standard deviation and covariate analysis to come out with the desired solutions.

Interpreting the results using quantitative analysis

Here, we have used quantitative analysis and probabilities to interpret the questions and come up with the desired answers.

Questions
1. Consider the probability distribution below

ProbabilityX (lb.)
0.10
0.30.5
0.51
0.15
a. Compute the expected value. Describe your computation procedure. And interpret your finding.
b. Compute the variance. Describe your computation procedure.
c. Compute the standard deviation. Describe your computation procedure. And interpret your finding.
d. Considering the fact that X is measured in pounds (lb.), what are the units of measurement for expected value, variance, and standard deviation?

2. Let’s add variable Y, measured in dollars, to the probability distribution table in Question No. 1.

Joint ProbabilityX (lb.)Y ($)
0.100
0.30.5100.55
0.51195.75
0.15400
a. Before you even compute the coefficient of correlation between X and Y, what do you expect of its sign: is it likely to be greater than zero or less than zero? Explain your answer in one short paragraph (less than 100 words). 

b. Follow the formula below to compute the covariance between X and Y:
ρ_XY=∑_(i=1)^N▒〖(X_i-E(X))×(Y_i-E(Y))×P(X=X_i,Y=Y_i)〗
In the formula above, N=4, E(X) is the expected value of X (already computed in the first question of this assignment), E(Y) is the expected value of Y (which should be computed for this question), and P(X=Xi, Y=Yi) is the joint probability for X and Y.

c. What is the unit of measurement of the above covariance? Is it meaningful? 

d.  Follow the formula below to compute the coefficient of correlation between X and Y:
                                        r_XY=ρ_XY/(σ_X×σ_Y )
In the formula about, ρ_XYis the covariance between X and Y, σ_X is the standard deviation of X (already computed in the first question of this assignment), and σ_Y is the standard deviation of Y (which should be computed for this question).

e. What is the unit of measurement of the above coefficient of correlation? Is it meaningful?

f. How do you interpret the obtained coefficient of correlation? Is it in line with your answer to part a? Explain your answer in one short paragraph (less than 100 words)?

3. X~N(100,400); i.e., X is a random variable distributed normally with its mean being equal to 100 and its standard deviation being equal to 20 (square root of 400). Identify the following probabilities. Each probability is worth 5 points. Make sure that you report the Excel command using which you computed any given probability. 
 a.  P(X≤75)
 b.  P(X>75)
 c.  P(20
 d.  P(X≤20 or X>80)

4.  X~N(100,400); i.e., X is a random variable distributed normally with its mean being equal to 100 and its standard deviation being equal to 20 (square root of 400).
 P(X≤X*)=80%. What is the value for X*? Make sure that you report the Excel command using which you computed any given probability
 P(X>X**)=60%. What is the value for X**? Make sure that you report the Excel command using which you computed any given probability

5. For the last question of your assignment, you must make sure that an internet connection is already secured, as some of the commands that you will be using in this exercise require a stable internet connection. This is an exercise in R. It also requires some peer review. And it is worth 30 points. For this exercise, you are first asked to search for the following variables in the WDI dataset (for your reference, the exact indicator names are provided in parenthesis):
  • real effective exchange rate (PX.REX.REER)
  • external balance (NE.RSB.GNFS.KN)
You are then asked to compute the coefficient of correlation between the above variables for the US from 2001 to 2019.
a. Copy and paste the R Script that you wrote for this exercise. Include every single line, so I can also run it on my end if needed.
b. What is the coefficient of correlation between real effective exchange rate and external balance for the US from 2001 to 2019?

Peer review:

c. Compare your R Script with that of at least one of your peers. In a short paragraph (less than 200 words), describe the similarities and the differences between your codes and your peer’s codes.
d. Did your peer find the same coefficient as you?
e. For the record, including the name of your peer with whom you compared codes.

Solution
1) 
a. We know that expected value is the sum of product of X and their probabilities. Thus, Expectation = ∑X*P(X)=0*0.1+0.5*0.3+1*0.5+5*0.1=0.15+0.5+0.5=1.15
Interpretation: Here X is pounds; thus we can say that on average X is going to be equal to the expected value i.e. 1.15 Pounds.

b. Variance is the squared deviation of random variable i.e. Variance = E(X^2 )-E(X)^2. We know E(X) = 1.15, we’ll be calculating E(X^2 ) to find Var(X). So,
E(X^2 )=∑X^2*P(X)=0*0.1+0.25*0.3+1*0.5+25*0.1=0.075+0.5+2.5=3.075
Thus, Var(X) = E(X^2 )-E(X)^2= 3.075- 〖1.15〗^2= 3.075-1.3225=1.7525

c. Standard deviation is the square root of variance. Thus,
σ_x=√(var(X) )=√1.7525=1.3238.
Interpretation: Standard deviation measures how spread X is. Here the standard deviation is 1.3238 and the expected values is 1.15, then we can say that
 approximately 68% of the data lies 1 standard deviation from the mean i.e.,(-0.174, 2.474)
 approximately 95% of the data lies 2 standard deviations from the mean i.e.,in the interval (-1.498, 3.798)
 approximately 99.7% of the data lies 3 standard deviations from the mean i.e.,in the interval (-2.822, 5.122)

d. Units of measurement i) Expected value = pounds
ii) Variance = pounds^2as squared deviations are calculated.
iii) Standard deviation = Pounds as it’s square root of variance

2)
a. The joint probability distribution shows that there’s a only 4 combinations of (X,Y) which has positive probability of occurrence. Thus, only four combinations of X and Y are possible. Both X and Y starts from 0 and increase together. Though the increase in Y is much more than X, but they both show an increasing pattern together. Thus, we can say that there is a positive correlation between the two variables.

b. We need to calculate E(Y) and then will use it in the Covariance formula.
E(Y)= ∑Y*P(Y)=0*0.1+100.55*0.3+195.75*0.5+400*0.1= 168.04
Now, we will compute the correlation using
ρ_XY=∑_(i=1)^N▒〖(X_i-E(X) )×(Y_i-E(Y) )×P(X=X_i,Y=Y_i ) 〗=(0-1.15)*(0-168.04)*0.1+(0.5-1.15)*(100.55-168.04)*0.3+(1-1.15)*(195.75-168.04)*0.5+(5-1.15)*(400-168.04)*0.1
=19.3246+13.165055-2.07825+89.3046 =119.7115

c. The unit of measurement is pounds*$. It’s not making any sense, thus, it’s meaningful.

d. As we know Var(Y) = E(Y^2 )-E(Y)^2. We know E(Y) = 168.04. thus, we will calculate E(Y)^2.
E(Y^2 )= ∑Y^2*P(Y)=0*0.1+〖100.55〗^2*0.3+〖195.75〗^2*0.5+〖400〗^2*0.1=3033.091+19159.03+16000=38192.12
Thus, var(Y) = E(Y^2 )-E(Y)^2=38192.12-〖168.04〗^2=9954.678
Hence the standard deviation is: σ_y=√(var(Y) )=√9954.678=99.773. Now, we can calculate the correlation:
r_XY=ρ_XY/(σ_X×σ_Y )=119.115/(1.324*99.773)=0.902

e. There is no unit of measurement of the correlation as both numerator and denominator have the same unit of measurement i.e. pounds*$. The unit of measurement is meaningful, as the correlation tells us the direction of linear relationship between the variables.

f. The obtained correlation coefficient is 0.902. Using this we can say that there is a strong positive correlation between the two variables pounds and dollar. Hence, we can say that on average as X increases or decrease,we can expect Y also to increase or decrease. In answer of part (a) we expected a positive correlation between the variables, and here we obtained a correlation coefficient of 0.902 which is positive. Thus, the result is obtained as expected.

3) Here the bold italic fonts represent the Excel command, while the non-italicized are the answers:

a. P((X≤75) = NORM.DIST(75,100,20,TRUE) = 0.10565
b. P(X>75) = 1 - NORM.DIST(75,100,20,TRUE) = 0.89435
c. P((20NORM.DIST(80,100,20,TRUE) - NORM.DIST(20,100,20,TRUE) = 0.158624
d. P(X≤20 or X>80) = P(X≤20) + P(X>80) =NORM.DIST(20,100,20,TRUE) + 1 - NORM.DIST(80,100,20,TRUE) = 0.84138

4) Here the bold italic fonts represent the Excel command, while the non-italicized are the answers:

a. =NORM.S.INV(0.8)*20+100 = 116.8324
b. Here we need to find X** which satisfies, P(X>X**) = 60%, which is equivalent P(X≤X**) = 40%. Thus , we can use the following command: =NORM.S.INV(0.4)*20+100 = 94.93306.

5)
a. The R code:
# Step 1: Install packages tidyverse and WDI
install.packages("tidyverse").
install.packages("WDI")
# Step 2: Call the newly-installed packages by library()
library(tidyverse)
library(WDI)
# Step 3: Put together a dataframe using the required variables
df<-WDI(country=c("US"), indicator=c("PX.REX.REER", "NE.RSB.GNFS.KN"),start=2001,end=2019)
#Step 4: Correlation between the required variables "PX.REX.REER" and "NE.RSB.GNFS.KN"
cor(df$PX.REX.REER,df$NE.RSB.GNFS.KN)

b. The coefficient of correlation between real effective exchange rate and external balance for the US from 2001 to 2019 is -0.5032238