ALY 6000
Northeastern University
Oladimeji Adegoke
Project 2 Report
Instructor: Prof Dee Chiliuza


INTRODUCTION


Task 1:Importance of descriptive and inferential statistics


Descriptive statistics can be defined as information or characteristics that report a given set of data or sample of the entire population, this statement summarizes feature, characteristics of the data set, it involves the use of numerical and graphical methods , while inferential statistics is used to arrive at a conclusion and make predictions on a data set.


Importance of Descriptive statistics


1. Descriptive statistics help to summarize data,they provide measures such as mean, median, mode, range, and percentiles to capture the central tendency and variability of data.


2. It provide visual representations of data, such as histograms, box plots, and scatter plots, help convey the distribution and patterns within data.


3. It provides insight to data before analyzing


4. Information in descriptive statistics, reflects the information required for the entire population


5. It is more accurate and factual


Importance of Inferential Statistics


1. Saves cost and time of getting data from a large population by making inference from sample of the population.


2. Inferential statistics makes use of a sample of the population to predict the entire population 3. Inferential statistics allow researchers to generalize findings from a sample to a larger population. This is critical when it’s impractical to collect data from an entire population

Reference: Triola, M. F. (2017). Elementary Statistics. Pearson.



Task 2: Importance of proper data presentation


Proper data presentation is very important in various fields, including business, research, and education, manufacturing and decision-making. It helps to convey information accurately to the audience. The following are the importance of proper data presentation:

Clarity and Understanding: Proper data presentation enhances clarity and understanding. It helps the audience breakdown complex information by organizing and structuring data in a coherent and logical manner. It prevents risk of misinterpretation.

Effective Communication: Data is often used to communicate findings, trends, and insights. Effective data presentation ensures that the intended message is communicated accurately to the audience, leading to informed decision-making.

Enhance Decision-Making: Decision-makers depends on data to make informed decisions. Well-articulated data provides decision-makers with the necessary information to assess options, risks, and potential outcomes, ultimately leading to better decisions.

Engagement: Properly presented data is more engaging and captures the audience’s attention. Engaged viewers are more likely to absorb and retain information, making data more interesting.

Professionalism: Whether in business reports, academic papers, or professional data presentation show competence and expertise. It enhances the credibility.

Reference: Tufte, E. R. (2001). “The Visual Display of Quantitative Information



Task 3: Mention some practical applications of R in data analysis


• R can be used to find the average value of a data set


• R can be used to find the most frequent value in a data set


• R can be used to determine distribution of data


• R can be used to plot graphs to visually demonstrate data analysis


• Data file such as Excel, PDF, CVS and other files can be imported into R for further analysis.

https://adv-r.hadley.nz/



ANALYSIS SECTION
#These are the library used in this document
library(rmarkdown)
library(readxl) 
library(readr)      
library(tidyverse)
library(dplyr)      
library(knitr)
library(magrittr)    
library(RColorBrewer)
library(ggplot2)

library(readxl)
M2Project_Data_2023 <- read_excel("M2Project_Data_2023.xlsx")
M2Data<-read_excel("M2Project_Data_2023.xlsx")

TASK 1 First 5 and Last 5 values of dataset

head(M2Data$Quantity)
## [1] 2 9 9 5 8 5
tail(M2Data$Quantity)
## [1]  4  7  1  2 10  3
a<-head(M2Data$Quantity)
b<-tail(M2Data$Quantity)
rbind(a,b,deparse.level = 1)
##   [,1] [,2] [,3] [,4] [,5] [,6]
## a    2    9    9    5    8    5
## b    4    7    1    2   10    3
c<-rbind(a,b,deparse.level = 1)
knitr::kable(c,format="pipe",caption ="Quantity",align="c",font=24,table.envir="table")
Quantity
a 2 9 9 5 8 5
b 4 7 1 2 10 3
#Observation
#The head() function displays the first few rows of the Quantity column from the M2Data dataset. 
#It provides a view of initial data values."
#The tail() function displays the last few rows of the Quantity column from the M2Data dataset. 
#It shows the final data values

TASK 2

#Table with all categories of market and frequencies

Market <- table(M2Data$Market)
Market
## 
##       Africa Asia Pacific       Europe        LATAM         USCA 
##           54          365          248          133          200
knitr::kable(Market,caption = "Countries",col.names=c("Market","Frequency"), align = "c",format="html",table.attr='class="table table-striped"')
Countries
Market Frequency
Africa 54
Asia Pacific 365
Europe 248
LATAM 133
USCA 200
#Observation
#The Market is being categorized into  five (Africa, Asia, Europe, LATAM and USCA) the table displays the frequency of distribution in different markets in the M2Data dataset. It shows the number of occurrences which is the frequency of each market category in the dataset.


TASK 3
#Bar graph with all market categories and frequency

data<-data.frame(Market=c("Africa","Asia pacific","Europe","LATAM","USCA"),frequency=c(54,365,248,133,200))

data=barplot(Market,main="Global market",xlab="markets",ylab = "frequency",col = c("pink", "green",  "azure", "red","purple"),ylim=c(0,500))

#This bar plot represents the global market distribution by frequency for different market categories, including Africa, Asia Pacific, Europe, LATAM (Latin America), and USCA .
#Each market category is represented by a colored bar, and the height of each bar corresponds to the frequency of that market in the dataset.In the global market Africa records the lowest frequency, followed by LATAM

TASK 4
data<-data.frame(Market=c("Africa","Asia pacific","Europe","LATAM","USCA"),frequency=c(54,365,248,133,200))
african_market <- data %>%
  filter(Market=="Africa")
pdf("african_market.pdf")
print(african_market)
##   Market frequency
## 1 Africa        54
t4Africa <- dplyr::filter(M2Data, Market == "Africa")
africa_summary <- t4Africa %>%
  group_by(Product_Category) %>%
  summarise(Frequency = n())
pie(africa_summary$Frequency,labels = africa_summary$Product_Category,main = "Product Categories in Africa Market")

#Observation
#This table is useful for understanding which product categories are prevalent in the African market and their relative frequencies.

TASK 5
#Create a table
task5_table=table(t4Africa$Product_SubCategory)

#plot a table using a bar plot
t5bar=barplot(task5_table)

#use text to show value per column
text(y=table(t4Africa$Product_SubCategory),t5bar,table(t4Africa$Product_SubCategory),cex=0.8,pos=3)

#The bar plot graph shows the distribution of data in the product subcategory of the African Market, phones is the highest in this product category

TASK 6
task5_table <- table(t4Africa$Product_SubCategory)
par(mar = c(4, 5, 3, 1))
barplot(task5_table,col=rainbow(length(task5_table)),main="Product SubCategory Frequencies in Africa Market",xlab="Product SubCategory",ylab="Frequency",las = 2,ylim = c(0, max(task5_table) + 5))
text(x = t5bar, y = task5_table + 1, labels = task5_table, cex = 0.8, pos = 3)

par(mar = c(5, 4, 4, 2))
#The bar plot above shows frequency of different product category in the African market

TASK 7

par(mar = c(2, 0, 2, 1))

mean_sales_per_subcategory <- tapply(t4Africa$Sales, t4Africa$Product_SubCategory, mean)
knitr::kable(t4Africa,format="html",font=3,digits = 1)
Region Market Company_Segment Product_Category Product_SubCategory Price Quantity Sales Profits ShippingCost
Western Africa Africa Consumer Technology Copiers 2833.0 8 22663.7 311.5 903.0
Eastern Africa Africa Consumer Office Supplies Appliances 3409.7 6 20458.4 818.3 763.4
Central Africa Africa Corporate Technology Phones 3817.3 6 22903.6 1068.7 678.1
Eastern Africa Africa Corporate Technology Phones 2582.2 4 10328.6 593.9 627.2
Central Africa Africa Consumer Furniture Chairs 3808.8 8 30470.4 1523.5 588.1
North Africa Africa Corporate Technology Copiers 5301.2 14 74217.4 2597.3 568.5
North Africa Africa Home Office Office Supplies Appliances 2266.4 4 9065.8 113.3 556.5
Central Africa Africa Consumer Technology Phones 3856.1 6 23136.8 1465.2 534.0
Eastern Africa Africa Consumer Technology Phones 3834.0 6 23004.0 268.4 481.0
Southern Africa Africa Home Office Office Supplies Storage 2784.6 14 38984.4 779.5 422.2
Southern Africa Africa Home Office Office Supplies Appliances 1237.6 4 4950.2 606.4 400.0
North Africa Africa Consumer Technology Phones 1274.7 2 2549.4 140.2 400.0
North Africa Africa Home Office Furniture Bookcases 2615.9 6 15695.6 1072.4 384.4
Southern Africa Africa Corporate Technology Phones 2544.6 4 10178.4 814.2 383.0
Southern Africa Africa Corporate Technology Copiers 3799.1 12 45589.0 455.8 369.7
Western Africa Africa Corporate Technology Phones 3908.9 6 23453.3 1563.5 363.2
Central Africa Africa Consumer Office Supplies Appliances 1840.7 6 11044.1 497.0 359.6
Southern Africa Africa Consumer Technology Phones 2550.0 4 10200.0 714.0 355.9
Central Africa Africa Consumer Furniture Bookcases 2478.6 6 14871.6 49.5 349.9
Central Africa Africa Consumer Technology Phones 2549.8 4 10199.0 1172.9 336.6
Western Africa Africa Consumer Office Supplies Appliances 1239.0 4 4956.0 0.0 327.9
Eastern Africa Africa Corporate Office Supplies Storage 856.8 14 11995.2 265.4 321.2
Central Africa Africa Consumer Technology Accessories 976.1 4 3904.3 292.8 316.7
Eastern Africa Africa Home Office Furniture Tables 2134.4 4 8537.8 682.9 315.6
Southern Africa Africa Corporate Technology Machines 1867.5 6 11205.0 242.6 314.8
Central Africa Africa Consumer Technology Phones 3908.9 6 23453.3 1563.5 313.3
Western Africa Africa Consumer Technology Copiers 1429.4 4 5717.8 471.6 304.5
Southern Africa Africa Corporate Furniture Tables 1057.8 2 2115.6 158.6 304.4
Central Africa Africa Home Office Office Supplies Storage 1288.8 10 12888.0 90.0 296.1
Southern Africa Africa Consumer Technology Accessories 1464.1 6 8784.7 439.2 293.1
Eastern Africa Africa Home Office Technology Machines 1519.9 6 9119.5 653.4 286.2
North Africa Africa Corporate Office Supplies Appliances 1234.6 4 4938.2 246.8 284.7
North Africa Africa Consumer Technology Phones 2544.6 4 10178.4 1246.8 279.1
Southern Africa Africa Corporate Furniture Bookcases 889.0 6 5334.1 320.0 267.6
North Africa Africa Corporate Technology Phones 1457.3 8 11658.2 568.3 262.7
Central Africa Africa Consumer Technology Machines 1018.3 4 4073.3 183.2 255.7
North Africa Africa Consumer Furniture Tables 2880.2 6 17281.1 115.2 250.1
Eastern Africa Africa Corporate Office Supplies Appliances 553.4 8 4427.5 16.6 246.1
North Africa Africa Corporate Technology Accessories 1553.8 6 9322.6 730.3 245.6
Central Africa Africa Consumer Furniture Bookcases 1660.8 4 6643.2 83.0 244.1
Central Africa Africa Consumer Furniture Tables 3877.7 8 31021.4 930.5 242.9
North Africa Africa Consumer Technology Machines 613.3 2 1226.5 202.3 241.3
North Africa Africa Consumer Office Supplies Appliances 2243.9 4 8975.5 246.7 238.9
Southern Africa Africa Consumer Technology Machines 1885.3 6 11311.9 18.7 238.2
Eastern Africa Africa Consumer Furniture Chairs 1854.7 4 7418.9 778.9 236.3
Western Africa Africa Home Office Furniture Chairs 1669.2 12 20031.0 -1558.2 234.8
Western Africa Africa Home Office Technology Machines 1253.8 4 5015.0 200.5 234.1
Southern Africa Africa Corporate Furniture Bookcases 2182.7 6 13096.1 327.2 232.2
Central Africa Africa Corporate Furniture Bookcases 1752.6 4 7010.4 455.6 228.7
Western Africa Africa Consumer Technology Copiers 1767.6 12 21211.2 0.0 226.7
Central Africa Africa Consumer Technology Accessories 976.1 4 3904.3 292.8 217.6
Western Africa Africa Consumer Technology Phones 1377.9 10 13779.0 289.2 215.0
North Africa Africa Home Office Technology Copiers 2280.6 6 13683.6 136.8 210.7
Eastern Africa Africa Consumer Technology Copiers 642.7 2 1285.4 224.9 205.7
dotchart(t4Africa$Sales,labels = t4Africa$Product_SubCategory,cex = 0.6,pch = 15,main = "Dot Plot of Sales in African Market by Subcategory",xlab = "Sales",ylab = "Product SubCategory",color = "blue",font=5)


TASK 8
tapply(t4Africa$Sales, t4Africa$Region,sum)
##  Central Africa  Eastern Africa    North Africa Southern Africa  Western Africa 
##        205523.8         96575.4        178792.3        161749.4        116827.0
total_sales_per_region<-tapply(t4Africa$Sales, t4Africa$Region,sum)

barplot(total_sales_per_region,col =rainbow(length(total_sales_per_region)),main = "Total Sales per Region in African Market",xlab = "Region",ylab = "Total Sales",names.arg = names(total_sales_per_region),ylim = c(0, max(total_sales_per_region) + 500))
text(x = 1:length(total_sales_per_region), y = total_sales_per_region + 50, 
     labels = total_sales_per_region, pos = 3, cex = 0.8)

#Observation
#From the bar plot above Asia pacific records the lowest sales of 96575.4, compared to Central Africa recording the highest sales, followed by North Africa and LATAM respectively on the graph, this graph is telling us we need to leverage on the high sales volume in central Africa and identify why we are having a low sales turnover in Asia pacific.

TASK 9
mean_ship_costs_per_region <- tapply(t4Africa$ShippingCost, t4Africa$Region, mean)

barplot(mean_ship_costs_per_region, col = rainbow(length(mean_ship_costs_per_region)),main = "Mean Ship Costs per Region in Africa",xlab = "Region",ylab = "Mean Ship Cost",names.arg = names(mean_ship_costs_per_region),ylim = c(0, max(mean_ship_costs_per_region) + 50))

text(x = 1:length(mean_ship_costs_per_region), y = mean_ship_costs_per_region + 5, 
     labels = round(mean_ship_costs_per_region, 2), pos = 3, cex = 0.8)

#Observation
# Asia pacific shows the highest shipping cost of $386.96 from the bar plot above, this graph is telling us that we are incurring more cost to that region, we can consider alternative delivery option to save cost and increase profit.

TASK 10

Describe integer, factor, double, numeric.

Integer: An integer is a whole number without any decimal part. It can be used to represent discrete numerical values. Integers are typically used for counting and indexing or when a value can only take on specific integer values.

Factor: Factor is a data type used to represent categorical variables, Categorical variables has a limited number of distinct categories or levels. Factors are used to store and manipulate categorical data. Factors are created using the factor () function. Factors are particularly useful for data analysis, as they enable efficient storage and analysis of categorical data.

Double: Double is a data type used to represent real numbers with decimal points.Doubles are used for continuous numerical data, where values can take on any real number within a specified range.

Numeric: The term numeric in R is often used interchangeably with “double.” Both refer to the same data type for representing real numbers with decimal points. When you create a numeric variable in R, it is treated as a double by default. Numeric data can be values like 3.14 or 123.456.

References: Wickham, H. (2019). Advanced R. CRC Press https://adv-r.hadley.nz.


TASK 11
par(mfcol=c(1,1),
    mai=c(1,1,0.2,0.4),
    mar=c(4,4,0,5))
boxplot(M2Data$Profits,horizontal = T)

hist(M2Data$Profits,breaks = 50,main = "Profits")

Observation There are outliers outside the maximum and minimum value, Q1 falls in the range of a negative value on the box plot. The histogram report n=0 value.


CONCLUSION

SUMMARY OF DATA ANALYSIS OF M2DATAPROJECT

The analysis of M2data has given us a clearer picture of the global market in terms of sales,profit and shipping cost, market categorization, this analysis have shown us the region where the company is incurring highest shipping cost, the region contributing to the total profit, and the region sales turnover is coming from, this analysis also reveals how our product categories performed across region in different market.

Recommendation I recommend we introduce schemes to improve sales of products in the region with low turnover and identify alternative shipping plan to regions with high cost of shipment, this will improve our profit in the next financial year, especially when we are experiencing a decline in the market, we need to provide more support to relaunch our product.

This analysis was base on data from m2data.


BIBLIOGRAPHY

References:

  1. Tufte, E. R. (2001). “The Visual Display of Quantitative Information.

  2. Triola, M. F. (2017). Elementary Statistics. Pearson.

  3. Wickham, H. (2019). Advanced R. CRC Press https://adv-r.hadley.nz.

  4. John A. Rice (2007) Mathematical Statistics and Data Analysis, Brooks/Cole


APPENDIX

An R Markdown file has been attached to this report. The name of the file is Adegoke_ALY6000Project2.Rmd*