Main function: get.analyses()
The main function to inspect is get.analyses()
.
It will take one or more take analysis (studies
) from the masteRkey
sheet and an indication of whether the analysis is: 1. global
- will disregard the clusters in the data and use all valid caes for analyses, both primary
and secondary
analyses have a global
variant. 2. primary
- target analysis of replication study conducted for each lab seperately. 3. secondary
- additional analyses for each lab conducted for each lab seperately. 4. order
- presentation order analyses disregard the clusters int he data, each order is analysed seperately
Have a look at
saveConsole.R
which calls thetestScript()
function and creates a log file with lots of info about the analysis steps.
IMPORTANT FOR REVIEWERS
You will have to point the functionget.analyses()
to where you downloaded these files:
ML2_RawData_S1.rds
ML2_RawData_S2.rds
The script will assume the data are in a subdirectory of a rootdirectory given by the arguments:
The example below runs a global analysis for Huang.1
df <- get.analyses(studies = 1,
analysis.type = 1,
rootdir = MyRootDir,
indir = list(RAW.DATA = MyRawDataDir,
MASTERKEY = "",
SOURCEINFO = ""))
##
##
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~get.analyses~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## # Downloaded keytable Googlesheet: ML2_masteRkey [https://docs.google.com/spreadsheets/d/1fqK3WHwFPMIjNVVvmxpMEjzUETftq_DmP5LzEhXxUHA/]
## #
## # Downloaded data from OSF: 'ML2_RawData_S1.rds' and 'ML2_RawData_S2.rds'
## #
## # Downloaded information about the data sources from Googlesheet: 'ML2_SourceInfo.xlsx' [https://docs.google.com/spreadsheets/d/1Qn_kVkVGwffBAmhAbpgrTjdxKLP1bb2chHjBMVyGl1s/]
## #
## # Analyzing studies in study.global.include
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##
##
## ~~~~~~HUANG.1~~~~~~
## # 1 Huang.1 - START
##
## #
## # 1 Huang.1 - all: var.equal set to: FALSE
## #
## # 1 Huang.1 - COMPLETED
## ~~~~~~~~~~~~~~~~~~~~~~~
The object df
contains two named lists:1
raw.case
This list contains dataframes with the relevant variables for each analysis, but before the analysis specific variable functions (vafun
) are applied. There is a Boolean variable case.include
which indicates whther a case is valid and should be included for analysis.
head(tbl_df(df$raw.case$Huang.1))
## # A tibble: 6 x 25
## .id source
## <chr> <chr>
## 1 ML2_Slate1_Brazil__Portuguese_execution_illegal_r.csv brasilia
## 2 ML2_Slate1_Brazil__Portuguese_execution_illegal_r.csv brasilia
## 3 ML2_Slate1_Brazil__Portuguese_execution_illegal_r.csv brasilia
## 4 ML2_Slate1_Brazil__Portuguese_execution_illegal_r.csv brasilia
## 5 ML2_Slate1_Brazil__Portuguese_execution_illegal_r.csv brasilia
## 6 ML2_Slate1_Brazil__Portuguese_execution_illegal_r.csv brasilia
## # ... with 23 more variables: huan1.1_Y1 <dbl>, huan1.1_R0 <int>,
## # huan2.1_Y1 <dbl>, huan2.1_R0 <int>, Source.Global <chr>,
## # Source.Primary <chr>, Source.Secondary <chr>, Country <chr>,
## # Location <chr>, Language <chr>, Weird <int>, Execution <chr>,
## # SubjectPool <chr>, Setting <chr>, Tablet <chr>, Pencil <chr>,
## # StudyOrderN <chr>, IDiffOrderN <chr>, uID <int>, study.order <int>,
## # analysis.type <fctr>, subset <fctr>, case.include <lgl>
aggregated
The dataframe in aggregated
contains the data as is was analysed, after the varfun
is applied.
glimpse(tbl_df(df$aggregated$Huang.1))
## Observations: 1
## Variables: 116
## $ study.id <int> 1
## $ study.slate <int> 1
## $ study.name <fctr> Huang
## $ study.source <fctr> all
## $ analysis.type <fctr> Global
## $ analysis.name <fctr> Huang.1
## $ stat.N <int> 6591
## $ stat.n1 <int> 3331
## $ stat.n2 <int> 3260
## $ stat.cond1.name <chr> "High"
## $ stat.cond1.column <chr> "ignore"
## $ stat.cond1.n <dbl> 3331
## $ stat.cond1.mean <dbl> 11.70344
## $ stat.cond1.sd <dbl> 84.31498
## $ stat.cond1.median <dbl> 0
## $ stat.cond1.trimmed <dbl> 13.03014
## $ stat.cond1.mad <dbl> 84.5082
## $ stat.cond1.min <dbl> -185.87
## $ stat.cond1.max <dbl> 178
## $ stat.cond1.range <dbl> 363.87
## $ stat.cond1.skew <dbl> -0.0797105
## $ stat.cond1.kurtosis <dbl> -0.541009
## $ stat.cond1.se <dbl> 1.46089
## $ stat.cond2.name <chr> "Low"
## $ stat.cond2.column <chr> "ignore"
## $ stat.cond2.n <dbl> 3260
## $ stat.cond2.mean <dbl> -22.69856
## $ stat.cond2.sd <dbl> 88.77561
## $ stat.cond2.median <dbl> -16
## $ stat.cond2.trimmed <dbl> -26.39949
## $ stat.cond2.mad <dbl> 102.2994
## $ stat.cond2.min <dbl> -186
## $ stat.cond2.max <dbl> 176.28
## $ stat.cond2.range <dbl> 362.28
## $ stat.cond2.skew <dbl> 0.3025972
## $ stat.cond2.kurtosis <dbl> -0.6416739
## $ stat.cond2.se <dbl> 1.554837
## $ test.type <fctr> t
## $ test.estimate <dbl> 34.402
## $ test.estimate1 <dbl> 11.70344
## $ test.estimate2 <dbl> -22.69856
## $ test.statistic <dbl> 16.12487
## $ test.p.value <dbl> 2.146219e-57
## $ test.parameter <dbl> 6554.05
## $ test.conf.low <dbl> 30.21969
## $ test.conf.high <dbl> 38.58431
## $ test.method <chr> "Welch Two Sample t-test"
## $ test.alternative <fctr> two.sided
## $ test.estype <chr> "t"
## $ test.varequal <lgl> FALSE
## $ ESCI.ncp <dbl> 16.12487
## $ ESCI.ncp.lo <dbl> 14.14495
## $ ESCI.ncp.hi <dbl> 18.10357
## $ ESCI.N.total <dbl> 6591
## $ ESCI.n.1 <dbl> 3331
## $ ESCI.n.2 <dbl> 3260
## $ ESCI.d <dbl> 0.39726
## $ ESCI.var.d <dbl> 0.00062
## $ ESCI.l.d <dbl> 0.34848
## $ ESCI.u.d <dbl> 0.44601
## $ ESCI.U3.d <dbl> 65.44124
## $ ESCI.cl.d <dbl> 61.06087
## $ ESCI.cliffs.d <dbl> 0.22122
## $ ESCI.pval.d <dbl> 0
## $ ESCI.g <dbl> 0.39722
## $ ESCI.var.g <dbl> 0.00062
## $ ESCI.l.g <dbl> 0.34844
## $ ESCI.u.g <dbl> 0.44596
## $ ESCI.U3.g <dbl> 65.43957
## $ ESCI.cl.g <dbl> 61.05964
## $ ESCI.pval.g <dbl> 0
## $ ESCI.r <dbl> 0.19484
## $ ESCI.var.r <dbl> 0.00014
## $ ESCI.l.r <dbl> 0.17167
## $ ESCI.u.r <dbl> 0.21768
## $ ESCI.pval.r <dbl> 0
## $ ESCI.fisher.z <dbl> 0.19737
## $ ESCI.var.z <dbl> 0.00015
## $ ESCI.l.z <dbl> 0.17339
## $ ESCI.u.z <dbl> 0.22122
## $ ESCI.OR <dbl> 2.05557
## $ ESCI.l.or <dbl> 1.88152
## $ ESCI.u.or <dbl> 2.2456
## $ ESCI.pval.or <dbl> 0
## $ ESCI.lOR <dbl> 0.72055
## $ ESCI.l.lor <dbl> 0.63208
## $ ESCI.u.lor <dbl> 0.80897
## $ ESCI.pval.lor <dbl> 0
## $ ESCI.cohensQ <lgl> NA
## $ ESCI.cohensQ.l <lgl> NA
## $ ESCI.cohensQ.u <lgl> NA
## $ ESCI.bootR1 <lgl> NA
## $ ESCI.bootR2 <lgl> NA
## $ ESCI.bootCI.l <lgl> NA
## $ ESCI.bootCI.u <lgl> NA
## $ test.ConsoleOutput <fctr>
## Welch Two Sample t-test
##
## data: ...
## $ source.N.sources.global <int> 64
## $ source.N.sources.primary <int> 64
## $ source.N.sources.secondary <int> 74
## $ source.N.countries <int> 28
## $ source.N.locations <int> 59
## $ source.N.languages <int> 15
## $ source.Pct.WEIRD <dbl> 72.19608
## $ source.Tbl.Execution <chr> "Execution\nillegal legal \n 33...
## $ source.Tbl.subjectpool <chr> "SubjectPool\n No Yes \n2368 4111 "
## $ source.Tbl.setting <chr> "Setting\n In a classroom ...
## $ source.Tbl.Tablet <chr> "Tablet\n ...
## $ source.Tbl.Pencil <chr> "Pencil\nNo, the whole study was on...
## $ source.N.studyorders1 <int> 6479
## $ source.N.IDiffOrderN <int> 782
## $ source.N.uIDs <int> 6589
## $ source.N.studyorders2 <int> 13
## $ source.Tbl.analysistype <chr> "analysis.type\nGlobal \n 6589 "
## $ source.Tbl.subset <chr> "subset\n all \n6589 "
## $ source.N.cases.included <int> 6589
## $ source.N.cases.excluded <int> 674
The output contains descriptives and sample summary characteristics and a variety of Effect Size measures. It also contains the console output of the statistical test that was conducted:
cat(paste0(df$aggregated$Huang.1$test.ConsoleOutput))
##
## Welch Two Sample t-test
##
## data: High and Low
## t = 16.125, df = 6554.1, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 30.21969 38.58431
## sample estimates:
## mean of x mean of y
## 11.70344 -22.69856