How to display equation and R2 of a best fit 3D plane?
<p>I have created a 3D plane as the best fit on 3D plot using python. Can someone help me to display the equation of the plane and the R2 of the plane?</p>

<p>r2 is 1.0 - [(absolute error variance] / [dependent data variance])</p>

<p>With numpy this is simple, like so:</p>

<p>err = numpy.array(absolute error)</p>

<p>Z =  numpy.array(Z of "XYZ" data)</p>

<p>r2 = 1.0 - (err.var() / Z.var())</p>

<p>To draw the surface you have to calculate a grid to display.  Matplotlib has an example here, just scroll down a bit until you see the colored surface plot:</p>

<p><a href="http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html" rel="nofollow">http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html</a></p>

python curve-fitting