Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ECON 7310:  ELEMENTS OF ECONOMETRICS

Tutorial 1:  R Warm-up (Basic Operations)

At the end of this tutorial you should be able to

use R to read, manipulate and save data and work-files,

❼ use R to compute descriptive statistics, and

❼ use R to conduct hypothesis tests concerning a population mean.

Question 1

The data file consumption .csv contains observations on the weekly family consumption expenditure (CONS) and income (INC) for a sample of 10 families.

(a) Read the data into RStudio.

(b) Draw a scatter plot of CONS against INC.

(c) On checking the data, you find that your assistant has recorded the weekly consumption expenditure for Family 8 as $900 instead of $90. Correct this error and redraw the scatter diagram.

(d) Compute the mean, median, maximum and minimum values of INC and CONS.        (e) Compute the correlation coefficient between CONS and INC. Comment on the result. (f) Create the following new variables

DCONS = 0.5CONS

LCONS = log(CONS)

INC2 = INC2

SQRTINC = ^INC

(g) Delete the variable DCONS and SQRTINC.

(h) Delete everything.

Question 2

At the famous Fulton Fish Market in New York city, sales of whiting (a type of fish) vary from day to day. Over a period of several months, daily quantities sold (in pounds) were observed. These data are in the file fultonfish .csv. Description of the data is in the file fultonfish .txt. Describe the first four columns.

(a) Load the data to RStudio and keep only the first four columns, date, lprice, quan, and lquan. (b) Compute the sample mean and standard deviation of the quantity sold (quan).

(c) Test the null hypothesis that the mean quantity sold is equal to 7,200 pounds a day at the 5% level of significance.

(d) Construct the 95% confidence interval for Part (c).

(e) Plot lprice against lquan and label the variable lprice as “log(Price) of whiting per pound” and lquan as log(Quantity)”. Comment on the nature of the relationship between these two variables.