This is pilot A is a pilot of my study with non-naive participants. In this document, you will find:
# load packages
library(tidyverse) # for data munging
## ── Attaching packages ─────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0 ✔ purrr 0.2.5
## ✔ tibble 1.4.2 ✔ dplyr 0.7.7
## ✔ tidyr 0.8.2 ✔ stringr 1.3.1
## ✔ readr 1.1.1 ✔ forcats 0.3.0
## ── Conflicts ────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(knitr) # for kable table formating
library(haven) # import and export 'SPSS', 'Stata' and 'SAS' Files
library(readxl) # import excel files
library(CARPSreports) # custom report functions
library('dplyr') # for data manipulation
library('tidyr') # for reshaping data
library(plyr)
## -------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## -------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following object is masked from 'package:purrr':
##
## compact
library('ggplot2') # plotting data
library('scales') # for scale_y_continuous(label = percent)
##
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
##
## discard
## The following object is masked from 'package:readr':
##
## col_factor
library('ggthemes') # for scale_fill_few('medium')
knitr::opts_chunk$set(comment = NA)
options(ztable.type = 'html')
#install.packages("ez") #Uncomment and run this line if you do not have "ez" installed
library(ez)
library(lsr) #for ANOVA effect size calculations
library(readr)
rawdata <- read_csv("~/Desktop/PhD Stanford /PSYCH-251 Experimental Methods/Final Project /PilotA/Trial 2_PilotA/Data_Trial2_PilotA.csv")
Parsed with column specification:
cols(
.default = col_character()
)
See spec(...) for full column specifications.
head(rawdata)
# A tibble: 4 x 24
StartDate EndDate Progress `Duration (in s… RecordedDate ResponseId Q1
<chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 Start Da… End Da… Progress Duration (in se… Recorded Da… Response … Gend…
2 11/25/18… 11/25/… 100 137 11/25/18 17… R_u8KIu3Y… Pref…
3 11/25/18… 11/25/… 100 35 11/25/18 17… R_2AMWJ5p… Pref…
4 11/25/18… 11/25/… 100 387 11/25/18 17… R_2Xb76xN… Fema…
# ... with 17 more variables: Q1_3_TEXT <chr>, Q2 <chr>, Q3 <chr>,
# Q24 <chr>, Q22 <chr>, Q26 <chr>, Q27 <chr>, Q28 <chr>, Q29_1 <chr>,
# Q54 <chr>, Q55 <chr>, Q58 <chr>, Q59 <chr>, Q60 <chr>, Q61_1 <chr>,
# Q47 <chr>, Q41 <chr>
d <- read_csv("~/Desktop/PhD Stanford /PSYCH-251 Experimental Methods/Final Project /PilotA/Trial 2_PilotA/Table A_Data_Trial2_PilotA.csv")
Parsed with column specification:
cols(
Subject = col_integer(),
Condition = col_integer(),
BeforeHint = col_integer(),
AfterHint = col_integer(),
Comprenhensibility = col_character()
)
head(d)
# A tibble: 3 x 5
Subject Condition BeforeHint AfterHint Comprenhensibility
<int> <int> <int> <int> <chr>
1 111 1 0 1 Good
2 112 1 1 1 Poor
3 113 2 1 1 Intermediate
#Total With Principle condition
Total_WP = sum(with(d, Condition==1))
Total_WP
[1] 2
#Total Without Principle
Total_WOP = sum(with(d, Condition==2))
Total_WOP
[1] 1
# Frequency of convergence solution with principle before hint
ds <- d %>%
filter(Condition==1 & BeforeHint==1)
y = count(ds, 'BeforeHint')
#Percentage of convergence solution with principle before hint
mutate (y, PY=((y$freq/Total_WP)*100))
BeforeHint freq PY
1 1 1 50
# Frequency of convergence solution with principle after hint
dt <- d %>%
filter(Condition==1 & AfterHint==1)
x = count(dt, 'AfterHint')-y
#Percentage of convergence solution with principle before hint
mutate (x, PX=((x$freq/Total_WP)*100))
AfterHint freq PX
1 0 1 50
# Frequency of convergence solution without principle before hint
dv <- d %>%
filter(Condition==2 & BeforeHint==1)
z = count(dv, 'BeforeHint')
#Percentage of convergence solution Without principle before hint
mutate (z, PZ=((z$freq/Total_WOP)*100))
BeforeHint freq PZ
1 1 1 100
# Frequency of convergence solution without principle after hint
dw <- d %>%
filter(Condition==2 & AfterHint==1)
a = count(dw, 'AfterHint')-z
#Percentage of convergence solution Without principle before hint
mutate (a, PA=((a$freq/Total_WOP)*100))
AfterHint freq PA
1 0 0 0
5.a The repository folder
Replication report could be found in GitHub folder “PilotA_V2”
5.b The rendered replication report.
TAB <-matrix(c(1,1,1,0),ncol = 2, byrow = TRUE)
colnames(TAB) <- c("Before_Hint","After_Hint")
rownames(TAB) <- c("With_Principle", "Without_Principle")
TAB <- as.table(TAB)
TAB
Before_Hint After_Hint
With_Principle 1 1
Without_Principle 1 0
barplot(TAB, beside = TRUE, legend=TRUE)
CHI = chisq.test(TAB, correct = T)
Warning in chisq.test(TAB, correct = T): Chi-squared approximation may be
incorrect
CHI
Pearson's Chi-squared test with Yates' continuity correction
data: TAB
X-squared = 4.6222e-32, df = 1, p-value = 1
attributes(CHI)
$names
[1] "statistic" "parameter" "p.value" "method" "data.name" "observed"
[7] "expected" "residuals" "stdres"
$class
[1] "htest"