Homework I – Econometrics I 2024/25 Fall

Q-01) Add the command which clears the environment

# Clear environment

Q-02) Create a string variable, which states: This is my first assignment in R!

str_var <-

Q-03) Create vector gdppc, which contains the values of: 12, 18, 25, 13, 16 and 14

gdppc <-

Q-04) Multiply this vector with 10,000 and name it as gdppc_10

gdppc_10 <-

Q-05) Create an other vector called lifeexp with values of: 62, 68, 73, 65, 66 and 69

lifeexp <-

Q-06) Calculate the average of lifeexp as avg_le

avg_le <-

Q-07) Calculate the average of gdppc as avg_gdppc

avg_gdppc <-

Q-08) Store the two vectors in a data.frame() object and call it df. Use their names for colnames.

df <-

Q-09) Calculate the covariance matrix of df with the function cov() and name it as vcov.

vcov <-

Q-10) Take the covariance of lifeexp and gdppc and divide by the variance of the gdppc. Name it beta! Hint: check your vcov variable and use indexing to get the appropropriate elements.

beta <-

Back to homeworks