Problem: Calculate sample moments in Eviews using commands

Problem

Data: http://media.nek.lu.se/data/Sample_moments.xlsx

Use EViews commands to solve this problem. Hint: when you drag the Excel sheet into Eviews, you can select which sheet to extract data from in the “Predefined range”. Use sheet 01 for parts a), b) and c) and sheet 02 for parts d), e) and f)

a) Calculate the sample variance of x using @vars

b) Calculate the sample variance of x using the formula

\[ \frac{1}{n-1}\sum_{i=1}^{n}{ {\left( x_i-\bar{x} \right)}^2 }\]

c) Calculate the sample variance of x using the formula

\[ \frac{1}{n-1}\left( \sum_{i=1}^{n}{ x_i^2 }-n{\bar{x}}^2 \right)\]

d) Calculate the sample covariance of x and y using @covs

e) Calculate the sample covariance using the formula

\[ \frac{1}{n-1}\sum_{i=1}^{n}{ \left( x_i-\bar{x} \right)\left( y_i-\bar{y} \right) }\]

  • Hint: You must create a new series for \(\left( x_i-\bar{x} \right)\left( y_i-\bar{y} \right)\)

f) Calculate the sample covariance using the formula

\[ \frac{1}{n-1}\left( \sum_{i=1}^{n}{ x_iy_i }-n\bar{x}\bar{y} \right)\]

Solution