<div dir="ltr"><div>NCL variables are data structures (data objects) that mimic netCDF variables. Using Example 1 of <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml"><b>http://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml</b></a></div><div><br></div><div> :</div><div> :</div><div> print(b)<br><br>; Create netCDF file <br><br> diro = "./"<br> filo = "<a href="http://mult_reg.nc">mult_reg.nc</a>"<br> ptho = diro + filo<br> <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml"><b>system</b></a>("/bin/rm -f "+ ptho ) ; remove any previous file<br><br> b!0 = "N" ; N=np+1<br> b@information = "y-intercept; partial regression coefficients associated with each independent variable"<br> b@long_name = "Partial Regression Coefficients"<br> delete(b@_FillValue) ; not appropriate<br><br> fo =<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml"><b> addfile</b></a>(ptho,"<b>c</b>")<br> fo->B= b ; NCL will write all components of the netCDF variable</div><div>===================</div><div><br></div><div>You can examine the file's contents via:</div><div><br></div><div> %> <b>ncdump</b> -v B <a href="http://mult_reg.nc">mult_reg.nc</a></div><div><br></div><div>or <br></div><div><br></div><div> %> <b>ncl_filedump</b> <a href="http://mult_reg.nc">mult_reg.nc</a></div><div><br></div><div>====================</div><div><br></div><div> %> <b>ncdump</b> -v B <a href="http://mult_reg.nc">mult_reg.nc</a></div><div><br></div><div>netcdf mult_reg {<br>dimensions:<br> N = 3 ;<br>variables:<br> float B(N) ;<br> B:information = "y-intercept; partial regression coefficients associated with each independent variable" ;<br> B:long_name = "Partial Regression Coefficients" ;<br> B:model = "Yest = b(0) + b(1)*X1 + b(2)*X2 + ...+b(M)*XM" ;<br> B:N = 17 ;<br> B:NP = 2 ;<br> B:M = 3 ;<br> B:bstd = 0.f, 0.5029772f, 0.4922954f ;<br> B:SST = 13239.72f ;<br> B:SSE = 423.3723f ;<br> B:SSR = 12816.36f ;<br> B:MST = 827.4825f ;<br> B:MSE = 30.24088f ;<br> B:MSE_dof = 14 ;<br> B:MSR = 6408.178f ;<br> B:RSE = 5.499171f ;<br> B:RSE_dof = 13 ;<br> B:F = 211.9045f ;<br> B:F_dof = 2, 14 ;<br> B:F_pval = 3.419033e-11f ;<br> B:r2 = 0.9680232f ;<br> B:r = 0.9838817f ;<br> B:r2a = 0.9634551f ;<br> B:fuv = 0.03197682f ;<br> B:Yest = 249.9873f, 254.2619f, 257.2977f, 260.4574f, 266.3423f, 271.423f, 274.3349f, 279.6005f, 284.0294f, 285.7331f, 297.3181f, 300.1061f, 310.5743f, 314.0123f, 322.4051f, 334.5465f, 340.3705f ;<br> B:Yavg = 288.4f ;<br> B:Ystd = 28.766f ;<br> B:Xavg = 55.35294f, 30.9f ;<br> B:Xstd = 11.68028f, 1.172071f ;<br> B:stderr = 100.8641f, 0.3945341f, 3.931675f ;<br> B:tval = -1.521964f, 3.139713f, 3.073079f ;<br> B:pval = 0.1488179f, 0.006746806f, 0.007730724f ;<br>data:<br><br> B = -153.5115, 1.238724, 12.08235 ;</div><div>}<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 23, 2020 at 9:21 PM Xueyan Zhang via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hello all,<div><br></div><div>I am doing multiple variable linear regression following this page: <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml</a>.</div><div><br></div><div>How can I save R2 to a file? Also, how can I save information about which variable is significant?</div><div><br></div><div>Thanks!</div><div><br></div><div>Xueyan</div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>