From: Mario R. R. <rio...@us...> - 2014-03-28 18:14:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Maxima CAS". The branch, master has been updated via 94e376ca35fc3d58e11b7ad4902ee00e73096dfd (commit) from fafd8042945e207a8f84eaf5c6363abdc0d1f8ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 94e376ca35fc3d58e11b7ad4902ee00e73096dfd Author: Mario Rodriguez <rio...@us...> Date: Fri Mar 28 19:13:35 2014 +0100 rtests for descriptive (by Litvinov Sergey) diff --git a/share/descriptive/rtest_descriptive.mac b/share/descriptive/rtest_descriptive.mac new file mode 100644 index 0000000..a2dda3f --- /dev/null +++ b/share/descriptive/rtest_descriptive.mac @@ -0,0 +1,261 @@ +(kill(all), 0); +0$ + +(load(descriptive), 0); +0$ + +mean([a, b, c]); +(c+b+a)/3$ + +mean(matrix([a, b], [c, d], [e, f])); +[(e+c+a)/3,(f+d+b)/3]$ + +(s1 : read_list(file_search ("pidigits.data")), mean(s1)); +471/100$ + +(s2 : read_matrix(file_search ("wind.data")), mean(s2)); +[9.9485,10.1607,10.8685,15.7166,14.8441]$ + +var(s1); +84259/10000$ + +var1(s1); +84259/9900$ + +var1(s2); +[17.39586540404041,15.13912778787879,15.63204924242424, + 32.50152569696971,24.66977392929294]$ + +std(s1); +sqrt(84259)/100$ + +std(s2); +[4.149928523480858,3.871399812729241,3.933920277534866, + 5.672434260526957,4.941970881136392]$ + +std1(s1); +sqrt(84259)/(30*sqrt(11))$ + +std1(s2); +[4.17083509672109,3.89090320978032,3.953738641137555,5.701010936401517, + 4.966867617451963]$ + +noncentral_moment(s1, 1); +471/100$ + +noncentral_moment(s2, 1); +[9.9485,10.1607,10.8685,15.7166,14.8441]$ + +central_moment(s1, 2); +84259/10000$ + +central_moment(s2, 3); +[11.29584771375004,16.97988248298583,5.626661952750102, + 37.5986572057918,25.85981904394192]$ + +cv(s1); +sqrt(84259)/471$ + +cv(s2); +[0.4171411291632767,0.3810170374806106,0.3619561372346568, + 0.3609199356430116,0.3329249251309538]$ + +smin(s1); +0$ + +smin(s2); +[0.58,0.5,2.67,5.25,5.17]$ + +smax(s1); +9$ + +smax(s2); +[20.25,21.46,20.04,29.63,27.63]$ + +range(s1); +9$ + +range(s2); +[19.67,20.96,17.37,24.38,22.46]$ + +[quantile(s1, 1/4), quantile (s1, 3/4)]; +[2,29/4]$ + +[quantile(s2, 1/4), quantile (s2, 3/4)]; +[[7.2575,7.477500000000001,7.82,11.28,11.48], + [12.6425,13.05,13.8425,20.01,18.13]]$ + +median(s1); +9/2$ + +median(s2); +[10.06,9.855,10.73,15.48,14.105]$ + +qrange(s1); +21/4$ + +qrange(s2); +[5.385,5.572499999999998,6.0225,8.729999999999999,6.649999999999999]$ + +mean_deviation(s1); +51/20$ + +mean_deviation(s2); +[3.287959999999999,3.075342,3.23907,4.715664000000001,4.028546000000002]$ + +median_deviation(s1); +5/2$ + +median_deviation(s2); +[2.75,2.755,3.08,4.315,3.31]$ + +harmonic_mean([5, 7, 2, 5, 9, 5, 6, 4, 9, 2, 4, 2, 5]); +8190/2099$ + +harmonic_mean(s2); +[6.948015590052786,7.391967752360356,9.055658197151745, + 13.44199028193692,13.01439145898509]$ + +geometric_mean([5, 7, 2, 5, 9, 5, 6, 4, 9, 2, 4, 2, 5]); +272160000^(1/13)$ + +geometric_mean(s2); +[8.82476274347979,9.22652604739361,10.0442675714889,14.61274126349021, + 13.96184163444275]$ + +kurtosis(s1); +-9039524486/7099579081$ + +kurtosis(s2); +[-0.2715445622195385,0.119998784429451,-0.4275233490482866, + -0.6405361979019522,-0.4952382132352935]$ + +skewness(s1); +224922/84259^(3/2)$ + +skewness(s2); +[0.1580509020000979,0.2926379232061854,0.09242174416107717, + 0.2059984348148687,0.2142520248890832]$ + +pearson_skewness(s1); +189*sqrt(11)/(10*sqrt(84259))$ + +pearson_skewness(s2); +[-0.08019976629211892,0.2357036272952649,0.1050904062491204, + 0.1245042340592368,0.4464181795804519]$ + +quartile_skewness(s1); +1/21$ + +quartile_skewness(s2); +[-0.0408542246982353,0.1467025572005382,0.0336239103362392, + 0.03780068728522298,0.2105263157894735]$ + +cov(s2); +matrix([17.22190675000003,13.61811305000002,14.37216775000002, + 19.39623590000002,15.42162414999993], + [13.61811305000002,14.98773650999988,13.30448104999995, + 15.15833837999995,14.97109813], + [14.37216775000002,13.30448104999995,15.47572875000003, + 17.32543690000006,16.18170714999994], + [19.39623590000002,15.15833837999995,17.32543690000006, + 32.17651043999993,20.44684694], + [15.42162414999993,14.97109813,16.18170714999994,20.44684694, + 24.42307619000002])$ + +cov1(s2); +matrix([17.39586540404044,13.75566974747477,14.51734116161618, + 19.5921574747475,15.57739813131306], + [13.75566974747477,15.13912778787867,13.4388697474747, + 15.31145290909086,15.12232134343435], + [14.51734116161618,13.4388697474747,15.63204924242427, + 17.50044131313137,16.34515873737368], + [19.5921574747475,15.31145290909086,17.50044131313137, + 32.50152569696963,20.65338074747475], + [15.57739813131306,15.12232134343435,16.34515873737368, + 20.65338074747475,24.66977392929295])$ + +global_variances(s2); +[105.338342060606,21.06766841212119,12874.34690469686,113.4651792608501, + 6.636590811800794,2.576158149609762]$ + +cor(s2); +matrix([0.9999999999999999,0.8476338537640531,0.8803514956141143, + 0.8239623533344873,0.7519506093997077], + [0.8476338537640531,1.0,0.8735833741501071,0.6902622161735914, + 0.7825019890410442], + [0.8803514956141142,0.8735833741501071,1.0,0.7764065117828751, + 0.8323358495832834], + [0.8239623533344873,0.6902622161735915,0.7764065117828751,1.0, + 0.7293847728156051], + [0.7519506093997078,0.7825019890410442,0.8323358495832834, + 0.7293847728156051,0.9999999999999999])$ + +list_correlations(s2); + [matrix([0.3848556822758882,-0.138560101587963,-0.1562648597903809, + -0.102390587242044,0.03117928520552016], + [-0.1385601015879629,0.3410745439686317,-0.1523316288476424, + 0.03844715039676187,-0.05284247734522295], + [-0.1562648597903812,-0.1523316288476423,0.4729580534793429, + -0.02481583049369053,-0.1005374388312373], + [-0.1023905872420438,0.0384471503967619,-0.02481583049369072, + 0.1093657733582761,-0.0340329624571618], + [0.0311792852055202,-0.05284247734522302,-0.1005374388312372, + -0.03403296245716185,0.1483436744385358]), + [0.8506325186059345,0.8063355806655949,0.8647424674282196, + 0.7186707921004887,0.7267464592542312], + matrix([-1.0,0.3824411257726334,0.3662697588649121,0.4990802317419231, + -0.1304916392931289], + [0.3824411257726332,-1.0,0.3792749151468401, + -0.1990667787299206,0.2349221680600234], + [0.3662697588649129,0.3792749151468399,-0.9999999999999998, + 0.109113073041974,0.3795613554674849], + [0.4990802317419226,-0.1990667787299208,0.1091130730419749, + -1.0,0.267192660519117], + [-0.1304916392931291,0.2349221680600237,0.3795613554674845, + 0.2671926605191174,-1.0])]$ + +principal_components(s2); +[[87.5689103150044,8.753405888856824,5.514842042315632, + 1.888527946359889,1.612655868069173], + [83.13108845459334,8.30980032305862,5.235360586122282, + 1.792821027383679,1.530929608842086], + matrix([0.4149313791478684,0.03378709673974772,-0.4756919435090896, + -0.5810494628723252,-0.5126295731507049], + [0.3690402507783501,-0.3656690416147942,-0.4297594804400433, + 0.7237468707135304,-0.1469445521761402], + [0.3959227853488706,-0.2178353948197818,-0.2181101723256928, + -0.2749400278061583,0.820139514133606], + [0.554792311834466,0.7744297760037389,0.1857057299675782, + 0.231851193538861,0.06498014065837293], + [0.4765415854622357,-0.4668520610438869,0.7120149566109651, + -0.09604683228877862,-0.1968933162750588])]$ + +/* DATA MANIPULATION */ + +continuous_freq (s1, 5); +[[0,9/5,18/5,27/5,36/5,9],[16,24,18,17,25]]$ + +continuous_freq (s1, [-2,12,7]); +[[-2,0,2,4,6,8,10,12],[8,20,22,17,20,13,0]]$ + +continuous_freq (s1, [-2,12]); +[[-2,-3/5,4/5,11/5,18/5,5,32/5,39/5,46/5,53/5,12],[0,8,20,12,18,9,8,25, + 0,0]]$ + +discrete_freq (s1); +[[0,1,2,3,4,5,6,7,8,9],[8,8,12,12,10,8,9,8,12,13]]$ + +part(standardize(s1), [1, 10, 20]); +[-171/sqrt(84259),-171/sqrt(84259),-71/sqrt(84259)]$ + +subsample (s2, lambda([v], v[1] > 18)); +matrix([19.38,15.37,15.12,23.09,25.25],[18.29,18.66,19.08,26.08,27.63], + [20.25,21.46,19.95,27.71,23.38],[18.79,18.96,14.46,26.38,21.84])$ + +subsample (s2, g, 1, 2, 5), g(x):= first(x) >= 16 and fourth(x) < 25; +matrix([19.38,15.37,25.25],[17.33,14.67,19.58],[16.92,13.21,21.21], + [17.25,18.46,23.87])$ + +transform_sample(data, [a,b,c], [c, a*b, log(a)]), data: matrix([3,2,7],[3,7,2],[8,2,4],[5,2,4]); +matrix([7,6,log(3)],[2,21,log(3)],[4,16,log(8)],[4,10,log(5)])$ diff --git a/share/descriptive/rtest_statgraph.mac b/share/descriptive/rtest_statgraph.mac new file mode 100644 index 0000000..2e70c3b --- /dev/null +++ b/share/descriptive/rtest_statgraph.mac @@ -0,0 +1,136 @@ +/* execute this script + * + * (1) wait for user between examples: + * demo ("rtest_statgraph.mac") + * + * (2) or noninteractively: + * batch ("rtest_statgraph.mac"); + * + * Maxima waits for the user to close the Openmath window + * before proceeding, but otherwise it just blazes through. + */ + +load("descriptive"); +load("distrib"); + +barsplot( + col(m,2), + title = "Ages", + xlabel = "years", + box_width = 1/2, + fill_density = 3/4), m : read_matrix (file_search ("biomed.data")); + + +barsplot( + l1,l2, + box_width = 1, + fill_density = 1, + bars_colors = [black, grey], + frequency = relative, + sample_keys = ["A", "B"]), + l1:makelist(random(10),k,1,50), + l2:makelist(random(10),k,1,100); + + +barsplot( + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + title = "Asking for something to four groups", + ylabel = "# of individuals", + groups_gap = 3, + fill_density = 0.5, + ordering = ordergreatp); + +barsplot( + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + makelist([Yes, No, Maybe][random(3)+1],k,1,50), + title = "Asking for something to four groups", + ylabel = "# of individuals", + grouping = stacked, + fill_density = 0.5, + ordering = ordergreatp); + +block([l1:makelist(random(10),k,1,50), + l2:makelist(random(10),k,1,100), + bp1, bp2], + bp1 : + barsplot_description( + l1, + box_width = 1, + fill_density = 0.5, + bars_colors = [blue], + frequency = relative), + bp2 : + barsplot_description( + l2, + box_width = 1, + fill_density = 0.5, + bars_colors = [red], + frequency = relative), + draw(gr2d(bp1), gr2d(bp2))); + + +boxplot(s2, + box_width = 0.2, + title = "Windspeed in knots", + xlabel = "Stations", + color = red, + line_width = 2), s2 : read_matrix(file_search("wind.data")); + +boxplot (A, box_orientation = horizontal), A : + [[6, 4, 6, 2, 4, 8, 6, 4, 6, 4, 3, 2], + [8, 10, 7, 9, 12, 8, 10], + [16, 13, 17, 12, 11, 18, 13, 18, 14, 12]]; + + +histogram ( + s1, + nclasses = 8, + title = "pi digits", + xlabel = "digits", + ylabel = "Absolute frequency", + fill_color = grey, + fill_density = 0.6), s1 : read_list (file_search ("pidigits.data")); + +block([m: 14, s: 2, s2], + s2: random_normal(m, s, 1000), + draw2d( + grid = true, + xrange = [5, 25], + histogram_description( + s2, + nclasses = 9, + frequency = density, + fill_density = 0.5), + explicit(pdf_normal(x,m,s), x, m - 3*s, m + 3* s))); + +piechart( + s1, + xrange = [-1.1, 1.3], + yrange = [-1.1, 1.1], + title = "Digit frequencies in pi"), s1 : read_list (file_search ("pidigits.data")); + +scatterplot( + random_normal(0,1,200), + xaxis = true, + point_size = 2, + dimensions = [600,150])$ + +block([l1: makelist(random(10),k,1,50), + l2: makelist(random(10),k,1,200)], + starplot( + l1, l2, + stars_colors = [blue,red], + sample_keys = ["1st sample", "2nd sample"], + star_center = [1,2], + star_radius = 4, + proportional_axes = xy, + line_width = 2 )); + +stemplot( + random_normal(15, 6, 100), + leaf_unit = 0.1); diff --git a/share/share_testsuite.mac b/share/share_testsuite.mac index 2bffac5..b3fc068 100644 --- a/share/share_testsuite.mac +++ b/share/share_testsuite.mac @@ -49,6 +49,8 @@ block rtest_opproperties, rtest_stats, rtest_distrib, + rtest_descriptive.mac, + rtest_statgraph.mac, rtest_interpol, rtest_levin, rtest_fractals, ----------------------------------------------------------------------- Summary of changes: share/descriptive/rtest_descriptive.mac | 261 +++++++++++++++++++++++++++++++ share/descriptive/rtest_statgraph.mac | 136 ++++++++++++++++ share/share_testsuite.mac | 2 + 3 files changed, 399 insertions(+), 0 deletions(-) create mode 100644 share/descriptive/rtest_descriptive.mac create mode 100644 share/descriptive/rtest_statgraph.mac hooks/post-receive -- Maxima CAS |