caculating significance of correlation coefficient
Posted: 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.
Thank you very much for help.
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"