Descriptive statistics:
First hand tools which gives first hand information
Graphical as well as analytical tools are used.First hand tools which gives first hand information
- Central tendency of data
- Variation in data
- Structure and shape of data tendency
- Relationship study
Absolute and relative frequencies:
Suppose there are 10 persons coded into two categories as male (M) and female (F).
M, F, M, F, M, M, M, F, M, M,
Use a1 and a2 to refer to male and female categories.
There are 7 male and 3 female persons, denoted as n1 = 7 and n2 = 3
The number of observations in a particular category is called the absolute frequency.
The relative frequencies of a1 and a2 are
f1 = n1/ n1 + n2
= 7/10
= 0.7
= 70%
f2 = n2/n1 + n2
= 3/10
= 0.3
= 30%
This gives us information about the propotions of male and female persons.
table (variable) create the sample frequency of the variable of the data file.
Enter data as x
table (x) # absolute frequencies
table (x) / length (x) # relative frequencies
Example: Code the 10 persons by using, say 1 for male (M and 2 for female (F).
M, F, M, F, M, M, M, F, M, M
1, 2, 1, 2, 1, 1, 1, 2, 1, 1
> gender <- c(1, 2, 1, 2, 1, 1, 1, 2, 1, 1)
>gender
[1] 1 2 1 2 1 1 1 2 1 1
> table (gender) # Absolute frequencies
gender
1 2
7 3
> table (gender) / length (gender) #Relative freq. gender
1 2
0.7 0.3
Example:
'Pizza_delivery.csv' contains the simulated data on pizza home delivery.
- There are three branches (East, West, Central) of the restaurant.
- The pizza delivery in centrally managed over phone and delivered by one of the five drivers.
- The data set captures the number of pizzas ordered and the final bill.
> pizza <- read.csv (' pizza_delivery.csv ' )
Example :
Consider data from pizza. Take first 100 values from Direction and code Directions as
- East: 1
- West: 2
- Center: 3
Partition values:
Such values divides the total frequency given data into required number of partitions.
Quartile: Divides the data into 4 equal parts.
Decile: Divides the data into 10 equal parts.
Percentile: Divides the data into 100 equal parts.
quantile function computes quantiles corresponding to the given probabilities.
The smallest observation corresponds to a probability of 0 and thr largest to a probability of 1.
quantile (x, . . . .)
quantile(x, probs = seq(0, 1, 0.25, . . .)
Arguments
x numeric vector whose sample quantile are wanted,
probs numeric vector of probabilities with values in [0,1].
Example: Marks of 15 students are