library(reshape2) # melt
library(MASS) # lda
library(psy) # cronbach
library(psych) # KMO
##
## Attaching package: 'psych'
## The following object is masked from 'package:psy':
##
## wkappa
library(Hmisc) # correlation matrix
## Warning: package 'Hmisc' was built under R version 3.4.2
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
##
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
##
## describe
## The following objects are masked from 'package:base':
##
## format.pval, round.POSIXt, trunc.POSIXt, units
library(psych) #KMO
library(Hmisc) # correlation matrix
cat("\014") # cleans screen
rm(list=ls(all=TRUE)) # remove variables in working memory
setwd("C:/Users/Erik Ernesto Vazquez/Downloads") # sets working directory
Study<-read.csv("CPG Companies.csv",header=T) # reads raw data from Qualtrics
cronbach(cbind(Study$Item1,Study$Item2,Study$Item3))
## $sample.size
## [1] 75
##
## $number.of.items
## [1] 3
##
## $alpha
## [1] 0.5261299
## hay que revisar la encuesta, la confiabilidad de feminity es muy baja .526
Study$Fem<-Study$Item1+Study$Item2+Study$Item3
t.test(Study$Fem~Study$Gen)
##
## Welch Two Sample t-test
##
## data: Study$Fem by Study$Gen
## t = -2.3485, df = 52.805, p-value = 0.02262
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.3349906 -0.2623931
## sample estimates:
## mean in group H mean in group M
## 21.96875 23.76744
## si hay diferencia entre grupos de Hombres y Mujeres (el score de hombres es menor)
cronbach(cbind(Study$Item4,Study$Item5,Study$Item6))
## $sample.size
## [1] 75
##
## $number.of.items
## [1] 3
##
## $alpha
## [1] 0.8388107
## confiabilidad aceptable .83 de seniority/responsabilidad
Study$Sen<-Study$Item4+Study$Item5+Study$Item6
summary(lm(Study$Sen~Study$Age))
##
## Call:
## lm(formula = Study$Sen ~ Study$Age)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.832 -5.484 0.400 4.242 13.388
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.69743 1.88798 3.547 0.000684 ***
## Study$Age 0.32927 0.05311 6.200 3.05e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.362 on 73 degrees of freedom
## Multiple R-squared: 0.3449, Adjusted R-squared: 0.3359
## F-statistic: 38.44 on 1 and 73 DF, p-value: 3.049e-08
## La edad va relacionada de manera lineal con seniority/responsabilidad
cronbach(cbind(Study$Item7,Study$Item8,Study$Item9,Study$Item10))
## $sample.size
## [1] 75
##
## $number.of.items
## [1] 4
##
## $alpha
## [1] 0.8125039
## confiabilidad aceptable .81 general brand trust
Study$Trust<-Study$Item7+Study$Item8+Study$Item9+Study$Item10
cronbach(cbind(Study$Item12,Study$Item13,Study$Item14))
## $sample.size
## [1] 75
##
## $number.of.items
## [1] 3
##
## $alpha
## [1] 0.9331444
## confiabilidad aceptable .93 brand loyalty
Study$Loyalty<-Study$Item12+Study$Item13+Study$Item14
## Hypothseses Trust
t.test(Study$Trust~Study$Gen)
##
## Welch Two Sample t-test
##
## data: Study$Trust by Study$Gen
## t = -0.76651, df = 67.03, p-value = 0.4461
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -4.939788 2.198509
## sample estimates:
## mean in group H mean in group M
## 23.18750 24.55814
summary(lm(Study$Trust~Study$Age))
##
## Call:
## lm(formula = Study$Trust ~ Study$Age)
##
## Residuals:
## Min 1Q Median 3Q Max
## -16.7339 -5.6734 0.8242 5.4498 12.5499
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.05942 2.27984 10.114 1.57e-15 ***
## Study$Age 0.02791 0.06413 0.435 0.665
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.683 on 73 degrees of freedom
## Multiple R-squared: 0.002587, Adjusted R-squared: -0.01108
## F-statistic: 0.1894 on 1 and 73 DF, p-value: 0.6647
## Ambos, ni la edad ni el genero impactan en la confianza
summary(lm(Study$Trust~Study$Fem))
##
## Call:
## lm(formula = Study$Trust ~ Study$Fem)
##
## Residuals:
## Min 1Q Median 3Q Max
## -16.898 -5.521 0.876 5.489 12.328
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 22.24087 6.43450 3.457 0.000916 ***
## Study$Fem 0.07532 0.27708 0.272 0.786507
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.689 on 73 degrees of freedom
## Multiple R-squared: 0.001011, Adjusted R-squared: -0.01267
## F-statistic: 0.0739 on 1 and 73 DF, p-value: 0.7865
summary(lm(Study$Trust~Study$Sen))
##
## Call:
## lm(formula = Study$Trust ~ Study$Sen)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.6788 -5.3904 0.4552 5.4757 15.3105
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 20.0091 2.1307 9.391 3.46e-14 ***
## Study$Sen 0.2268 0.1114 2.035 0.0454 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.483 on 73 degrees of freedom
## Multiple R-squared: 0.0537, Adjusted R-squared: 0.04074
## F-statistic: 4.143 on 1 and 73 DF, p-value: 0.04544
## Solo la seniority/responsabilidad responsabilidad percibida tiene un efecto positivo
## en la confianza general de marcas
summary(lm(Study$Trust~Study$Loyalty))
##
## Call:
## lm(formula = Study$Trust ~ Study$Loyalty)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.7670 -5.6075 0.5519 5.0302 12.7839
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 13.8973 4.5764 3.037 0.00331 **
## Study$Loyalty 0.4396 0.1961 2.242 0.02803 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.441 on 73 degrees of freedom
## Multiple R-squared: 0.0644, Adjusted R-squared: 0.05158
## F-statistic: 5.025 on 1 and 73 DF, p-value: 0.02803
## Obviamente confianza y lealtad van de la mano