library(reshape2) #  melt
## Warning: package 'reshape2' was built under R version 3.4.3
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.3
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.4.3
## 
## 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, units
library(psych) #KMO
library(Hmisc) # correlation matrix
library(mapproj)  #  map
## Warning: package 'mapproj' was built under R version 3.4.2
## Loading required package: maps
## Warning: package 'maps' was built under R version 3.4.2
library(lavaan)
## Warning: package 'lavaan' was built under R version 3.4.2
## This is lavaan 0.5-23.1097
## lavaan is BETA software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
library(semPlot)
## Warning: package 'semPlot' was built under R version 3.4.4
cat("\014")  # cleans screen

rm(list=ls(all=TRUE))  # remove variables in working memory
setwd("C:/Users/Erik Ernesto Vazquez/Downloads")  # sets working directory
MainStudy<-read.csv("MainStudyNov2.csv", header=T)
## MainStudy<-read.csv("MonaMourMainStudyUS.csv", header=T)  # reads raw data from Qualtrics
## MainStudy<-read.csv("MonaMourMainStudyMX.csv", header=T)  # reads raw data from Qualtrics

MainStudy1<-subset(MainStudy,MainStudy$Q40_Page.Submit!=""&MainStudy$FL_17_DO!="")
MainStudy1<-subset(MainStudy1,MainStudy1$Q4==3|MainStudy1$Q4==4) ## Only Desktop and Laptop PC

## recoding mobile and tablet (reverse)
MainStudy2<-subset(MainStudy,MainStudy$Q40_Page.Submit!=""&MainStudy$FL_17_DO!="")
MainStudy2<-subset(MainStudy2,MainStudy2$Q4==1|MainStudy2$Q4==2) ## Only Mobile and Tablet

## Reversing Answers
MainStudy1$Q19_1<-10-MainStudy1$Q19_1
MainStudy1$Q19_2<-10-MainStudy1$Q19_2
MainStudy1$Q19_3<-10-MainStudy1$Q19_3
MainStudy1$Q19_4<-10-MainStudy1$Q19_4

MainStudy1$Q21_7<-10-MainStudy1$Q21_7
MainStudy1$Q21_8<-10-MainStudy1$Q21_8
MainStudy1$Q21_9<-10-MainStudy1$Q21_9

MainStudy<-rbind(MainStudy1,MainStudy2)
MainStudy<-subset(MainStudy,MainStudy$FL_17_DO!="Block2"&MainStudy$FL_17_DO!="Block5")

table(MainStudy$Q4)
## 
##   1   2   3   4 
##  37  15 197 110
table(MainStudy$FL_17_DO)
## 
##        Block1 Block2 Block3 Block4 Block5 Block6 
##      0     93      0     89     89      0     88
## Demographics
summary(MainStudy$Q22)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   2.000   4.000   3.953   5.000   9.000
summary(MainStudy$Q23)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    2.00    9.00   12.00   11.01   12.00   15.00
summary(MainStudy$Q24)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   1.000   1.000   1.067   1.000   2.000
summary(MainStudy$Q25)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   1.000   1.000   2.457   5.000   6.000
summary(MainStudy$Q26)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   19.00   26.00   31.00   34.72   41.00   70.00
summary(MainStudy$LocationLatitude)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.286  24.395  35.934  32.143  40.903  57.133
summary(MainStudy$LocationLongitude)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -158.02  -89.16  -78.72  -40.92   72.74  140.60
##Filtering NAs
MainStudy<-subset(MainStudy,is.na(MainStudy$Q26)==FALSE)
mean(MainStudy$Q26)
## [1] 34.72423
sd(MainStudy$Q26)
## [1] 11.35335
table(MainStudy$FL_17_DO)
## 
##        Block1 Block2 Block3 Block4 Block5 Block6 
##      0     93      0     89     89      0     88
## Verifying equivalency of groups
summary(aov(as.numeric(Q22)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3    1.9   0.650   0.169  0.918
## Residuals           355 1368.2   3.854
summary(aov(as.numeric(Q23)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3    5.4   1.815   0.405  0.749
## Residuals           355 1589.5   4.478
summary(aov(as.numeric(Q24)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3  0.017 0.00564   0.089  0.966
## Residuals           355 22.379 0.06304
chisq.test(MainStudy$FL_17_DO,MainStudy$Q25)
## Warning in chisq.test(MainStudy$FL_17_DO, MainStudy$Q25): Chi-squared
## approximation may be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  MainStudy$FL_17_DO and MainStudy$Q25
## X-squared = 18.118, df = 15, p-value = 0.2565
ftable(MainStudy$Q25,MainStudy$FL_17_DO)
##       Block1 Block2 Block3 Block4 Block5 Block6
##                                                
## 1   0     60      0     49     46      0     48
## 2   0      5      0     10      8      0      8
## 3   0      1      0      4      5      0      9
## 4   0      3      0      1      1      0      2
## 5   0     19      0     16     15      0     12
## 6   0      5      0      9     14      0      9
MainStudy<-subset(MainStudy,MainStudy$Q25!=4)
MainStudy<-subset(MainStudy,MainStudy$Q25!=3)
chisq.test(MainStudy$FL_17_DO,MainStudy$Q25)
## 
##  Pearson's Chi-squared test
## 
## data:  MainStudy$FL_17_DO and MainStudy$Q25
## X-squared = 8.8476, df = 9, p-value = 0.4515
summary(aov(as.numeric(Q22)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3      2   0.661   0.168  0.918
## Residuals           329   1294   3.932
summary(aov(as.numeric(Q23)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3    2.9   0.982   0.235  0.872
## Residuals           329 1374.9   4.179
summary(aov(as.numeric(Q24)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3  0.048 0.01585   0.278  0.841
## Residuals           329 18.751 0.05699
summary(aov(as.numeric(Q26)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3    167   55.75    0.42  0.739
## Residuals           329  43675  132.75
summary(aov(as.numeric(LocationLatitude)~as.factor(FL_17_DO),MainStudy))
##                      Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3    319   106.4   0.721   0.54
## Residuals           329  48553   147.6
summary(aov(as.numeric(LocationLongitude)~as.factor(FL_17_DO),MainStudy))
##                      Df  Sum Sq Mean Sq F value Pr(>F)
## as.factor(FL_17_DO)   3    5055    1685   0.308   0.82
## Residuals           329 1801385    5475
## Measures
cronbach(cbind(MainStudy$Q19_1,MainStudy$Q19_2,MainStudy$Q19_3,MainStudy$Q19_4))
## $sample.size
## [1] 333
## 
## $number.of.items
## [1] 4
## 
## $alpha
## [1] 0.8926269
cronbach(cbind(MainStudy$Q19_1,MainStudy$Q19_2,MainStudy$Q19_4))
## $sample.size
## [1] 333
## 
## $number.of.items
## [1] 3
## 
## $alpha
## [1] 0.9053645
cronbach(cbind(MainStudy$Q21_7,MainStudy$Q21_8,MainStudy$Q21_9))
## $sample.size
## [1] 333
## 
## $number.of.items
## [1] 3
## 
## $alpha
## [1] 0.9666211
MainStudy$Auth<-(MainStudy$Q19_1+MainStudy$Q19_2+MainStudy$Q19_4)/3
MainStudy$PurchInt<-(MainStudy$Q21_7+MainStudy$Q21_8+MainStudy$Q21_9)/3

boxplot(Auth~FL_17_DO,MainStudy,range=3)$out ## no outliers

## numeric(0)
MainStudy$UrbanLvl<-ifelse(MainStudy$FL_17_DO=="Block1"|
                             MainStudy$FL_17_DO=="Block2"|
                             MainStudy$FL_17_DO=="Block3",1,2)

MainStudy$MCLvl<-ifelse(MainStudy$FL_17_DO=="Block1"|
                          MainStudy$FL_17_DO=="Block4",1,
                        (ifelse(MainStudy$FL_17_DO=="Block2"|
                                  MainStudy$FL_17_DO=="Block5",2,3)))

table(MainStudy$FL_17_DO)
## 
##        Block1 Block2 Block3 Block4 Block5 Block6 
##      0     89      0     84     83      0     77
table(MainStudy$UrbanLvl)
## 
##   1   2 
## 173 160
table(MainStudy$MCLvl)
## 
##   1   3 
## 172 161
MainStudy[is.na(MainStudy)]<-0
MainStudy$StimuliTime<-MainStudy$Q32_Page.Submit+MainStudy$Q33_Page.Submit+
  MainStudy$Q34_Page.Submit+MainStudy$Q35_Page.Submit+MainStudy$Q36_Page.Submit+
  MainStudy$Q37_Page.Submit
t.test(as.numeric(MainStudy$StimuliTime)~MainStudy$UrbanLvl) ## Equivalent StimuliTime
## 
##  Welch Two Sample t-test
## 
## data:  as.numeric(MainStudy$StimuliTime) by MainStudy$UrbanLvl
## t = -0.5602, df = 217.88, p-value = 0.5759
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.820023  1.014388
## sample estimates:
## mean in group 1 mean in group 2 
##        9.438445        9.841263
t.test(as.numeric(MainStudy$StimuliTime)~MainStudy$MCLvl) ## Equivalent StimuliTime
## 
##  Welch Two Sample t-test
## 
## data:  as.numeric(MainStudy$StimuliTime) by MainStudy$MCLvl
## t = -0.3161, df = 204.14, p-value = 0.7523
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.643109  1.189054
## sample estimates:
## mean in group 1 mean in group 3 
##        9.522227        9.749255
## SEM
datamatrix<-as.data.frame(cbind(MainStudy$Q19_1,MainStudy$Q19_2,MainStudy$Q19_4,
                                MainStudy$Q21_7,MainStudy$Q21_8,MainStudy$Q21_9,MainStudy$UrbanLvl,
                                MainStudy$MCLvl))
mymodel<-'
# measurement model
Authencity=~V1+V2+V3
PurchaseIntent=~V4+V5+V6
# regressions
PurchaseIntent~Authencity
Authencity~V7+V8
'
fit.path<-sem(mymodel,data=datamatrix)
fitMeasures(fit.path)
##                npar                fmin               chisq 
##              15.000               0.019              12.564 
##                  df              pvalue      baseline.chisq 
##              18.000               0.817            1953.721 
##         baseline.df     baseline.pvalue                 cfi 
##              27.000               0.000               1.000 
##                 tli                nnfi                 rfi 
##               1.004               1.004               0.990 
##                 nfi                pnfi                 ifi 
##               0.994               0.662               1.003 
##                 rni                logl   unrestricted.logl 
##               1.003           -4167.335           -4161.053 
##                 aic                 bic              ntotal 
##            8364.671            8421.793             333.000 
##                bic2               rmsea      rmsea.ci.lower 
##            8374.212               0.000               0.000 
##      rmsea.ci.upper        rmsea.pvalue                 rmr 
##               0.031               0.996               0.074 
##          rmr_nomean                srmr        srmr_bentler 
##               0.074               0.019               0.019 
## srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
##               0.019               0.019               0.019 
##          srmr_mplus   srmr_mplus_nomean               cn_05 
##               0.019               0.019             766.144 
##               cn_01                 gfi                agfi 
##             923.470               0.988               0.975 
##                pgfi                 mfi                ecvi 
##               0.494               1.008               0.128
summary(fit.path,fit.measures=T,standardized=T)
## lavaan (0.5-23.1097) converged normally after  44 iterations
## 
##   Number of observations                           333
## 
##   Estimator                                         ML
##   Minimum Function Test Statistic               12.564
##   Degrees of freedom                                18
##   P-value (Chi-square)                           0.817
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic             1953.721
##   Degrees of freedom                                27
##   P-value                                        0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    1.000
##   Tucker-Lewis Index (TLI)                       1.004
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4167.335
##   Loglikelihood unrestricted model (H1)      -4161.053
## 
##   Number of free parameters                         15
##   Akaike (AIC)                                8364.671
##   Bayesian (BIC)                              8421.793
##   Sample-size adjusted Bayesian (BIC)         8374.212
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000
##   90 Percent Confidence Interval          0.000  0.031
##   P-value RMSEA <= 0.05                          0.996
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.019
## 
## Parameter Estimates:
## 
##   Information                                 Expected
##   Standard Errors                             Standard
## 
## Latent Variables:
##                     Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   Authencity =~                                                          
##     V1                 1.000                               1.796    0.905
##     V2                 0.891    0.045   19.686    0.000    1.600    0.828
##     V3                 0.958    0.044   21.653    0.000    1.720    0.886
##   PurchaseIntent =~                                                      
##     V4                 1.000                               2.376    0.935
##     V5                 1.027    0.027   38.301    0.000    2.440    0.971
##     V6                 0.993    0.028   35.408    0.000    2.360    0.951
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   PurchaseIntent ~                                                      
##     Authencity        0.405    0.075    5.404    0.000    0.306    0.306
##   Authencity ~                                                          
##     V7                0.423    0.204    2.071    0.038    0.235    0.118
##     V8                0.186    0.102    1.824    0.068    0.104    0.104
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .V1                0.713    0.108    6.613    0.000    0.713    0.181
##    .V2                1.176    0.118    9.992    0.000    1.176    0.315
##    .V3                0.812    0.106    7.671    0.000    0.812    0.215
##    .V4                0.812    0.083    9.789    0.000    0.812    0.126
##    .V5                0.367    0.064    5.772    0.000    0.367    0.058
##    .V6                0.593    0.070    8.434    0.000    0.593    0.096
##    .Authencity        3.147    0.307   10.249    0.000    0.976    0.976
##    .PurchaseIntent    5.118    0.457   11.189    0.000    0.906    0.906
semPaths(fit.path,"std",edge.label.cex=1,curvePivot=T,covAtResiduals=F,residuals=F,fade=F)

aggregate(MainStudy$Auth,list(MainStudy$UrbanLvl),mean)
##   Group.1        x
## 1       1 5.751445
## 2       2 6.129167
aggregate(MainStudy$Auth,list(MainStudy$UrbanLvl),sd)
##   Group.1        x
## 1       1 1.849787
## 2       2 1.715628
aggregate(MainStudy$Auth,list(MainStudy$MCLvl),mean)
##   Group.1       x
## 1       1 5.76938
## 2       3 6.10766
aggregate(MainStudy$Auth,list(MainStudy$MCLvl),sd)
##   Group.1        x
## 1       1 1.748418
## 2       3 1.830529
aggregate(MainStudy$Auth,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 5.524345
## 2  Block3 5.992063
## 3  Block4 6.032129
## 4  Block6 6.233766
aggregate(MainStudy$Auth,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 1.742145
## 2  Block3 1.938807
## 3  Block4 1.727048
## 4  Block6 1.708309
## Hypotheses testing
t.test(MainStudy$Auth~MainStudy$UrbanLvl) ## H1 Accepted
## 
##  Welch Two Sample t-test
## 
## data:  MainStudy$Auth by MainStudy$UrbanLvl
## t = -1.9332, df = 331, p-value = 0.05406
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.762071995  0.006628836
## sample estimates:
## mean in group 1 mean in group 2 
##        5.751445        6.129167
t.test(MainStudy$Auth~MainStudy$MCLvl) ## H2 Accepted
## 
##  Welch Two Sample t-test
## 
## data:  MainStudy$Auth by MainStudy$MCLvl
## t = -1.7221, df = 326.89, p-value = 0.08599
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.7247118  0.0481506
## sample estimates:
## mean in group 1 mean in group 3 
##         5.76938         6.10766
summary(lm(PurchInt~UrbanLvl+MCLvl,MainStudy))
## 
## Call:
## lm(formula = PurchInt ~ UrbanLvl + MCLvl, data = MainStudy)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.2266 -2.2266 -0.2266  1.9010  5.0774 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.68247    0.49528   7.435 9.08e-13 ***
## UrbanLvl     0.17638    0.26779   0.659    0.511    
## MCLvl        0.06379    0.13387   0.477    0.634    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.441 on 330 degrees of freedom
## Multiple R-squared:  0.001991,   Adjusted R-squared:  -0.004058 
## F-statistic: 0.3291 on 2 and 330 DF,  p-value: 0.7198
summary(lm(PurchInt~Auth,MainStudy))
## 
## Call:
## lm(formula = PurchInt ~ Auth, data = MainStudy)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.2999 -2.0280  0.1014  1.7045  5.9742 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.68808    0.44201   3.819  0.00016 ***
## Auth         0.40132    0.07132   5.627 3.91e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.331 on 331 degrees of freedom
## Multiple R-squared:  0.0873, Adjusted R-squared:  0.08455 
## F-statistic: 31.66 on 1 and 331 DF,  p-value: 3.913e-08
summary(lm(PurchInt~Auth+UrbanLvl+MCLvl,MainStudy)) ## H3 Accepted fully mediates
## 
## Call:
## lm(formula = PurchInt ~ Auth + UrbanLvl + MCLvl, data = MainStudy)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.3153 -2.0453  0.0942  1.7119  5.9805 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.663384   0.597938   2.782  0.00572 ** 
## Auth         0.400830   0.072267   5.546    6e-08 ***
## UrbanLvl     0.024392   0.257933   0.095  0.92472    
## MCLvl       -0.004332   0.128796  -0.034  0.97319    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.338 on 329 degrees of freedom
## Multiple R-squared:  0.08733,    Adjusted R-squared:  0.07901 
## F-statistic: 10.49 on 3 and 329 DF,  p-value: 1.308e-06
## Interaction effects
summary(aov(Auth~UrbanLvl*MCLvl,MainStudy)) ## There are not interaction effects
##                 Df Sum Sq Mean Sq F value Pr(>F)  
## UrbanLvl         1   11.9  11.859   3.732 0.0542 .
## MCLvl            1    9.6   9.608   3.024 0.0830 .
## UrbanLvl:MCLvl   1    1.5   1.470   0.462 0.4969  
## Residuals      329 1045.5   3.178                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lm(Auth~UrbanLvl*MCLvl,MainStudy)) ## There are not interaction effects
## 
## Call:
## lm(formula = Auth ~ UrbanLvl * MCLvl, data = MainStudy)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.2338 -1.0321  0.1423  1.4329  3.4757 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      4.6497     0.6750   6.888 2.88e-11 ***
## UrbanLvl         0.6408     0.4316   1.485    0.139    
## MCLvl            0.3669     0.3057   1.200    0.231    
## UrbanLvl:MCLvl  -0.1330     0.1956  -0.680    0.497    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.783 on 329 degrees of freedom
## Multiple R-squared:  0.02147,    Adjusted R-squared:  0.01255 
## F-statistic: 2.406 on 3 and 329 DF,  p-value: 0.06724
## Location of the sample
map(database="world", ylim=c(36,40), xlim=c(-99,-95), col="white", fill=TRUE, projection="gilbert", orientation= c(90,0,225))
lon<-as.character(MainStudy$LocationLongitude)
lat<-as.character(MainStudy$LocationLatitude)
coord<-mapproject(lon, lat, proj="gilbert", orientation=c(90, 0, 225))
points(coord, pch=20, cex=0.8, col="black")

## Demographics
table(MainStudy$FL_17_DO)
## 
##        Block1 Block2 Block3 Block4 Block5 Block6 
##      0     89      0     84     83      0     77
aggregate(MainStudy$Q22,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 4.056180
## 2  Block3 3.976190
## 3  Block4 3.843373
## 4  Block6 3.974026
aggregate(MainStudy$Q22,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 1.866934
## 2  Block3 1.975611
## 3  Block4 2.033152
## 4  Block6 2.064576
aggregate(MainStudy$Q23,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 11.05618
## 2  Block3 11.11905
## 3  Block4 10.86747
## 4  Block6 11.05195
aggregate(MainStudy$Q23,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 2.069033
## 2  Block3 2.107958
## 3  Block4 2.288737
## 4  Block6 1.621371
aggregate(MainStudy$Q24,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 1.078652
## 2  Block3 1.059524
## 3  Block4 1.048193
## 4  Block6 1.051948
aggregate(MainStudy$Q24,list(MainStudy$FL_17_DO),sd)
##   Group.1         x
## 1  Block1 0.2707195
## 2  Block3 0.2380235
## 3  Block4 0.2154753
## 4  Block6 0.2233774
aggregate(MainStudy$Q25,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 2.191011
## 2  Block3 2.416667
## 3  Block4 2.662651
## 4  Block6 2.311688
aggregate(MainStudy$Q25,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 1.870078
## 2  Block3 1.970923
## 3  Block4 2.120039
## 4  Block6 1.961872
aggregate(MainStudy$Q26,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 35.55056
## 2  Block3 36.13095
## 3  Block4 35.40964
## 4  Block6 34.14286
aggregate(MainStudy$Q26,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 11.37782
## 2  Block3 12.17026
## 3  Block4 11.03656
## 4  Block6 11.47161
aggregate(MainStudy$LocationLatitude,list(MainStudy$FL_17_DO),mean)
##   Group.1        x
## 1  Block1 32.83436
## 2  Block3 34.04834
## 3  Block4 31.41157
## 4  Block6 32.07949
aggregate(MainStudy$LocationLatitude,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 12.27932
## 2  Block3 11.41858
## 3  Block4 12.45835
## 4  Block6 12.42631
aggregate(MainStudy$LocationLongitude,list(MainStudy$FL_17_DO),mean)
##   Group.1         x
## 1  Block1 -45.37594
## 2  Block3 -44.95078
## 3  Block4 -35.89819
## 4  Block6 -40.20810
aggregate(MainStudy$LocationLongitude,list(MainStudy$FL_17_DO),sd)
##   Group.1        x
## 1  Block1 71.90488
## 2  Block3 74.20781
## 3  Block4 76.42499
## 4  Block6 73.48378
aggregate(MainStudy$StimuliTime,list(MainStudy$FL_17_DO),mean)
##   Group.1         x
## 1  Block1  9.579112
## 2  Block3  9.289405
## 3  Block4  9.461229
## 4  Block6 10.250909
aggregate(MainStudy$StimuliTime,list(MainStudy$FL_17_DO),sd)
##   Group.1         x
## 1  Block1  3.933450
## 2  Block3  3.625392
## 3  Block4  2.467222
## 4  Block6 11.770746
ftable(MainStudy$Q25,MainStudy$FL_17_DO)
##       Block1 Block2 Block3 Block4 Block5 Block6
##                                                
## 1   0     60      0     49     46      0     48
## 2   0      5      0     10      8      0      8
## 5   0     19      0     16     15      0     12
## 6   0      5      0      9     14      0      9