I am running Pearson's correlations on multiply imputed data in Stata:
mi query
local M=10
scalar corr=0
mi xeq 1/`M' : correlate v1 v2 ; scalar corr = corr + atanh(r(rho))
scalar corr = tanh(corr/`M')
di as txt "Correlation using Fisher's z over imputed data = " as res corr
The above code works well, except it does not produce p-values for each coefficient.
Is there a way to include p-values?
You can obtain correlation coefficients with p-values by using pwcorr
with the option sig
:
. sysuse auto, clear
(1978 Automobile Data)
. pwcorr price mpg length displacement headroom, sig
| price mpg length displa~t headroom
-------------+---------------------------------------------
price | 1.0000
|
|
mpg | -0.4686 1.0000
| 0.0000
|
length | 0.4318 -0.7958 1.0000
| 0.0001 0.0000
|
displacement | 0.4949 -0.7056 0.8351 1.0000
| 0.0000 0.0000 0.0000
|
headroom | 0.1145 -0.4138 0.5163 0.4745 1.0000
| 0.3313 0.0002 0.0000 0.0000
|
See help pwcorr
for more information.