plot summary:
[Machine Xiao Wei] in the [engineer Ah Wei] accompanied by the [nine turn elixir] of the five-turn of the cultivation.
This is a [statistical case] study.
Drama Start:
Star Calendar April 26, 2016 16:34:30, the Milky Way Galaxy Earles the Chinese Empire Jiangnan Line province.
[Engineer Ah Wei] is working with [machine Xiao Wei] to study [statistical cases].
<span style= "FONT-SIZE:18PX;" >x= [165, 165, 157, he, 175, 165, 155, 170]y= [48, 57, 50, 54, 64, 61, 43, 59] Fitting Result: Y = 0.84848 X + 85.71212 , r= 0.79847def linefit (x, y): N = float (len (x)) sx,sy,sxx,syy,sxy=0,0,0,0,0 for i in range (0,int (N)): SX + x[i] sy + y[i] sxx + x[i]*x[i] syy + = Y[i]*y[i] sxy + = X[i]*y[i] a = (sy*sx /N-SXY)/(sx*sx/n-sxx) B = (SY-A*SX)/n r = ABS (SY*SX/N-SXY)/math.sqrt ((sxx-sx*sx/n) * (syy-sy*sy/n)) return a,b,r def tmp (): x=[165, 165, 157,, 175, 165, 155, []; Y=[, the ",", ",", ",", ","; A,b,r=linefit (x, y) print (" x=", x) print (" y=", y) print ( "fit result: Y =%10.5f X +%10.5f, r=%10.5f"% (a,b,r)); </span>
<span style= "FONT-SIZE:18PX;" > if (1) {var r = 20; Config.setsector (10,5,9,1); Config.graphpaper2d (0, 0, R); Config.axis2d (0, 0, 320, 1.6); Axis set var ScaleX = 2*r, ScaleY = 2*r; var SpaceX = 2, SpaceY = 10; var XS =, XE = 180; var YS = 0, YE = 70; Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X '); Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y '); var x=[165, 165, 157, 54, 175, 165, 155, [], y=[48, 57, 50,, 64, 61, 43, 59]; var array = []; var size = X.length; for (var i = 0; i < size; i++) {Array.push ([x[i], y[i]]); } var transform = new transform (); var tmp = []; Array = Transform. Scale (Transform.translate (array,-xs,-ys), Scalex/spacex, Scaley/spacey); TMP = [].concat (array); Shape.pointdraw (TMP, ' green '); array = []; for (var i = 0; i < size; i++) {Array.push ([x[i], Taskfun (X[i])]); } array = Transform.scale (transform.translate (array,-xs,-ys), Scalex/spacex, Scaley/spacey); TMP = [].concat (array); Shape.multilinedraw (TMP, ' red '); Plot.setfillstyle (' Blue '); Plot.filltext (' fitting results: y = 0.84848x-85.71212 ', 30,-270, 200); }} function Taskfun (x) {return 0.84848*x-85.71212;} </span>
<span style= "FONT-SIZE:18PX;" >[21, 23, 25, 27, 29, 32, 35][1.9459101490553132, 2.3978952727983707, 3.044522437723423, 3.1780538303479458, 4.189654742026425, 4.74493212836325, 5.783825182329737]x= [1.9459101490553132, 2.397895272, +, +, +,] 7983707, 3.044522437723423, 3.1780538303479458, 4.189654742026425, 4.74493212836325, 5.783825182329737] fit result: y = 0.27203 x + -3.84917, r= 0.99260</span>
<span style= "FONT-SIZE:18PX;" > if (1) {var r = 20; Config.setsector (10,5,9,1); Config.graphpaper2d (0, 0, R); Config.axis2d (0, 0, 320, 1.6); Axis set var ScaleX = 2*r, ScaleY = 2*r; var SpaceX = 1.5, SpaceY = 1; var XS = +, XE = 36; var YS = 0, YE = 7; Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X '); Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y '); var X = [1.9459101490553132, 2.3978952727983707, 3.044522437723423, 3.178053830347945, +, 35];var Y = 8, 4.189654742026425, 4.74493212836325, 5.783825182329737]; var array = []; var size = X.length; for (var i = 0; i < size; i++) {Array.push ([x[i], y[i]]); } var transform = new transform (); var tmp = []; Array = Transform.scale (transform.translate (array,-xs,-ys), Scalex/spacex, Scaley/spacey); TMP = [].concat (array); Shape.pointdraw (TMP, ' green '); array = []; for (var i = 0; i < size; i++) {Array.push ([x[i], Taskfun (X[i])]); } array = Transform.scale (transform.translate (array,-xs,-ys), Scalex/spacex, Scaley/spacey); TMP = [].concat (array); Shape.multilinedraw (TMP, ' red '); Plot.setfillstyle (' Blue '); Plot.filltext (' fitting results: y = 0.27203x-3.84917 ', 30,-270, 200); }} function Taskfun (x) {return 0.27203*x-3.84917;} </span>
<span style= "FONT-SIZE:18PX;" >>>> confidence level > 99.9%, k^2 = 56.631879146114834# independence Test def Tmp3 (): #数据 #[a, b] #[c, d] a = 7775;< C6/>b =; c = 2099; d =; Ksquare = (a+b+c+d) * (a*d-b*c) **2/(a+b)/(C+D)/(A+C)/(b+d); #置信度查对表 Trust = [[0.5,0.455],[0.4,0.708],[0.25,1.323],[0.15,2.072],[0.1,2.706], [0.025,5.024],[ 0.01,6.635],[0.005,7.879],[0.001,10.828]]; size = Len (trust); For I in range (size-1,-1,-1): if Ksquare >= trust[i][1]: print (' confidence > {0}%, k^2 = {1} '. Format (Round (1-t Rust[i][0]) *100, 3), ksquare)); Return trust[i][0];</span>
<span style= "FONT-SIZE:18PX;" >>>> confidence level > 99.9%, k^2 = 16.37320688824579# Independence Test # example 1def Tmp3 (): #数据 #[a, b] #[c, d] a = 214< C6/>b = 175 c = 451 d = 597 Ksquare = (a+b+c+d) * (a*d-b*c) **2/(a+b)/(C+D)/(A+C)/(b+d); #置信度查对表 Trust = [[0.5,0.455],[0.4,0.708],[0.25,1.323],[0.15,2.072],[0.1,2.706], [0.025,5.024],[ 0.01,6.635],[0.005,7.879],[0.001,10.828]]; size = Len (trust); For I in range (size-1,-1,-1): if Ksquare >= trust[i][1]: print (' confidence > {0}%, k^2 = {1} '. Format (Round (1-t Rust[i][0]) *100, 3), ksquare)); Return trust[i][0];</span>
<span style= "FONT-SIZE:18PX;" >>>> confidence level > 97.5%, k^2 = 6.109090909090909# Independence Test # 1def Tmp3 (): #数据 #[a, b] #[c, d] a = 10
b = c = D = Ksquare = (a+b+c+d) * (a*d-b*c) **2/(a+b)/(C+D)/(A+C)/(b+d); #置信度查对表 Trust = [[0.5,0.455],[0.4,0.708],[0.25,1.323],[0.15,2.072],[0.1,2.706], [0.025,5.024],[ 0.01,6.635],[0.005,7.879],[0.001,10.828]]; size = Len (trust); For I in range (size-1,-1,-1): if Ksquare >= trust[i][1]: print (' confidence > {0}%, k^2 = {1} '. Format (Round (1-t Rust[i][0]) *100, 3), ksquare)); Return trust[i][0];</span>
<span style= "FONT-SIZE:18PX;" >>>> x= [126.974, 96.933, 86.656, 63.438, 55.264, 50.976, 39.069, 36.156, 35.209, 32.416]y= [4.224, 3.835, 3.5 1, 3.758, 3.939, 1.809, 2.946, 0.359, 2.48, 2.413] fit result: y = 0.02556 x + 1.33452, r= 0.67615</span>
<span style= "FONT-SIZE:18PX;" > if (1) {var r = 20; Config.setsector (10,5,9,1); Config.graphpaper2d (0, 0, R); Config.axis2d (0, 0, 320, 1.6); Axis set var ScaleX = 2*r, ScaleY = 2*r; var SpaceX = ten, SpaceY = 1; var XS = 0, XE = 150; var YS = 0, YE = 10; Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X '); Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y '); var X = [126.974, 96.933,86.656,63.438,55.264,50.976,39.069,36.156,35.209,32.416];var Y = [ 4.224,3.835,3.510,3.758,3.939,1.809,2.946,0.359,2.480,2.413]; var array = []; var size = X.length; for (var i = 0; i < size; i++) {Array.push ([x[i], y[i]]); } var transform = new transform (); var tmp = []; Array = Transform.scale (transform.translate (array,-xs,-ys), Scalex/spacex, Scaley/spacey); TMP = [].concat (array); Shape.pointdraw (TMP, ' green '); array = []; for (var i = 0; i < size; i++) {Array.push ([x[i], Taskfun (X[i])]); } array = Transform.scale (transform.translate (array,-xs,-ys), Scalex/spacex, Scaley/spacey); TMP = [].concat (array); Shape.multilinedraw (TMP, ' red '); Plot.setfillstyle (' Blue '); Plot.filltext (' fit result: y = 0.02556*x + 1.33452 ', 30,-270, 200); } </span>
<span style= "FONT-SIZE:18PX;" > Confidence level > 90.0%, k^2 = 3.6889201613659814# Independence Test # 3def Tmp3 (): #数据 #[a, b] #[c, d] a = from B = 31
c = 8 d = Ksquare = (a+b+c+d) * (a*d-b*c) **2/(a+b)/(C+D)/(A+C)/(b+d); #置信度查对表 Trust = [[0.5,0.455],[0.4,0.708],[0.25,1.323],[0.15,2.072],[0.1,2.706], [0.025,5.024],[ 0.01,6.635],[0.005,7.879],[0.001,10.828]]; size = Len (trust); For I in range (size-1,-1,-1): if Ksquare >= trust[i][1]: print (' confidence > {0}%, k^2 = {1} '. Format (Round (1-t Rust[i][0]) *100, 3), ksquare)); Return trust[i][0];</span>
<span style= "FONT-SIZE:18PX;" >>>> x= [126.974, 96.933, 86.656, 63.438, 55.264, 50.976, 39.069, 36.156, 35.209, 32.416]y= [4.224, 3.835, 3.5 1, 3.758, 3.939, 1.809, 2.946, 0.359, 2.48, 2.413] fitting result: y = 0.02556 x + 1.33452, r= 0.67615SSG = 12.8701800999999 Close, SSE = 6.986174058384116, SSR = 5.884006041615882 residuals: [-0.356302026825019, 0.02262360033670774,-0.039669709794743824 , 0.8018423973734929, 1.1917909702046225,-0.8285966637200308, 0.6127770403049579,-1.8997591485062628, 0.24544861984106747, 0.24984492078520049] regression: [1.653002026825019, 0.885076399663292, 0.6223697097947434, 0.02885760262650683,-0.18009097020462272,-0.28970333627996947,-0.594077040304958,-0.6685408514937374,- 0.6927486198410677, -0.7641449207852009]def tmp (): X = [126.974, 96.933,86.656,63.438,55.264,50.976,39.069,36.156,3 5.209,32.416]; Y = [4.224,3.835,3.510,3.758,3.939,1.809,2.946,0.359,2.480,2.413]; A,b,r=linefit (x, y) print ("x=", X) print ("y=", Y) print ("Fit Result: y =%10.5f x +%10.5f, r=%10.5f "% (a,b,r)); size = Len (X); #平均值 average = SUM (Y)/size; SST = 0; #残差 residual = []; SSE = 0; #回归 regression = []; SSR = 0; For I in range (size): SST + = (y[i]-average) **2; value = A*x[i]+b; Residual.append (Y[i]-value); SSE + = (y[i]-value) **2; Regression.append (Value-average); SSR + = (value-average) **2; Print (' SSG = {0}, SSE = {1}, SSR = {2} '. Format (SST, SSE, SSR)); Print (' residuals: ', residual); Print (' regression: ', regression);</span>
The end of this section, to know how to funeral, please see tell.
[ab initio math] section 197th statistical cases