caculating significance of correlation coefficient

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

caculating significance of correlation coefficient

Postby neptunhiker » Tue Apr 08, 2014 1:41 am

Hi everyone,

I would like to calculate the correlation coefficient of two variables and determine the statistical significance, i.e. null: corr. coef.=0.

I know how to use the menu, but I would like to implement it in a program. Using the menu, I follow these steps.
- select both variables and open them in a group
- view/covariance analysis
- deselect covariance and select correlation, t-statistic and probability
- press ok

When I freeze the output I get the correlation coefficient in B14, the t-stat in B15, and the prob. in B16. That's all the data I need. How can I do the same in a program?

If I could pull out the number of observations for the common sample of the two series, I could even calculate the t-stats and prob. manually, but I would rather rely on the implemented calculation.

Here is an example of a workfile with two series that do not contain the same number of observations, because that is also the case in my original workfile, and it makes it more difficult (for me) to pull out the right number of observations for the common sample.


Code: Select all

wfcreate u 100 series a=@rnorm series b=@rnorm a(10)="NA" a(30)="NA" b(50)="NA"
Thank you very much for help.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: caculating significance of correlation coefficient

Postby EViews Gareth » Tue Apr 08, 2014 8:01 am

Code: Select all

wfcreate u 100 series a=@rnorm series b=@rnorm group g a b g.cov(out=myout) corr stat prob


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests