Psych 251: Pilot Progress Check 1

Author

Sarah Wu

Published

October 26, 2025

Analysis of Pilot A data

Most of the code is taken from Smiley and Fisher’s (2022) OSF site. I adapted it slightly to fit the Qualtrics survey I implemented.

The link to the Qualtrics preview is here.

Load libraries

### Install (if not already installed) and load all packages
if(!require("psych")) {install.packages("psych"); require("psych")}
Loading required package: psych
if(!require("tidyverse")) {install.packages("tidyverse"); require("tidyverse")}
Loading required package: tidyverse
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ ggplot2::%+%()   masks psych::%+%()
✖ ggplot2::alpha() masks psych::alpha()
✖ dplyr::filter()  masks stats::filter()
✖ dplyr::lag()     masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
if(!require("effsize")) {install.packages("effsize"); require("effsize")}
Loading required package: effsize

Attaching package: 'effsize'

The following object is masked from 'package:psych':

    cohen.d
if(!require("stats")) {install.packages("stats"); require("stats")}
if(!require("ggpubr")) {install.packages("ggpubr"); require("ggpubr")}
Loading required package: ggpubr
if(!require("lmerTest")) {install.packages("lmerTest"); require("lmerTest")}
Loading required package: lmerTest
Loading required package: lme4
Loading required package: Matrix

Attaching package: 'Matrix'

The following objects are masked from 'package:tidyr':

    expand, pack, unpack


Attaching package: 'lmerTest'

The following object is masked from 'package:lme4':

    lmer

The following object is masked from 'package:stats':

    step
if(!require("inflection")) {install.packages("inflection"); require("inflection")}
Loading required package: inflection
if(!require("sjPlot")) {install.packages("sjPlot"); require("sjPlot")}
Loading required package: sjPlot
if(!require("svglite")) {install.packages("svglite"); require("svglite")}
Loading required package: svglite
#### Experiment 1 - Aerogel (S1) #### ------------------------------------------------------
s1.df <- read_csv(file = "data/pilot_a.csv") %>% 
  filter(DistributionChannel=="preview") %>% 
  rename(Condition=FL_9_DO,
         Eval = attitude)
Rows: 12 Columns: 23
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (23): StartDate, EndDate, Status, Progress, Duration (in seconds), Finis...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
### DATA WRANGLING & CLEANING ###

## Participant Info
s1.df$gender <- factor(s1.df$gender,labels=c("Male","Female","Other"))
names(s1.df)[1] <- "Subject"

s1.df$age <- as.numeric(s1.df$age)
s1.df$Eval <- as.numeric(s1.df$Eval)

### END DATA WRANGLING & CLEANING ###

## Demographic information
table(s1.df$gender)

  Male Female  Other 
     4      3      2 
mean(s1.df$age)
[1] 33.1
sd(s1.df$age)
[1] 14.93281
### Analysis WITHOUT exclusions ###
## Descriptive statistics
s1.cond.difs <- s1.df %>% 
  group_by(Condition) %>% 
  summarize(EVAL = mean(Eval), EVAL_SD = sd(Eval))
s1.cond.difs
# A tibble: 2 × 3
  Condition   EVAL EVAL_SD
  <chr>      <dbl>   <dbl>
1 BornAfter   1.75   0.957
2 BornBefore NA     NA    
## T-test and Cohen's d
## Condition refers to born after/before invention (experimentally manipulated)
t.test(Eval ~ Condition, var.equal=TRUE, data=s1.df)

    Two Sample t-test

data:  Eval by Condition
t = 1.8884, df = 7, p-value = 0.1009
alternative hypothesis: true difference in means between group BornAfter and group BornBefore is not equal to 0
95 percent confidence interval:
 -0.3404524  3.0404524
sample estimates:
 mean in group BornAfter mean in group BornBefore 
                    1.75                     0.40 
effsize::cohen.d(Eval ~ Condition, data = s1.df)

Cohen's d

d estimate: 1.266774 (large)
95 percent confidence interval:
    lower     upper 
-0.469496  3.003044 
### END Analysis WITHOUT exclusions

### Analysis WITH exclusions ###
## Exclusion
table(s1.df$attn_check_1) # 

3 
9 
table(s1.df$attn_check_2)

2 
9 
table(s1.df$prior_knowledge) # 

0 1 
5 4 
# Exclude participants who failed manipulation check or knew what aerogel was
s1.df.f <- s1.df %>% 
  filter(attn_check_1 == "3" & attn_check_2 == "2") %>% 
  filter(prior_knowledge != "1")

## Descriptive statistics
s1.cond.difs <- s1.df.f %>% group_by(Condition) %>% summarise(EVAL = mean(Eval), EVAL_SD = sd(Eval))
s1.cond.difs
# A tibble: 2 × 3
  Condition   EVAL EVAL_SD
  <chr>      <dbl>   <dbl>
1 BornAfter      2    1   
2 BornBefore     0    1.41
## T-test and Cohen's d 
t.test(Eval ~ Condition, var.equal=TRUE, data=s1.df.f)

    Two Sample t-test

data:  Eval by Condition
t = 1.8974, df = 3, p-value = 0.154
alternative hypothesis: true difference in means between group BornAfter and group BornBefore is not equal to 0
95 percent confidence interval:
 -1.354593  5.354593
sample estimates:
 mean in group BornAfter mean in group BornBefore 
                       2                        0 
effsize::cohen.d(Eval ~ Condition, data = s1.df.f)

Cohen's d

d estimate: 1.732051 (large)
95 percent confidence interval:
    lower     upper 
-1.655922  5.120024 
## Age and Evaluation correlation
cor.test(s1.df.f$age, s1.df.f$Eval)

    Pearson's product-moment correlation

data:  s1.df.f$age and s1.df.f$Eval
t = 0.54772, df = 3, p-value = 0.622
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.7912338  0.9350437
sample estimates:
      cor 
0.3015113 
## Make Condition.Num numeric so it can be scaled in lm
s1.df.f$Condition.Num <- rep(NA, length(s1.df.f$Condition))
s1.df.f$Condition.Num[s1.df.f$Condition=="BornAfter"] <- 0
s1.df.f$Condition.Num[s1.df.f$Condition=="BornBefore"] <- 1

## Age and Condition multilevel model
s1.lm.age <- lm(scale(Eval) ~ scale(age) + scale(Condition.Num), data = s1.df.f)
summary(s1.lm.age)

Call:
lm(formula = scale(Eval) ~ scale(age) + scale(Condition.Num), 
    data = s1.df.f)

Residuals:
         1          2          3          4          5 
-6.742e-01  2.188e-17  6.742e-01  6.742e-01 -6.742e-01 
attr(,"scaled:center")
[1] 1.2
attr(,"scaled:scale")
[1] 1.483

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)
(Intercept)           2.438e-17  4.264e-01   0.000    1.000
scale(age)            4.933e-18  5.222e-01   0.000    1.000
scale(Condition.Num) -7.385e-01  5.222e-01  -1.414    0.293

Residual standard error: 0.9535 on 2 degrees of freedom
Multiple R-squared:  0.5455,    Adjusted R-squared:  0.09091 
F-statistic:   1.2 on 2 and 2 DF,  p-value: 0.4545