library(readr)
## Warning: replacing previous import 'lifecycle::last_warnings' by
## 'rlang::last_warnings' when loading 'hms'
## Warning: replacing previous import 'lifecycle::last_warnings' by
## 'rlang::last_warnings' when loading 'pillar'
data <- read_csv("D:/USB DRive/Project DSP Laptop/KSF.csv")
## 
## -- Column specification --------------------------------------------------------
## cols(
##   `Key Success Factor` = col_character(),
##   `TM One` = col_double(),
##   Maxis = col_double(),
##   Celcom = col_double(),
##   AWS = col_double(),
##   Google = col_double(),
##   Microsoft = col_double(),
##   AwanTec = col_double(),
##   Time = col_double(),
##   Enfrasys = col_double()
## )
inno <- c( 4,4,4,2,2,3,2,2,1 )
advert <- c(2,3,4,2,2,2,1,1,1)
brand_name <- c(3,3,4,3,3,2,1,1,1)
product <- c(2,1,4,3,3,1,1,1,1)
connect <- c(2,3,4,2,1,2,1,1,1)
rlimpois <- function(n, lambda, lowlimit, toplimit){
  sample(x=lowlimit:toplimit, size=n, 
         prob=dpois(lowlimit:toplimit, lambda), replace=TRUE)
}
set.seed(1234)
inno1 <- rlimpois (100,3,1,4)
inno1
##   [1] 3 4 4 4 1 4 3 3 4 2 4 2 3 1 3 1 3 3 3 3 2 2 3 3 3 1 2 1 1 3 2 3 2 2 3 4 3
##  [38] 3 1 1 2 4 2 4 2 2 4 2 3 4 3 2 4 2 3 2 2 4 3 1 1 3 2 3 3 4 2 2 3 2 3 1 3 4
##  [75] 3 2 2 3 2 4 1 2 3 2 3 1 2 2 3 1 3 1 3 3 3 2 2 3 2 4
set.seed(889)
advert1 <- rlimpois (100,3,1,4)
advert1
##   [1] 3 1 2 4 1 4 3 4 1 3 1 2 1 3 3 1 3 2 4 2 1 4 2 2 3 1 4 2 2 4 4 2 4 4 3 2 1
##  [38] 4 4 2 1 2 2 3 1 3 4 2 3 4 1 3 2 1 3 4 3 4 2 3 3 2 2 3 4 4 4 2 3 1 3 4 2 4
##  [75] 3 3 4 3 1 4 3 4 2 2 2 2 1 4 1 1 3 2 3 2 1 3 1 3 2 1
set.seed(664)
brand1 <- rlimpois (100,3,1,4)
brand1
##   [1] 4 2 3 4 2 2 1 4 4 3 4 3 2 2 1 3 3 2 4 2 4 4 4 3 1 1 2 4 2 1 4 3 2 4 2 1 2
##  [38] 4 4 2 4 3 3 3 3 4 2 3 2 4 3 4 3 3 4 1 3 3 3 4 1 4 1 1 1 4 3 1 2 1 4 2 4 2
##  [75] 2 2 2 3 1 2 1 1 2 3 4 1 3 4 1 1 4 3 4 3 4 1 1 3 3 3
set.seed(775)
product1 <- rlimpois (100,3,1,4)
product1
##   [1] 2 2 4 3 3 2 4 3 3 2 1 1 3 4 3 1 3 2 2 3 3 3 1 1 2 3 2 1 2 3 1 4 4 4 3 2 3
##  [38] 1 2 2 4 3 1 3 2 1 4 3 3 4 4 3 3 1 4 3 4 3 2 3 1 3 4 4 1 2 3 3 4 1 3 3 2 3
##  [75] 2 2 2 3 2 1 1 1 1 2 3 3 2 2 3 3 1 1 4 2 3 3 4 4 3 3
set.seed(445)
connect1 <- rlimpois (100,3,1,4)
connect1
##   [1] 2 1 3 3 2 2 3 2 3 2 3 3 2 2 3 2 2 2 3 3 3 4 2 4 4 1 2 2 3 1 4 4 2 2 3 2 3
##  [38] 2 1 4 1 1 2 3 2 3 2 3 3 4 2 3 3 1 3 3 3 1 1 4 4 2 3 4 1 2 1 4 3 1 4 2 3 1
##  [75] 3 2 3 4 4 4 3 2 1 2 3 2 3 2 1 3 4 3 2 1 1 2 4 2 2 2
set.seed(139)
perform <- rnorm(100, mean = 1.5, sd = 1.0)
perform
##   [1]  1.562974634  1.449306611  0.015958490  0.106977739  1.674036908
##   [6]  2.619345253  0.481378393  1.990018159  1.666834728  1.501674807
##  [11]  2.616479662  1.513863102 -1.010425161  1.410219061  1.239917216
##  [16]  3.348547350  3.215448574  2.551628585  2.005688051 -0.413743942
##  [21] -0.098899929  2.415166729  1.230079838  0.752894467  0.387533782
##  [26]  2.298282678  3.515924636  0.369994983  1.095983211  0.547650129
##  [31]  2.714364782  1.535289299 -0.304877527  1.924302686  1.672798378
##  [36]  1.744663351  1.541646726  1.043658676  1.633919309  1.897634077
##  [41]  2.661331740  1.766275205  0.373081700  3.005034020  1.574653009
##  [46] -0.006153962 -0.040883103  0.640731090  1.646945547 -0.905255555
##  [51]  0.492904441  2.044625479  0.665545155  2.714636887  0.077440257
##  [56]  0.070208801  1.317224311  0.934192502  1.602460713  1.928426774
##  [61]  0.776798555  0.968327257  0.913413225  0.933770514  1.722033192
##  [66]  0.122381956  1.418906040  0.988572281  1.301389710 -0.474391281
##  [71]  1.402394549  1.365783136  2.049052591  2.304222557  4.080246113
##  [76]  0.434261553  0.823211545  1.481528824  0.937571487  2.612146320
##  [81]  1.223946546  2.562873196  1.139381915  3.298898361  1.041060221
##  [86]  0.796722148  1.593426905  2.221923228  0.120813166  1.484350720
##  [91]  0.857624102  0.405026999  1.087632019  3.110096646  2.037523302
##  [96]  1.461000444  0.282572425 -0.782105515  1.056146233  2.672739044
glm1 <- glm( perform ~ inno1 + advert1 + brand1 + product1 + connect1, data = data, family = "gaussian")
summary(glm1)
## 
## Call:
## glm(formula = perform ~ inno1 + advert1 + brand1 + product1 + 
##     connect1, family = "gaussian", data = data)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -2.18789  -0.63989   0.00362   0.55121   2.74303  
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.98434    0.51930   3.821 0.000238 ***
## inno1       -0.02556    0.11119  -0.230 0.818698    
## advert1      0.02827    0.09433   0.300 0.765076    
## brand1       0.09715    0.09264   1.049 0.297021    
## product1    -0.23184    0.10224  -2.268 0.025649 *  
## connect1    -0.12863    0.10516  -1.223 0.224332    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for gaussian family taken to be 1.014542)
## 
##     Null deviance: 104.129  on 99  degrees of freedom
## Residual deviance:  95.367  on 94  degrees of freedom
## AIC: 293.04
## 
## Number of Fisher Scoring iterations: 2