stats.RdVarious summary statistics are calculated for different types of data.
stats(x, by)A matrix where rows index the summary statistics and the columns index the separate data sets.
Stats breaks x up into separate data sets and then calls describe to calculate the statistics. Statistics are found by columns for matrices, by components for a list and by the relevent groups when a numeric vector and a by vector are given. The default set of statistics are the number of (nonmissing) observations, mean, standard deviation, minimum, lower quartile, median, upper quartile, maximum, and number of missing observations. If any data set is nonnumeric, missing values are returned for the statistics. The by argument is a useful way to calculate statistics on parts of a data set according to different cases.
stats.bin, stats.bplot, describe
#Statistics for 8 normal random samples:
zork<- matrix( rnorm(200), ncol=8)
stats(zork)
#> [,1] [,2] [,3] [,4] [,5]
#> N 25.00000000 25.00000000 25.00000000 25.0000000 25.0000000
#> mean -0.17729525 -0.08378573 -0.06377449 -0.5520176 0.1323724
#> Std.Dev. 1.15437576 1.03592505 0.85344325 1.2219338 1.0436412
#> min -2.43644850 -2.85256555 -1.89273784 -2.4812680 -1.9353289
#> Q1 -0.94335217 -0.75275976 -0.49172092 -1.2090876 -0.8556223
#> median -0.01831535 -0.48777810 -0.17264923 -0.7643508 0.5419990
#> Q3 0.44376250 0.79448481 0.29800147 -0.1141085 1.0752065
#> max 2.08752090 1.58777168 1.69904541 3.5504357 1.3602039
#> missing values 0.00000000 0.00000000 0.00000000 0.0000000 0.0000000
#> [,6] [,7] [,8]
#> N 25.0000000 25.0000000 25.00000000
#> mean -0.4687859 0.0273689 0.05851281
#> Std.Dev. 1.1693497 1.1323907 1.01521151
#> min -2.1285517 -2.4176001 -1.56710227
#> Q1 -1.5095787 -0.5036960 -0.56710187
#> median -0.5940140 -0.1910721 -0.15413497
#> Q3 0.3771107 0.6811354 0.52991330
#> max 2.1425132 2.3011148 2.93435060
#> missing values 0.0000000 0.0000000 0.00000000
zork<- rnorm( 200)
id<- sample( 1:8, 200, replace=TRUE)
stats( zork, by=id)
#> 8 7 4 2 3
#> N 25.0000000 26.00000000 26.00000000 19.00000000 25.000000000
#> mean -0.2185388 0.02357975 0.01916595 -0.52795076 -0.006982905
#> Std.Dev. 1.0157656 0.95627782 1.13857224 1.08589863 1.081971507
#> min -2.5359998 -2.08175690 -2.26684863 -2.77373862 -2.059814886
#> Q1 -0.7028142 -0.43382396 -0.70178573 -1.02599751 -0.778920807
#> median -0.2616115 -0.03716271 -0.26453084 -0.67543897 0.040802052
#> Q3 0.4129530 0.37495109 0.86766862 -0.01729493 0.663295196
#> max 1.4436810 1.95046055 2.24932428 1.96981998 2.037719789
#> missing values 0.0000000 0.00000000 0.00000000 0.00000000 0.000000000
#> 6 1 5
#> N 39.00000000 24.00000000 16.00000000
#> mean -0.03895461 0.05378631 -0.43021987
#> Std.Dev. 0.99150961 1.04939864 1.04122228
#> min -2.74058490 -1.39860568 -2.49843122
#> Q1 -0.68271303 -0.67082284 -1.17242928
#> median -0.05848458 -0.01863278 -0.51510685
#> Q3 0.60819037 0.45546625 0.04462164
#> max 1.77568656 2.78355167 1.87018508
#> missing values 0.00000000 0.00000000 0.00000000