all( c(1,2,3,4,5) > 0)
Midterm 1 Extra Questions
Questions from Recent Material
Extra Questions from Chapter 8: 1, 2, 3, 4
Additional Questions
What would be the result from running the following code?
Consider the following function
<- function(n) { a_function <- 0 out for (i in 1:n) { <- out + i^2 out } out }
If you run the following code, what will it output?
a_function(5)
Suppose there are two random variables \(X\) and \(Y\).
If you know that \(X\) and \(Y\) are independent, do you know what their covariance is equal to? Explain. If yes, what is the covariance equal to?
If you know that \(\mathrm{cov}(X,Y)=0\), are \(X\) and \(Y\) independent? Explain.
If you know that \(\mathrm{cov}(X,Y)=1\), are \(X\) and \(Y\) independent? Explain.
Suppose that \(X_1\) and \(X_2\) are two random variables such that \(\mathbb{E}[X_1] = 0\), \(\mathbb{E}[X_2] = 5\), \(\mathrm{var}(X_1) = 1\), \(\mathrm{var}(X_2) = 10\) and \(\mathrm{cov}(X_1,X_2) = -1\). Suppose that \(Y=X_1 + X_2\).
What is \(\mathbb{E}[Y]\)?
What is \(\mathrm{var}(Y)\)?
Consider a random variable \(Y\) that is equal to a firm’s profits (in thousands of dollars) and another random variable \(X\) that is equal to firm’s number of employees. Suppose you know that \[\begin{align*} \mathbb{E}[Y|X=x] = 50 + 10x \end{align*}\]
Explain how to interpret \(\mathbb{E}[Y|X=x]\).
What is \(\mathbb{E}[Y|X=10]\)?
Suppose that \(\mathrm{var}(Y) = 40\), \(\mathbb{E}[X]=30\), and \(\mathrm{var}(Y)=20\), calculate \(\mathbb{E}[Y]\).
Suppose that we have a random sample of \(n\) observations of \(X\) and \(Y\).
Suppose that you want to estimate the covariance between \(X\) and \(Y\) using the data that we have. Propose an estimator for the covariance. Hint: Try using the analogy principle and the expression \(\mathrm{cov}(X,Y) = \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y]\).
Alternatively, the definition of covariance is \(\mathrm{cov}(X,Y) = \mathbb{E}\left[ (X - \mathbb{E}[X])(Y-\mathbb{E}[Y]) \right]\). Propose an estimator for the covariance based on this expression. Would you expect this to give you the same estimate of the covariance as in part a?