cat("\014")  # cleans screen

rm(list=ls(all=TRUE))  # remove variables in working memory
setwd("C:/Users/evazquez/Downloads")  # sets working directory
MainStudy<-read.csv("dataset.csv",header=T)  # reads data

MainStudyS<-subset(MainStudy,MainStudy$Product.category=="Search")
MainStudyE<-subset(MainStudy,MainStudy$Product.category=="Experience")
MainStudyC<-subset(MainStudy,MainStudy$Product.category=="Credence")

summary(lm(Qavg~TieStr+Vividness+OftenSMP+UsefulSMP,MainStudyS))
## 
## Call:
## lm(formula = Qavg ~ TieStr + Vividness + OftenSMP + UsefulSMP, 
##     data = MainStudyS)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.0483 -0.7207  0.1287  0.8198  3.0645 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    4.40795    0.26814  16.439  < 2e-16 ***
## TieStrWeak     0.73253    0.18679   3.922 0.000109 ***
## VividnessRich -0.18938    0.19404  -0.976 0.329880    
## OftenSMP       0.02091    0.04429   0.472 0.637235    
## UsefulSMP      0.18704    0.05100   3.668 0.000290 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.286 on 295 degrees of freedom
## Multiple R-squared:  0.1643, Adjusted R-squared:  0.153 
## F-statistic:  14.5 on 4 and 295 DF,  p-value: 7.963e-11
summary(lm(Qavg~TieStr+Vividness+OftenSMP+UsefulSMP,MainStudyE))
## 
## Call:
## lm(formula = Qavg ~ TieStr + Vividness + OftenSMP + UsefulSMP, 
##     data = MainStudyE)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.6054 -0.7621 -0.0761  0.7912  3.1050 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    4.884501   0.241895  20.193  < 2e-16 ***
## TieStrWeak     0.007453   0.161160   0.046  0.96315    
## VividnessRich -0.030756   0.167545  -0.184  0.85448    
## OftenSMP       0.060024   0.040475   1.483  0.13915    
## UsefulSMP      0.114326   0.043875   2.606  0.00963 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.104 on 295 degrees of freedom
## Multiple R-squared:  0.07655,    Adjusted R-squared:  0.06402 
## F-statistic: 6.113 on 4 and 295 DF,  p-value: 9.735e-05
summary(lm(Qavg~TieStr+Vividness+OftenSMP+UsefulSMP,MainStudyC))
## 
## Call:
## lm(formula = Qavg ~ TieStr + Vividness + OftenSMP + UsefulSMP, 
##     data = MainStudyC)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.9663 -0.5833 -0.0817  0.7125  3.3906 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    4.63276    0.23781  19.481   <2e-16 ***
## TieStrWeak    -0.24596    0.18913  -1.300   0.1944    
## VividnessRich -0.40772    0.21909  -1.861   0.0637 .  
## OftenSMP       0.04418    0.04642   0.952   0.3421    
## UsefulSMP      0.17843    0.04983   3.581   0.0004 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.249 on 295 degrees of freedom
## Multiple R-squared:  0.09519,    Adjusted R-squared:  0.08292 
## F-statistic: 7.759 on 4 and 295 DF,  p-value: 5.881e-06