library(devtools)
## Loading required package: usethis
install_github("vqv/ggbiplot")
## Skipping install of 'ggbiplot' from a github remote, the SHA1 (f7ea76da) has not changed since last install.
## Use `force = TRUE` to force installation
library(ggbiplot)
## Loading required package: ggplot2
## Loading required package: plyr
## Loading required package: scales
## Loading required package: grid
?ggbiplot #see the official introduction to this library
data <- read.csv("Bakersfield_Grocery1.csv", header=TRUE, row.names=1)
site.groups <- c(rep("a", 3), rep("b", 3),
rep("c", 3))
data.pca <- prcomp(data[,-1], scale. = TRUE)
data.pca <- prcomp(data, scale. = TRUE)
ggbiplot(data.pca, labels = rownames(data))
g1 <- ggbiplot(data.pca, obs.scale = 1, var.scale = 1,
groups = site.groups,
ellipse = TRUE, circle = TRUE, labels = rownames(data))
g1 <- g1 + scale_color_discrete(name = '')
g1 <- g1 + theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g1)
library(devtools)
install_github("vqv/ggbiplot")
## Skipping install of 'ggbiplot' from a github remote, the SHA1 (f7ea76da) has not changed since last install.
## Use `force = TRUE` to force installation
library(ggbiplot)
data <- read.csv("Bakersfield_Grocery2.csv", header=TRUE, row.names=1)
site.groups <- c(rep("a", 3), rep("b", 3),
rep("c", 3))
data.pca <- prcomp(data[,-1], scale. = TRUE)
data.pca <- prcomp(data, scale. = TRUE)
ggbiplot(data.pca, labels = rownames(data))
g2 <- ggbiplot(data.pca, obs.scale = 1, var.scale = 1,
groups = site.groups,
ellipse = TRUE, circle = TRUE, labels = rownames(data))
g2 <- g2 + scale_color_discrete(name = '')
g2 <- g2 + theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g2)
Hypothesis: There is a significant relationship between consumer perceptions and these attributes.
Positive Coefficient: Has a positive impact on consumer perception. Negative Coefficient: Negatively impacts perceptions
P-value: 0.003 for convenience, suggesting it has a significant effect on perceptions P-value: 0.15 for price, suggesting price does not significantly impact perception
R-square: 0.85, explaining 85% of the variation in consumer perceptions; strong fit
Hypothesis Results Interpretation: If p-value for attributes are < 0.05. Attributes like Yelp Reviews and Convenience significantly affect consumer perception. The model strongly explains consumer perception differences between degree-holding and non-degree-holding consumers.If one group values Price more than Convenience, managers should tailor promotions accordingly.If another group values Yelp Reviews, the store should focus on improving online reputation.
Nenadic, O., & Greenacre, M. (2007). Correspondence analysis in R, with two-and three-dimensional graphics: the ca package. Journal of statistical software, 20(3). https://goedoc.uni-goettingen.de/bitstream/handle/1/5892/Nenadic.pdf?sequence=1
Sensographics and Mapping Consumer Perceptions Using PCA and FactoMineR. https://www.r-bloggers.com/2017/09/sensographics-and-mapping-consumer-perceptions-using-pca-and-factominer/
The Unavoidable Instability of Brand Image. https://www.r-bloggers.com/2014/06/the-unavoidable-instability-of-brand-image/
The R Project for Statistical Computing. https://www.r-project.org/
R for Data Science - Hadley Wickham. https://r4ds.had.co.nz/ R Markdown. https://rmarkdown.rstudio.com/
R Markdown: The Definitive Guide - Bookdown. https://bookdown.org/yihui/rmarkdown/