# Factorial ANOVA Testing in R: Analyzing Diesel Price Dynamics by Location and Day

August 12, 2023
Zoey Moore
🇺🇸 United States
Statistics
Zoey Moore is a seasoned Statistics Coursework Helper with 12 years of experience. She holds a master's degree from the University of Pennsylvania, USA. Zoey is a trusted guide for students seeking assistance with their assignments.
Tip of the day
News
Key Topics
• Problem Description
• Introduction
• Data Description
• Randomly Selected Dataset
• Exploratory Data Analysis
• Research Questions
• Factorial ANOVA
• LSD Test
• Summary Statistics:
• Groups:

In this comprehensive R Programming assignment, we delve into the complex world of dynamic fuel pricing. With a dataset comprising 35 observations, this study rigorously examines the influence of location and the day of the week on diesel prices. By leveraging advanced statistical techniques through ANOVA testing in R, we unlock valuable insights for stakeholders in the fuel industry. This research provides a deeper understanding of the pricing dynamics, ultimately aiding in informed decision-making and policy development in the ever-fluctuating fuel market.

## Problem Description

Analyze the impact of dynamic fuel pricing on diesel prices, focusing on location and days of the week. This study uses a dataset with 35 observations, investigating whether the location of a fuel station and the day of the week affect diesel prices. Factorial ANOVA testing in R is applied to determine the significance of these factors, offering insights into pricing dynamics for fuel industry stakeholders.

## Introduction

Gasoline prices are currently changing on a daily basis, a phenomenon known as dynamic fuel pricing. In India, dynamic fuel pricing was introduced in five cities, including Pondicherry and Vishakhapatnam in the south, Udaipur in the west, Jamshedpur in the east, and Chandigarh in the north. After a successful test phase, this pricing policy was adopted nationwide. This project aims to analyze the change in the price of Diesel over a given period of time using data.

## Data Description

The dataset for this project contains seven variables: Day, Location, Company, Time, Diesel, ULP91, and ULP98. For this analysis, we focus on three variables: Location and Day (independent variables) and Diesel (the dependent variable). Location and Day are nominal scale independent variables, while Diesel is a continuous dependent variable. The choice of these variables is based on the assumption that location and the day of the week can influence the price of diesel.

## Randomly Selected Dataset

The dataset consists of seven treatment combinations with five replications each, resulting in a total of thirty-five observations.

DayLocationDiesel
71152.9
62151.9
53145.9
44145.9
35157.9
26144.9
17150.9
71144.9
62152.9
53157.9
44152.9
35151.9
26144.9
17145.9
71150.9
62152.9
53144.9
44142.9
35152.9
26145.9
17142.9
71151.9
62142.9
53151.9
44142.9
35157.9
26157.9
17145.9
71157.9
62144.9
53150.9
44150.9
35150.9
26142.9
17151.9

Table 1: The Selected Dataset

Min1st Qu.Median3rd Qu.Max
142.9144.9150.9152.9157.9

Table 2: Summary Statistics of the Diesel Data

## Exploratory Data Analysis

Fig 1: A density plot of Diesel Price by Location

Fig 3: Histogram of Diesel Price

## Research Questions

For this project, the following research questions are addressed:

1. Is there any effect of the location of a fuel station on the change in the price of diesel?
2. Do the days of the week have any relationship with the change in the price of diesel?

## Factorial ANOVA

The Factorial ANOVA results are presented in the table below:

FactorDfSum SqMean SqF valuePr(>F)
Location42315578.745.434<2e-16 ***
Day6213.50.2710.95
Location: Day241205.00.3820.997
Residuals589750212.7

Table 3: ANOVA for the model.

The ANOVA table reveals that location significantly affects the price of diesel (p-value < 0.05). However, the effect of days and the interaction of both days and location on diesel price change are not statistically significant at the 5% level of significance.

## LSD Test

The Least Significant Difference (LSD) test results indicate that Melbourne, Brisbane, and Hobart, as locations, have a more significant effect on the change in the price of diesel. Since the interaction effect is not significant, there is no need to perform an LSD test for it.

## Summary Statistics:

• Adelaide:Mean Diesel Price = 150.76
• Melbourne: Mean Diesel Price = 148.78
• Brisbane:Mean Diesel Price = 148.56
• Hobart: Mean Diesel Price = 147.95
• Canberra: Mean Diesel Price = 144.70