def savepartial(x,y,z,obsx,obsy,obsz,outfile):
"""
Exports data file for partial correlation analysis with cens_tau.f.
cens_tau.f quantifies the correlation between X and Y eliminating the
effect of a third variable Z. I patched the Fortran code available from
http://astrostatistics.psu.edu/statcodes/sc_regression.html.
Method arguments:
x,y,z = arrays with data for partial correlation
obs? = arrays of integers. 1 if there is a genuine measurement
available and 0 if there is only an upper limit i.e. censored data.
In the case of this study, X=Pjet, Y=Lgamma, Z=distance.
The structure of the resulting datafile is:
logPjet detected? logLgamma detected? logDist detected?
where the distance is in Mpc.
Example:
>>> agngrb.exportpartial(all.kp,all.lg,log10(all.d),ones_like(all.kp),ones_like(all.kp),ones_like(all.kp),'par
tialdata.dat')
v1 Sep. 2011
"""
numpy.savetxt(outfile,numpy.transpose((x,obsx,y,obsy,z,obsz)),fmt='%10.4f %i %10.4f %i %10.4f %i')
评论列表
文章目录