Question

In: Statistics and Probability

a. Calculate the covariance between variables X and Y. Is it a positive or negative relationship between the two variables?

Observation x y
1 -22 22
2 -33 49
3 2 8
4 29 -16
5 -13 10
6 21 -28
7 -13 27
8 -23 35
9 14 -5
10 3 -3
11 -37 48
12 34 -29
13 9 -18
14 -33 31
15 20 -16
16 -3 14
17 -15 18
18 12 17
19 -20 -11
20 -7 -22

Answer the following questions

a. Calculate the covariance between variables X and Y. Is it a positive or negative relationship between the two variables?

b. Calculate correlation coefficient between X and Y. Is it a positive or negative relationship? Is it a strong linear, weak linear or nonlinear relationship between X and Y?

c. Use the Y data to calculate mean, range, standard deviation and variance.

d. Use the first Y value to calculate the Z-score. Is it an outlier?

e. Calculate the 60th percentile for the Y data.

Solutions

Expert Solution

Solution-:

By using R- Software:

> Obs=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);Obs
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> x=c(-22,-33,2,29,-13,21,-13,-23,14,3,-37,34,9,-33,20,-3,-15,12,-20,-7);x
[1] -22 -33 2 29 -13 21 -13 -23 14 3 -37 34 9 -33 20 -3 -15 12 -20
[20] -7
> y=c(22,49,8,-16,10,-28,27,35,-5,-3,48,-29,-18,31,-16,14,18,17,-11,-22);y
[1] 22 49 8 -16 10 -28 27 35 -5 -3 48 -29 -18 31 -16 14 18 17 -11
[20] -22
> length(Obs)
[1] 20
> length(x)
[1] 20
> length(y)
[1] 20
> Table=data.frame(Obs, x, y);Table
Obs x y
1 1 -22 22
2 2 -33 49
3 3 2 8
4 4 29 -16
5 5 -13 10
6 6 21 -28
7 7 -13 27
8 8 -23 35
9 9 14 -5
10 10 3 -3
11 11 -37 48
12 12 34 -29
13 13 9 -18
14 14 -33 31
15 15 20 -16
16 16 -3 14
17 17 -15 18
18 18 12 17
19 19 -20 -11
20 20 -7 -22
> #(a) For covariance
> cov(x,y)
[1] -421.6711
> #Iterpretation: It is a negative relationship between the two variables.
> #(b)For correlation
> cor(x,y)
[1] -0.8133727
> #Interpretation: It is highly (or strongly) negative relationship between x and y
> #(c) For mean,range,variance and standard deviation ofvariable y
> mean=mean(y);mean
[1] 6.55
> max=max(y);max
[1] 49
> min=min(y);min
[1] -29
> Range=max-min;Range   
[1] 78
> # For variance and standard Deviation
> n=30
> v=var(x);v
[1] 451.1447
> var=((n-1)/n)*v;var
[1] 436.1066
> sd=sqrt(var);sd
[1] 20.88316
> #(d) for first value of Z-score
> y=22
> Z=(y-mean)/sd;Z
[1] 0.7398304
> # The boundaries for outliers in a box plot are Q1 - 1.5*IQR and Q3 + 1.5IQR. If the data point lie betwen them then it is not considered as an outlier.
> # Here, we find Q1,Q3,IQR
> y=c(22,49,8,-16,10,-28,27,35,-5,-3,48,-29,-18,31,-16,14,18,17,-11,-22);y
[1] 22 49 8 -16 10 -28 27 35 -5 -3 48 -29 -18 31 -16 14 18 17 -11
[20] -22
> Q1=quantile(y,0.25);Q1
25%
-16
> Q3=quantile(y,0.75);Q3
75%
23.25
> IQR=Q3-Q1;IQR
75%
39.25
> #The lower boundaries for outliers = Q1 - 1.5*IQR
> Q1 - 1.5*IQR
25%
-74.875
> #The upper boundary for outliers = Q3 + 1.5*IQR
> Q3 + 1.5*IQR
75%
82.125
> # Therefore, y=22 is not outlier
> #(e)For 60th percentile
> P60=quantile(y,0.60);P60
60%
15.2

R-code:

Obs=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);Obs
x=c(-22,-33,2,29,-13,21,-13,-23,14,3,-37,34,9,-33,20,-3,-15,12,-20,-7);x
y=c(22,49,8,-16,10,-28,27,35,-5,-3,48,-29,-18,31,-16,14,18,17,-11,-22);y
length(Obs)
length(x)
length(y)
Table=data.frame(Obs, x, y);Table
#(a) For covariance
cov(x,y)
#Iterpretation: It is a negative relationship between the two variables.
#(b)For correlation
cor(x,y)
#Interpretation: It is highly (or strongly) negative relationship between x and y
#(c) For mean,range,variance and standard deviation ofvariable y
mean=mean(y);mean
max=max(y);max
min=min(y);min
Range=max-min;Range   
# For variance and standard Deviation
n=30
v=var(x);v
var=((n-1)/n)*v;var
sd=sqrt(var);sd
#(d) for first value of Z-score
y=22
Z=(y-mean)/sd;Z
# The boundaries for outliers in a box plot are Q1 - 1.5*IQR and Q3 + 1.5IQR. If the data point lie betwen them then it is not considered as an outlier.
# Here, we find Q1,Q3,IQR
y=c(22,49,8,-16,10,-28,27,35,-5,-3,48,-29,-18,31,-16,14,18,17,-11,-22);y
Q1=quantile(y,0.25);Q1
Q3=quantile(y,0.75);Q3
IQR=Q3-Q1;IQR
#The lower boundaries for outliers = Q1 - 1.5*IQR
Q1 - 1.5*IQR
#The upper boundary for outliers = Q3 + 1.5*IQR
Q3 + 1.5*IQR
# Therefore, y=22 is not outlier
#(e)For 60th percentile
P60=quantile(y,0.60);P60


Related Solutions

Calculate the covariance between variables X and Y. Is it a positive or negative relationship between...
Calculate the covariance between variables X and Y. Is it a positive or negative relationship between the two variables? b. Calculate correlation coefficient between X and Y. Is it a positive or negative relationship? Is it a strong linear, weak linear or nonlinear relationship between X and Y? c. Use the Y data to calculate mean, range, standard deviation and variance. d. Use the first Y value to calculate the Z-score. Is it an outlier? e. Calculate the 60th percentile...
Fourth Question: The table below represents a relationship between two variables X and Y x 7,8,4,3,9,5,7,1,2...
Fourth Question: The table below represents a relationship between two variables X and Y x 7,8,4,3,9,5,7,1,2 y 8,10,5,2,12,3,9,1,1 a) Calculate the Pearson correlation coefficient between the X and Y variables. B) Find the y regression equation for X for the cooked data c) Calculate the estimated value (prediction) of the variable Y when the value of the variable X is equal to 5. What is the error value of the estimate?
Let X and Y be random variables with means µX and µY . The covariance of...
Let X and Y be random variables with means µX and µY . The covariance of X and Y is given by, Cov(X, Y ) = E[(X − µX)(Y − µY )] a) Prove the following three equalities: Cov(X, Y ) = E[(X − µX)Y ] = E[X(Y − µY )] = E(XY ) − µXµY b) Suppose that E(Y |X) = E(Y ). Show that Cov(X, Y ) = 0 (hint: use the law of interated expectations to show...
Contract the scatter plot of these data. Describe relationship between x and y. What type of relationship appears to exist between two variables?
Use the following data: x y 10 3 6 7 9 3 3 8 2 9 8 5 3 7 Contract the scatter plot of these data. Describe relationship between x and y. What type of relationship appears to exist between two variables? (you can copy and past from Excel,SAS,etc) Compute the correlation coefficient r. Test to determine whether the population correlation coefficient is positive. Use the α=0.01 level to conduct test. (calculate test statistics and make conclusion)
This is the probability distribution between two random variables X and Y: Y \ X 0...
This is the probability distribution between two random variables X and Y: Y \ X 0 1 2 3 0.1 0.2 0.2 4 0.2 0.2 0.1 a) Are those variables independent? b) What is the marginal probability of X? c) Find E[XY]
2. Theory gives you the following relationship between variables x and y, y = β0 +...
2. Theory gives you the following relationship between variables x and y, y = β0 + β1x + u. You collect a sample of data on n = 4 sample members. The data are : {x1, y1} = {3, 8},{x2, y2} = {2, 7},{x3, y3} = {1, 6},{x4, y4} = {3, 4} a. State the minimization problem that you need to derive the OLS estimators b. Estimate the relationship between x and y using this sample. What is your estimate...
12.Regarding the direction of a relationship between two variables, choose the best description of a negative...
12.Regarding the direction of a relationship between two variables, choose the best description of a negative association. A.A relationship between two variables where the observations of the variables move in opposite directions, e.g. as the values of one variable increase, values of the other variable decrease or vice versa. For example, alcohol consumption and the strength of the body’s immune system. B.A relationship between two variables where the observations of the variables move in opposite directions, e.g. as the values...
Think of a pair of variables that has a strong linear relationship, either positive or negative,...
Think of a pair of variables that has a strong linear relationship, either positive or negative, then find data that you think supports your assertion. You need to get real data for this problem, not just make numbers up to fit your hypothesis.
Let X and Y be two independent random variables. Assume that X is Negative- Binomial(2, θ)...
Let X and Y be two independent random variables. Assume that X is Negative- Binomial(2, θ) and Y is Negative-Binomial(3, θ) distributed. Let Z be another random variable, Z = X + Y . (a) Find the following probabilities: P(Z = 0), P(Z = 1) and P(Z = 2); (b) Can you guess what is the distribution of Z?
Explain the difference between a positive linear relationship, a negative linear relationship, and a nonlinear relationship...
Explain the difference between a positive linear relationship, a negative linear relationship, and a nonlinear relationship and give an example of each.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT