R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

getwd()
## [1] "C:/Users/clinton3/Documents"
setwd("C:/Users/clinton3/Documents")
mydata<-read.csv("customer_segmentation.csv")
str(mydata)
## 'data.frame':    22 obs. of  15 variables:
##  $ ID            : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ CS_helpful    : int  2 1 2 3 2 1 2 1 1 1 ...
##  $ Recommend     : int  2 2 1 3 1 1 1 1 1 1 ...
##  $ Come_again    : int  2 1 1 2 3 3 1 1 1 1 ...
##  $ All_Products  : int  2 1 1 4 5 2 2 2 2 1 ...
##  $ Profesionalism: int  2 1 1 1 2 1 2 1 2 1 ...
##  $ Limitation    : int  2 1 2 2 1 1 1 2 1 1 ...
##  $ Online_grocery: int  2 2 3 3 2 1 2 1 2 3 ...
##  $ delivery      : int  3 3 3 3 3 2 2 1 1 2 ...
##  $ Pick_up       : int  4 3 2 2 1 1 2 2 3 2 ...
##  $ Find_items    : int  1 1 1 2 2 1 1 2 1 1 ...
##  $ other_shops   : int  2 2 3 2 3 4 1 4 1 1 ...
##  $ Gender        : int  1 1 1 1 2 1 1 1 2 2 ...
##  $ Age           : int  2 2 2 3 4 2 2 2 2 2 ...
##  $ Education     : int  2 2 2 5 2 5 3 2 1 2 ...
#it looks like the following ne is the best regression equation for this project 
summary(lm(CS_helpful ~. -ID, data=mydata))
## 
## Call:
## lm(formula = CS_helpful ~ . - ID, data = mydata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.39668 -0.14511  0.02472  0.14090  0.31831 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    -0.15348    0.63083  -0.243 0.813901    
## Recommend       0.16584    0.13359   1.241 0.249616    
## Come_again     -0.08160    0.15428  -0.529 0.611218    
## All_Products    0.25910    0.08930   2.901 0.019850 *  
## Profesionalism  0.55105    0.17158   3.212 0.012395 *  
## Limitation      0.58813    0.10853   5.419 0.000632 ***
## Online_grocery  0.23562    0.10777   2.186 0.060268 .  
## delivery        0.12848    0.12554   1.023 0.336046    
## Pick_up        -0.18384    0.09434  -1.949 0.087156 .  
## Find_items     -0.21428    0.14441  -1.484 0.176143    
## other_shops    -0.11142    0.06080  -1.832 0.104245    
## Gender         -0.43572    0.21782  -2.000 0.080474 .  
## Age             0.05329    0.12382   0.430 0.678304    
## Education       0.02337    0.05384   0.434 0.675679    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3025 on 8 degrees of freedom
## Multiple R-squared:  0.9353, Adjusted R-squared:  0.8302 
## F-statistic: 8.896 on 13 and 8 DF,  p-value: 0.002149
summary(lm(CS_helpful ~Recommend + factor(Gender), data=mydata))
## 
## Call:
## lm(formula = CS_helpful ~ Recommend + factor(Gender), data = mydata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.9430 -0.3896 -0.3896  0.5873  1.5178 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      0.83610    0.34202   2.445   0.0244 *
## Recommend        0.55344    0.22696   2.438   0.0247 *
## factor(Gender)2  0.09264    0.32181   0.288   0.7766  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6722 on 19 degrees of freedom
## Multiple R-squared:  0.2415, Adjusted R-squared:  0.1617 
## F-statistic: 3.025 on 2 and 19 DF,  p-value: 0.07233
## the following regression equation does not generate any significant results 
summary(lm(CS_helpful ~Online_grocery + All_Products + factor(Gender) + Education + Age, data=mydata))
## 
## Call:
## lm(formula = CS_helpful ~ Online_grocery + All_Products + factor(Gender) + 
##     Education + Age, data = mydata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.30657 -0.48998 -0.04729  0.46749  1.22063 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)       1.0375     0.7888   1.315   0.2070  
## Online_grocery    0.2350     0.2104   1.117   0.2806  
## All_Products      0.2816     0.1588   1.773   0.0953 .
## factor(Gender)2   0.2210     0.3793   0.583   0.5683  
## Education         0.0772     0.1107   0.697   0.4955  
## Age              -0.3566     0.2469  -1.444   0.1680  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7279 on 16 degrees of freedom
## Multiple R-squared:  0.251,  Adjusted R-squared:  0.01695 
## F-statistic: 1.072 on 5 and 16 DF,  p-value: 0.4119

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.