<div dir="ltr"><div><div><div>Hi Erika,<br><br>Hopefully the following is helpful.  It returns both partial and part correlations, but if you want<br></div>you can ask for only one of them to be returned using the optional argument &quot;opt&quot;<br><br></div>e.g opt=True<br></div>      opt@partialcorrelation=True<br><div><div><div><br>saji<br>--<br><br>function mreg_part_corr(x1,x2,y,opt)<br>local opt<br>begin<br>  x1x2 = escorc(x1,x2)<br>  tol = sqrt(1-x1x2^2)<br><br>  nx1 = dimsizes(x1)<br>  X = new( (/3,nx1/), float)<br>  X(0,:) = 1.0<br>  X(1,:) = x1<br>  X(2,:) = x2<br><br>  beta = reg_multlin(y, X, False)<br>  dreg = beta(1)<br>  nreg = beta(2)<br><br>  Xstd = dim_stddev(X)<br>  Ystd = stddev(y)<br>  XstdYstd = Xstd/Ystd<br>  B = beta*XstdYstd<br>  B(0) = 0.0<br>  part_corr_x1 = B(1)*tol<br>  part_corr_x2 = B(2)*tol<br>  partial_corr_x1 = part_corr_x1/sqrt((1-(escorc(y,x2))^2))<br>  partial_corr_x2 = part_corr_x2/sqrt((1-(escorc(y,x1))^2))<br>  if opt .and. isatt(opt,&quot;part_correlation&quot;)<br></div><div>    if opt@part_correlation<br></div><div>    return((/part_corr_x1, part_corr_x2/))<br></div><div>    end if  <br></div><div>end if<br>  if opt .and. isatt(opt,&quot;partal_correlation&quot;)<br></div><div>    if opt@partial_correlation<br></div><div>      return((/partial_corr_x1, partial_corr_x2/))<br></div><div>    end if<br></div><div>  end if<br>  res=(/partial_corr_x1,partial_corr_x2,part_corr_x1,part_corr_x2/)<br>  return(res)<br>end<br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 3:13 AM, Erika Folova <span dir="ltr">&lt;<a href="mailto:e.folova@gmail.com" target="_blank">e.folova@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hallo NCL users,<div><br></div><div>Anyone try to compute the partial correlation, e.g.,  between a and b excluding the effect of c ?</div><div>Thank you </div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Erika,</div></font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>