[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

# st: re: partial correlations

 From Christopher Baum To statalist@hsphsun2.harvard.edu Subject st: re: partial correlations Date Mon, 30 May 2005 11:46:32 -0400

```Luck said

I am using the following command in Stata 8:

statsby "pcorr x1 x2 x3 x4 x5 x6" r(rho_12) , by(year)

to generate a table of partial correlations between x1 and x2 by year.
However, the results I get is simply "." (dots) for _stat1. Why is
_stat1 missing? What should I place in the statsby command to produce
the partial correlation vector? Is statsby compatible with pcorr? I've
tried correlation and statsby and they two work well.

By the way, how to find out the form of all statistics produced by a
given command such as correlate and regress? For example, how do I
know that I can get e(r2) as R-squared from regress command? I can not
find such information in the Help files.

webuse grunfeld,clear
matrix res = J(20,3,0)
local i 0
qui forv y= 1935/1954 {
local ++i
pcorr  invest mvalue kstock if year==`y'
mat res[`i',1]=`y'
local j 1
foreach v of varlist mvalue kstock   {
local ++j
qui test `v'
scalar pc = sqrt(r(F)/(r(F)+e(df_r)))
matrix res[`i',`j']= pc
}
}
mat colnames res = year mvalue kstock
mat list res

Kit
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```

 © Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index