This is an individual assignment.
You will need to use ggplot2 for this exam.
(10 points) Create a missing value map. If there is any missing value, use the mice package to impute missing values. (5 points) Make a bar graph for IFC. How many levels does IFC have? Any possible problem? If any, correct it.
(10 points) Make a graph of IFC vs OT, colored by OLT.
(10 points) Make a graph of IV, for each combination of IFC and OT.
(5 points) All graph should have an appropriate title.
(10 points) Create a missing value map. If there is any missing value, use the mice package to impute missing values.
missmap(Mart)
## Warning: Unknown or uninitialised column: `arguments`.
## Unknown or uninitialised column: `arguments`.
## Warning: Unknown or uninitialised column: `imputations`.
Mart$Outlet_Size=recode(Mart$Outlet_Size,Small=1,Medium=2,High=3)
Mart_Imputed=Mart%>%mice()%>%complete()
##
## iter imp variable
## 1 1 Item_Weight Outlet_Size
## 1 2 Item_Weight Outlet_Size
## 1 3 Item_Weight Outlet_Size
## 1 4 Item_Weight Outlet_Size
## 1 5 Item_Weight Outlet_Size
## 2 1 Item_Weight Outlet_Size
## 2 2 Item_Weight Outlet_Size
## 2 3 Item_Weight Outlet_Size
## 2 4 Item_Weight Outlet_Size
## 2 5 Item_Weight Outlet_Size
## 3 1 Item_Weight Outlet_Size
## 3 2 Item_Weight Outlet_Size
## 3 3 Item_Weight Outlet_Size
## 3 4 Item_Weight Outlet_Size
## 3 5 Item_Weight Outlet_Size
## 4 1 Item_Weight Outlet_Size
## 4 2 Item_Weight Outlet_Size
## 4 3 Item_Weight Outlet_Size
## 4 4 Item_Weight Outlet_Size
## 4 5 Item_Weight Outlet_Size
## 5 1 Item_Weight Outlet_Size
## 5 2 Item_Weight Outlet_Size
## 5 3 Item_Weight Outlet_Size
## 5 4 Item_Weight Outlet_Size
## 5 5 Item_Weight Outlet_Size
## Warning: Number of logged events: 6
missmap(Mart_Imputed)
(5 points) Make a bar graph for IFC. How many levels does IFC have? Any possible problem? If any, correct it.
ggplot(Mart, aes(x=Item_Fat_Content,y=Outlet_Type)) +
geom_bar(stat="identity") +
labs(x="Item Fat Content",
y="Outlet Type",
title="Cleaned")+
theme(plot.title = element_text(hjust = 0.5))
(10 points) Make a graph of IFC vs OT, colored by OLT.
ggplot(Mart, aes(x=Item_Fat_Content,
fill=factor(Outlet_Location_Type))) +
geom_bar() +
facet_grid(.~Outlet_Type)+
labs(x="Item Fat Content",
y="Amount",
title="Types Of Markets",
fill="Outlet Location Type")+
theme(plot.title = element_text(hjust = 0.5))
(10 points) Make a graph of IV, for each combination of IFC and OT.
ggplot(Mart, aes(x=Item_Visibility))+
geom_histogram() +
facet_grid(Item_Fat_Content~Outlet_Type)+
labs(x="Item Visibility",
y="Amount",
title="Item Visibility With Relation To Market Size and Fat Content")+
theme(plot.title = element_text(hjust = 0.5))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.