In this analysis, we will explore the correlation between two variables using the correlation coefficient. The correlation coefficient assesses the degree of linear relationship between two variables, ranging from +1 to -1.
The objective of this analysis is to calculate and interpret the correlation coefficient between ‘showroom_sales’ and ‘product_interest’ in our dataset.
Let’s start by loading our dataset and exploring its structure.
Before calculating the correlation coefficient, let’s visualize the distribution of each variable using histograms and explore the relationship between ‘showroom_sales’ and ‘product_interest’ using a scatter plot and boxplot.
# Histogram for showroom_sales
hist_plot_sales <- ggplot(data, aes(x = showroom_sales)) +
geom_histogram(binwidth = 5, fill = "skyblue", color = "black") +
labs(title = "Histogram of showroom_sales", x = "showroom_sales", y = "Frequency")
# Histogram for product_interest
hist_plot_interest <- ggplot(data, aes(x = product_interest)) +
geom_histogram(binwidth = 5, fill = "lightgreen", color = "black") +
labs(title = "Histogram of product_interest", x = "product_interest", y = "Frequency")
# Scatter plot
scatter_plot <- ggplot(data, aes(x = showroom_sales, y = product_interest)) +
geom_point() +
labs(title = "Scatter Plot of showroom_sales vs. product_interest", x = "showroom_sales", y = "product_interest")
# Boxplot
boxplot_plot <- ggplot(data, aes(x = 1, y = showroom_sales)) +
geom_boxplot(fill = "orange", color = "black") +
labs(title = "Boxplot of showroom_sales", x = "", y = "showroom_sales")
# Arrange the plots in a grid
grid.arrange(hist_plot_sales, hist_plot_interest, scatter_plot, boxplot_plot, ncol = 2)
Now, let’s calculate the correlation coefficient between ‘showroom_sales’ and ‘product_interest’.
# Calculate correlation coefficient
correlation_coefficient <- cor(data$showroom_sales, data$product_interest)
cat("Correlation Coefficient:", correlation_coefficient, "\n")
## Correlation Coefficient: -0.04953215
The calculated correlation coefficient provides insights into the relationship between the two variables.
Correlation Coefficient: [Replace with the actual value]
[Replace with the interpretation based on the actual correlation coefficient value.]