Descriptive Analytics
Descriptive Analytics
It involves gathering,
organizing, tabulating and
depicting data and then
describing the characteristics
about what is being studied.
This type of analytics was
historically called reporting. It
can be very useful but does
not tell you anything about
what might have happen in the future.
The vast majority of the analytics we use fall into this category. (Think basic
arithmetic like sums, averages, percent changes). Usually, the underlying
data is a count, or aggregate of a filtered column of data to which basic
math is applied. For all practical purposes, there are an infinite number of
these Analytics. Descriptive Analytics are useful to show things like, total
stock in inventory, average dollars spent per customer and Year over year
change in sales. Common examples of descriptive analytics are reports that
provide historical insights regarding the company’s production, financials,
operations, sales, finance, inventory and customers.
Slide 3:
Tabulation:
R provides many methods for creating frequency and contingency tables. Three are
described below. In the following examples, assume that A, B, and C represent categorical
variables.
Table
You can generate frequency tables using the table( ) function, tables of proportions using
mtcars
nrow(mtcars)
table(mtcars$cyl)
mtcars%>%count(cyl)
x=mtcars%>%count(cyl)
x$prop=(x$n)/32
x
x$per=((x$n)/32)*100
x$cum=cumsum(x$n)
x
Crosstable
The CrossTable( ) function in the gmodels package produces cross tabulations
modelled after PROC FREQ in SAS or CROSSTABS in SPSS. It has a wealth of
options.
There are options to report percentages (row, column, cell), specify decimal places,
produce Chi-square, Fisher, and McNemar tests of independence, report expected
and residual values (pearson, standardized, adjusted standardized), include missing
values as valid, annotate with row and column titles, and format
as SAS or SPSS style output. See help(CrossTable) for details.
# cross tabulations
CrossTable(mtcars$cyl,mtcars$vs) # gmodels package