OSCR

The behavioral evidence of processing congruences and incongruences between Self- and Other-perspective-related representations during both perspective judgments.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § Methods › Statistical analysis ↔ yk2d9/R code for Congruency Beh analysis to share.R, lines 24–64 · score 0.55 · emmeans, lmerTest, lme4, marginal, model, Satterthwaite

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 892 lines · 25 KB · no license · 1 match

  1. ## Cong/Incong Beh analysis from (iEEG VPT exp)
  2. library(lme4) # usd in Multilevel MOdeling Center (Bristol) tutorial. gives the same results as nlme but this is more versatile for complicated nestings
  3. library(readxl)
  4. library(nlme) # used in Field's book
  5. library(car)
  6. library(tidyverse)
  7. library(rstatix)
  8. library(emmeans)
  9. library(ggpubr)
  10. library(ggplot2)
  11. library(lmerTest)
  12. library(dplyr)
  13. library(scales)
  14. library(simr)
  15. # for copying results
  16. write.excel <- function(res.aov,row.names=FALSE,col.names=TRUE,...) {
  17. write.table(res.aov,"clipboard",sep="\t",row.names=row.names,col.names=col.names,...)
  18. }
  19. # 19.08.25
  20. ## LMM for left/right Congruence effect on Accuracy
  21. dat <- read_excel("datapath")
  22. rintercept <- lmer(Accuracy ~ Congruence*Perspective + (1|ParticipantID), data = dat, REML = FALSE) # this by default gives treatment contrast with a reference level with alphabetical oder, i.e., SPJ in Perspective and Cong in Congruence
  23. summary(rintercept) # therefore the estimates are Perspective effect in Cong and Congruence effect in SPJ
  24. # When overal effect over all levels of another factor is needed marginal means averaged over all lvels of another factor is obtained by lsmeans function from emmeans
  25. # or default treatment coding can be manually adjusted to sum to zero coding before running the lmer
  26. # using this > dat$Congruence <- factor(dat$Congruence, levels = c("Cong", "Incong")); dat$Perspective <- factor(dat$Perspective, levels = c("SPJ", "VPT")); contrasts(dat$Congruence) <- cbind(Congruence = c(-0.5, 0.5)) in this paper about contrasts in detail Schad et al., 2020 but this sum to zero coding may not be optimal for ublanaced data (e.g. if some levels of a factor has more datapoints)
  27. #contrasts(dat$Perspective) <- cbind(Perspective = c(-0.5, 0.5))
  28. # contrasts(dat$Congruence)
  29. #contrasts(dat$Perspective)
  30. rslope <- lmer(Accuracy ~ Congruence*Perspective + (1+Congruence|ParticipantID), data = dat, REML = FALSE)
  31. summary(rslope)
  32. # comparing the models
  33. anova (rintercept,rslope)
  34. # Comparing marginal means of Congruence averaged over both levels of Perspective
  35. lsmeans(rslope, pairwise~Congruence, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  36. # Comparing marginal means of Perspective averaged over both levels of Congruence
  37. lsmeans(rslope, pairwise~Perspective, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  38. ## Plot by default plots with SEM- standard error of the mean
  39. bxp <- ggerrorplot(
  40. dat, x = "Perspective", y = "Accuracy", size = 1.3,
  41. color = "Congruence", palette = c("#0072B2", "#E69FBB")
  42. )
  43. bxp
  44. #
  45. bxp <- ggerrorplot(
  46. dat, x = "Perspective", y = "Accuracy", size = 1.3,
  47. color = "Congruence", palette = c("#0072B2", "#E69FBB"),
  48. facet.by = "Angle"
  49. )
  50. bxp
  51. # plot with VPT and SPJ with different shapes, Angle x axis, Congruence different colors
  52. library(ggplot2)
  53. library(dplyr)
  54. # Ensure your data is clean
  55. dat <- dat %>%
  56. filter(!is.na(Accuracy)) %>%
  57. mutate(
  58. Perspective = factor(Perspective, levels = c("SPJ", "VPT")),
  59. Congruence = factor(Congruence, levels = c("Cong", "Incong")),
  60. Angle = factor(Angle, levels = sort(unique(Angle)))
  61. )
  62. pd <- position_dodge(width = 0.6)
  63. ggplot(dat, aes(x = Angle, y = Accuracy*100, color = Congruence, shape = Perspective)) +
  64. stat_summary(
  65. fun = mean,
  66. geom = "point",
  67. size = 4,
  68. position = pd,
  69. na.rm = TRUE
  70. ) +
  71. stat_summary(
  72. fun.data = mean_se, # SEM
  73. geom = "errorbar",
  74. width = 0, # straight lines
  75. size = 1.2,
  76. position = pd,
  77. na.rm = TRUE
  78. ) +
  79. scale_color_manual(values = c("Cong" = "#0072B2", "Incong" = "#E69FBB")) +
  80. scale_shape_manual(values = c("SPJ" = 16, "VPT" = 17)) +
  81. labs(x = "Angle (°)", y = "Accuracy (%)", shape = "Perspective") +
  82. theme_classic(base_size = 14) +
  83. theme(
  84. axis.text.x = element_text(size = 14, angle = 0, hjust = 0.5, color = "black"),
  85. axis.text.y = element_text(size = 14, color = "black"),
  86. axis.title.x = element_text(size = 16, face = "bold", color = "black"),
  87. axis.title.y = element_text(size = 16, face = "bold", color = "black"),
  88. axis.line = element_line(size = 1.2, color = "black"), # thicker axes
  89. legend.title = element_text(size = 14),
  90. legend.text = element_text(size = 13),
  91. legend.position = "right"
  92. )
  93. ## the same as above only connecting lines between datpoints are added
  94. library(ggplot2)
  95. library(dplyr)
  96. # Ensure your data is clean
  97. dat <- dat %>%
  98. filter(!is.na(Accuracy)) %>%
  99. mutate(
  100. Perspective = factor(Perspective, levels = c("SPJ", "VPT")),
  101. Congruence = factor(Congruence, levels = c("Cong", "Incong")),
  102. Angle = factor(Angle, levels = sort(unique(Angle)))
  103. )
  104. pd <- position_dodge(width = 0.6)
  105. ggplot(dat, aes(x = Angle,
  106. y = Accuracy*100,
  107. color = Congruence,
  108. shape = Perspective,
  109. group = interaction(Congruence, Perspective))) +
  110. stat_summary(
  111. fun = mean,
  112. geom = "line",
  113. size = 1.2, # same thickness as axis lines
  114. position = pd,
  115. na.rm = TRUE
  116. ) +
  117. stat_summary(
  118. fun = mean,
  119. geom = "point",
  120. size = 4,
  121. position = pd,
  122. na.rm = TRUE
  123. ) +
  124. stat_summary(
  125. fun.data = mean_se,
  126. geom = "errorbar",
  127. width = 0,
  128. size = 1.2,
  129. position = pd,
  130. na.rm = TRUE
  131. ) +
  132. scale_color_manual(values = c("Cong" = "#0072B2", "Incong" = "#E69FBB")) +
  133. scale_shape_manual(values = c("SPJ" = 16, "VPT" = 17)) +
  134. labs(x = "Angle (°)", y = "Accuracy (%)", shape = "Perspective") +
  135. theme_classic(base_size = 14) +
  136. theme(
  137. axis.text.x = element_text(size = 14, angle = 0, hjust = 0.5, color = "black"),
  138. axis.text.y = element_text(size = 14, color = "black"),
  139. axis.title.x = element_text(size = 16, face = "bold", color = "black"),
  140. axis.title.y = element_text(size = 16, face = "bold", color = "black"),
  141. axis.line = element_line(size = 1.2, color = "black"),
  142. legend.title = element_text(size = 14),
  143. legend.text = element_text(size = 13),
  144. legend.position = "right"
  145. )
  146. ## compute means and SE
  147. means <- dat %>%
  148. group_by(Perspective, Congruence) %>%
  149. get_summary_stats(Accuracy, type = "mean_se")
  150. print(means)
  151. write.excel(means)
  152. ## compute means and SE
  153. means <- dat %>%
  154. group_by(Perspective, Angle, Congruence) %>%
  155. get_summary_stats(Accuracy, type = "mean_se")
  156. print(means)
  157. write.excel(means)
  158. ## LMM for left/right Congruence effect on RT
  159. dat <- read_excel("datapath")
  160. rintercept <- lmer(RT ~ Congruence*Perspective + (1|ParticipantID), data = dat, REML = FALSE)
  161. summary(rintercept)
  162. rslope <- lmer(RT ~ Congruence*Perspective + (1+Congruence|ParticipantID), data = dat, REML = FALSE)
  163. summary(rslope)
  164. # comparing the models
  165. anova (rintercept,rslope)
  166. # comparing estimated marginal means of Congruence averaged over both levels of Perspective
  167. lsmeans(rintercept, pairwise~Congruence, lmer.df = "satterthwaite", lmerTest.limit = 5685) # for RT on all responses incl 180 and 0 deg
  168. # comparing estimated marginal means of Congruence averaged over both levels of Perspective
  169. lsmeans(rintercept, pairwise~Perspective, lmer.df = "satterthwaite", lmerTest.limit = 5685)
  170. # posthoc
  171. lsmeans(rintercept, pairwise~Congruence|Perspective, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # for RT on all responses incl 180 and 0 deg
  172. ## Plot by default plots with SEM- standard error of the mean
  173. bxp <- ggerrorplot(
  174. dat, x = "Perspective", y = "RT", size = 1.3,
  175. color = "Congruence", palette = c("#0072B2", "#E69FBB")
  176. )
  177. bxp
  178. #
  179. bxp <- ggerrorplot(
  180. dat, x = "Perspective", y = "RT", size = 1.3,
  181. color = "Congruence", palette = c("#0072B2", "#E69FBB"),
  182. facet.by = "Angle"
  183. )
  184. bxp
  185. # plot with VPT and SPJ with different shapes, Angle x axis, Congruence different colors
  186. library(ggplot2)
  187. library(dplyr)
  188. # Ensure your data is clean
  189. dat <- dat %>%
  190. filter(!is.na(RT)) %>%
  191. mutate(
  192. Perspective = factor(Perspective, levels = c("SPJ", "VPT")),
  193. Congruence = factor(Congruence, levels = c("Cong", "Incong")),
  194. Angle = factor(Angle, levels = sort(unique(Angle)))
  195. )
  196. pd <- position_dodge(width = 0.6)
  197. ggplot(dat, aes(x = Angle, y = RT, color = Congruence, shape = Perspective)) +
  198. stat_summary(
  199. fun = mean,
  200. geom = "point",
  201. size = 4,
  202. position = pd,
  203. na.rm = TRUE
  204. ) +
  205. stat_summary(
  206. fun.data = mean_se, # SEM
  207. geom = "errorbar",
  208. width = 0, # straight lines
  209. size = 1.2,
  210. position = pd,
  211. na.rm = TRUE
  212. ) +
  213. scale_color_manual(values = c("Cong" = "#0072B2", "Incong" = "#E69FBB")) +
  214. scale_shape_manual(values = c("SPJ" = 16, "VPT" = 17)) +
  215. labs(x = "Angle (°)", y = "RT (s)", shape = "Perspective") +
  216. theme_classic(base_size = 14) +
  217. theme(
  218. axis.text.x = element_text(size = 14, angle = 0, hjust = 0.5, color = "black"),
  219. axis.text.y = element_text(size = 14, color = "black"),
  220. axis.title.x = element_text(size = 16, face = "bold", color = "black"),
  221. axis.title.y = element_text(size = 16, face = "bold", color = "black"),
  222. axis.line = element_line(size = 1.2, color = "black"), # thicker axes
  223. legend.title = element_text(size = 14),
  224. legend.text = element_text(size = 13),
  225. legend.position = "right"
  226. )
  227. ## same as above just with added lines to connedct thed datapoints
  228. library(ggplot2)
  229. library(dplyr)
  230. # Ensure your data is clean
  231. dat <- dat %>%
  232. filter(!is.na(RT)) %>%
  233. mutate(
  234. Perspective = factor(Perspective, levels = c("SPJ", "VPT")),
  235. Congruence = factor(Congruence, levels = c("Cong", "Incong")),
  236. Angle = factor(Angle, levels = sort(unique(Angle)))
  237. )
  238. pd <- position_dodge(width = 0.6)
  239. ggplot(dat, aes(x = Angle,
  240. y = RT,
  241. color = Congruence,
  242. shape = Perspective,
  243. group = interaction(Congruence, Perspective))) +
  244. stat_summary(
  245. fun = mean,
  246. geom = "line",
  247. size = 1.2, # same thickness as axis lines
  248. position = pd,
  249. na.rm = TRUE
  250. ) +
  251. stat_summary(
  252. fun = mean,
  253. geom = "point",
  254. size = 4,
  255. position = pd,
  256. na.rm = TRUE
  257. ) +
  258. stat_summary(
  259. fun.data = mean_se,
  260. geom = "errorbar",
  261. width = 0,
  262. size = 1.2,
  263. position = pd,
  264. na.rm = TRUE
  265. ) +
  266. scale_color_manual(values = c("Cong" = "#0072B2", "Incong" = "#E69FBB")) +
  267. scale_shape_manual(values = c("SPJ" = 16, "VPT" = 17)) +
  268. labs(x = "Angle (°)", y = "RT(S)", shape = "Perspective") +
  269. theme_classic(base_size = 14) +
  270. theme(
  271. axis.text.x = element_text(size = 14, angle = 0, hjust = 0.5, color = "black"),
  272. axis.text.y = element_text(size = 14, color = "black"),
  273. axis.title.x = element_text(size = 16, face = "bold", color = "black"),
  274. axis.title.y = element_text(size = 16, face = "bold", color = "black"),
  275. axis.line = element_line(size = 1.2, color = "black"),
  276. legend.title = element_text(size = 14),
  277. legend.text = element_text(size = 13),
  278. legend.position = "right"
  279. )
  280. ## same as above the RT plot with lines but the line is cut for Cong at 180 deg
  281. library(ggplot2)
  282. library(dplyr)
  283. # Ensure your data is clean
  284. dat <- dat %>%
  285. filter(!is.na(RT)) %>%
  286. mutate(
  287. Perspective = factor(Perspective, levels = c("SPJ", "VPT")),
  288. Congruence = factor(Congruence, levels = c("Cong", "Incong")),
  289. Angle = factor(Angle, levels = sort(unique(Angle)))
  290. )
  291. pd <- position_dodge(width = 0.6)
  292. ggplot(dat, aes(x = Angle,
  293. y = RT,
  294. color = Congruence,
  295. shape = Perspective,
  296. group = interaction(Congruence, Perspective))) +
  297. stat_summary(
  298. aes(y = RT), # ??? breaks Cong line at 180
  299. fun = mean,
  300. geom = "line",
  301. size = 1.2,
  302. position = pd,
  303. na.rm = TRUE
  304. ) +
  305. stat_summary(
  306. fun = mean,
  307. geom = "point",
  308. size = 4,
  309. position = pd,
  310. na.rm = TRUE
  311. ) +
  312. stat_summary(
  313. fun.data = mean_se,
  314. geom = "errorbar",
  315. width = 0,
  316. size = 1.2,
  317. position = pd,
  318. na.rm = TRUE
  319. ) +
  320. scale_color_manual(values = c("Cong" = "#0072B2", "Incong" = "#E69FBB")) +
  321. scale_shape_manual(values = c("SPJ" = 16, "VPT" = 17)) +
  322. labs(x = "Angle (°)", y = "RT (S)", shape = "Perspective") +
  323. theme_classic(base_size = 14) +
  324. theme(
  325. axis.text.x = element_text(size = 14, angle = 0, hjust = 0.5, color = "black"),
  326. axis.text.y = element_text(size = 14, color = "black"),
  327. axis.title.x = element_text(size = 16, face = "bold", color = "black"),
  328. axis.title.y = element_text(size = 16, face = "bold", color = "black"),
  329. axis.line = element_line(size = 1.2, color = "black"),
  330. legend.title = element_text(size = 14),
  331. legend.text = element_text(size = 13),
  332. legend.position = "right"
  333. )
  334. ## LMM for Horizontal/Overhead View Plane effect on Accuracy
  335. dat <- read_excel("datapath")
  336. rintercept <- lmer(Accuracy ~ Perspective*View + (1|ParticipantID), data = dat, REML = FALSE)
  337. summary(rintercept)
  338. rslope <- lmer(Accuracy ~ Perspective*View + (1+View|ParticipantID), data = dat, REML = FALSE)
  339. summary(rslope)
  340. anova (rintercept, rslope)
  341. # comparing marginal means for the effect of Perspective averaged over both levels of View plane
  342. lsmeans(rslope, pairwise~Perspective, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  343. # comparing marginal means for the effect of Perspective averaged over both levels of Perspective
  344. lsmeans(rslope, pairwise~View, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  345. #Posthoc on View Plane
  346. lsmeans(rslope, pairwise~View|Perspective, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  347. #Posthoc on Perspective
  348. lsmeans(rslope, pairwise~Perspective|View, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  349. # Plot
  350. bxp <- ggerrorplot(
  351. dat, x = "Perspective", y = "Accuracy", size = 1.3,
  352. color = "View", palette = c("#E69F00", "#56B4E9")
  353. )
  354. bxp
  355. # Plot for each VPT target angle (is different from Degree because all 8 anglees are separatelly without clockwise- counterclockwise grouping) separatelly
  356. bxp <- ggerrorplot(
  357. dat, x = "Perspective", y = "Accuracy", size = 1.3,
  358. color = "View", palette = c("#E69F00", "#56B4E9"),
  359. facet.by = "Angle"
  360. )
  361. bxp
  362. ## LMM for View Plane effect on RT
  363. dat <- read_excel("datapath")
  364. rintercept <- lmer(RT ~ Perspective*View + (1|ParticipantID), data = dat, REML = FALSE)
  365. summary(rintercept)
  366. rslope <- lmer(RT ~ Perspective*View + (1+View|ParticipantID), data = dat, REML = FALSE)
  367. summary(rslope)
  368. anova (rintercept, rslope)
  369. # comparing marginal means for the effect of Perspective averaged over both levels of View plane
  370. lsmeans(rslope, pairwise~Perspective, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  371. # comparing marginal means for the effect of Perspective averaged over both levels of Perspective
  372. lsmeans(rslope, pairwise~View, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  373. # posthoc on the effect of View
  374. lsmeans(rslope, pairwise~View|Perspective, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  375. # posthoc on the effect of Perspective
  376. lsmeans(rslope, pairwise~Perspective|View, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  377. # Plot
  378. bxp <- ggerrorplot(
  379. dat, x = "Perspective", y = "RT", size = 1.3,
  380. color = "View", palette = c("#E69F00", "#56B4E9")
  381. )
  382. bxp
  383. # Plot for each VPT target angle (is different from Degree because all 8 anglees are separatelly without clockwise- counterclockwise grouping) separatelly
  384. bxp <- ggerrorplot(
  385. dat, x = "Perspective", y = "RT", size = 1.3,
  386. color = "View", palette = c("#E69F00", "#56B4E9"),
  387. facet.by = "Angle"
  388. )
  389. bxp
  390. ## LMM for Degree effect on Accuracy
  391. dat <- read_excel("datapath")
  392. rintercept <- lmer(Accuracy ~ Perspective*Degree+ (1|ParticipantID), data = dat, REML = FALSE)
  393. summary(rintercept)
  394. rslope <- lmer(Accuracy ~ Perspective*Degree + (1+View|ParticipantID), data = dat, REML = FALSE)
  395. summary(rslope)
  396. anova (rintercept, rslope)
  397. #Posthoc on Degree
  398. lsmeans(rintercept, pairwise~Degree|Perspective, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  399. #Posthoc on Perspective
  400. lsmeans(rintercept, pairwise~Perspective|Degree, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  401. # Plot
  402. bxp <- ggerrorplot(
  403. dat, x = "Perspective", y = "Accuracy", size = 1.3,
  404. color = "Degree", palette = c("#7A7E8A", "#009E73", "#CC79A7")
  405. )
  406. bxp
  407. # Plot for each VPT target angle (is different from Degree because all 8 anglees are separatelly without clockwise- counterclockwise grouping) separatelly
  408. bxp <- ggerrorplot(
  409. dat, x = "Perspective", y = "Accuracy", size = 1.3,
  410. color = "Degree", palette = c("#7A7E8A", "#009E73", "#CC79A7"),
  411. facet.by = "Congruence"
  412. )
  413. bxp
  414. ## LMM for Degree effect on RT
  415. dat <- read_excel("datapath")
  416. rintercept <- lmer(RT ~ Perspective*Degree + (1|ParticipantID), data = dat, REML = FALSE)
  417. summary(rintercept)
  418. rslope <- lmer(RT ~ Perspective*Degree + (1+View|ParticipantID), data = dat, REML = FALSE)
  419. summary(rslope)
  420. anova (rintercept, rslope)
  421. # posthoc on the effect of View
  422. lsmeans(rslope, pairwise~Degree|Perspective, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  423. # posthoc on the effect of Perspective
  424. lsmeans(rslope, pairwise~Perspective|Degree, adjust="tukey", lmer.df = "satterthwaite", lmerTest.limit = 5685) # lmerTest.limit - number may need adjustment- if R recommnds
  425. # Plot
  426. bxp <- ggerrorplot(
  427. dat, x = "Perspective", y = "RT", size = 1.3,
  428. color = "Degree", palette = c("#7A7E8A", "#009E73", "#CC79A7")
  429. )
  430. bxp
  431. # Plot for each level of left/right Congruence
  432. bxp <- ggerrorplot(
  433. dat, x = "Perspective", y = "RT", size = 1.3,
  434. color = "Degree", palette = c("#7A7E8A", "#009E73", "#CC79A7"),
  435. facet.by = "Congruence"
  436. )
  437. bxp
  438. ###### simulation based sensitivity power analysis for lmer to justify the sample size
  439. library(simr)
  440. #### for accuracy
  441. ## the effect of Congruence in SPJ, Effect of Perspective in Congruent trials
  442. ## and Congruence Perspective interaction
  443. m <- lmer(
  444. Accuracy ~ Congruence * Perspective +
  445. (1 + Congruence | ParticipantID),
  446. data = dat,
  447. REML = FALSE
  448. )
  449. fixef(m)
  450. ### to determine with what power the analysis can detect 5% change
  451. fixef(m)["CongruenceIncong:PerspectiveVPT"] <- 0.05 # 0.05 depends on the unit of data, for accuracy it's 5% change
  452. ### test power for the interaction
  453. powerSim(m, test = fixed("CongruenceIncong:PerspectiveVPT", "sa"), nsim = 1000) # "sa" - satherwhite, nsim - number of simulations
  454. # as the results of the above code showed that
  455. # the 5% change in Accuracy can be detected with 92% power
  456. # now we test what difference can be detected with 80%, thus we decrease the effect size
  457. # https://thechangelab.stanford.edu/tutorials/power-analysis/post-hoc-power-sensitivity-analysis-using-the-sesoi/
  458. fixef(m)["CongruenceIncong:PerspectiveVPT"] <- 0.042
  459. powerSim(m, test = fixed("CongruenceIncong:PerspectiveVPT", "sa"), nsim = 1000)
  460. ### Congruence effect in SPJ
  461. m_acc<-fixef(m)["CongruenceIncong"] <- 0.05 # as this gives less than 80% power, below we increase the effect size
  462. powerSim(m, test = fixed("CongruenceIncong", "sa"), nsim = 1000)
  463. m_acc<-fixef(m)["CongruenceIncong"] <- 0.0551
  464. powerSim(m, test = fixed("CongruenceIncong", "sa"), nsim = 1000)
  465. ### Perspective effect in Congruent trials
  466. m_persp<-fixef(m)["PerspectiveVPT"] <- 0.05 # as this gives 100% power, below we decrease the effect size
  467. powerSim(m, test = fixed("PerspectiveVPT", "sa"), nsim = 1000)
  468. m_persp<-fixef(m)["PerspectiveVPT"] <- 0.03 # as this gives 100% power, below we decrease the effect size
  469. powerSim(m, test = fixed("PerspectiveVPT", "sa"), nsim = 1000)
  470. ### Congruence effect in VPT
  471. dat$Perspective <- factor(dat$Perspective,
  472. levels = c("SPJ", "VPT"))
  473. levels(dat$Perspective)
  474. dat$Perspective <- relevel(dat$Perspective, ref = "VPT") # so that reference level is VPT in the data to receive the identical results as
  475. # lsmeans(rslope, pairwise~Congruence, lmer.df = "satterthwaite", lmerTest.limit = 5777)
  476. # for VPT does and because simr can not woork with lsmeans
  477. # model for the reference level perspective
  478. m_VPTref <- lmer(
  479. Accuracy ~ Congruence * Perspective +
  480. (1 + Congruence | ParticipantID),
  481. data = dat,
  482. REML = FALSE
  483. )
  484. # with what power can the analysis detect the 4.2% change between Congruent and Incongruent conditions during VPT
  485. fixef(m_VPTref)["CongruenceIncong"] <- 0.055
  486. powerSim(m_VPTref, test = fixed("CongruenceIncong", "sa"), nsim = 1000)
  487. ### Perspective effect in Incongruent
  488. dat$Perspective <- factor(dat$Perspective,
  489. levels = c("SPJ", "VPT"))
  490. dat$Congruence <- factor(dat$Congruence,
  491. levels = c("Cong", "Incong"))
  492. levels(dat$Congruence)
  493. levels(dat$Perspective)
  494. dat$Congruence <- relevel(dat$Congruence, ref = "Incong") # changing the reference level
  495. m_IncongRef <- lmer(
  496. Accuracy ~ Congruence * Perspective +
  497. (1 + Congruence | ParticipantID),
  498. data = dat,
  499. REML = FALSE
  500. )
  501. fixef(m_IncongRef)["PerspectiveVPT"] <- 0.03
  502. powerSim(m_IncongRef, test = fixed("PerspectiveVPT", "sa"), nsim = 1000)
  503. ##### sensitivity power analysis for RT
  504. m_rt <- lmer(
  505. RT ~ Congruence * Perspective +
  506. (1 | ParticipantID),
  507. data = dat,
  508. REML = FALSE
  509. )
  510. # to determine with what power can the analysis detect 0.05 second change
  511. fixef(m_rt)["CongruenceIncong:PerspectiveVPT"] <- 0.05 # 0.05 depends on the unit of data, for accuracy it's 5% change
  512. ### test power for the interaction
  513. powerSim(m_rt, test = fixed("CongruenceIncong:PerspectiveVPT", "sa"), nsim = 1000) # "sa" - satherwhite, nsim - number of simulations
  514. # as the results of the above code showed that
  515. # the 0.05 second change in RTs can be detected with below 80% power
  516. # now we test what difference can be detected with 80%, thus we increase the effect size
  517. fixef(m_rt)["CongruenceIncong:PerspectiveVPT"] <- 0.0524
  518. powerSim(m_rt, test = fixed("CongruenceIncong:PerspectiveVPT", "sa"), nsim = 1000)
  519. ### Congruence effect in SPJ
  520. fixef(m_rt)["CongruenceIncong"] <- 0.05
  521. powerSim(
  522. m_rt,
  523. test = fixed("CongruenceIncong", "sa"),
  524. nsim = 1000
  525. )
  526. fixef(m_rt)["CongruenceIncong"] <- 0.037 # decreasing the effect size as 0.05 showed 97% power
  527. powerSim(
  528. m_rt,
  529. test = fixed("CongruenceIncong", "sa"),
  530. nsim = 1000
  531. )
  532. ### Perspective effect in Congruent trials
  533. fixef(m_rt)["PerspectiveVPT"] <- 0.037
  534. powerSim(
  535. m_rt,
  536. test = fixed("PerspectiveVPT", "sa"),
  537. nsim = 1000
  538. )
  539. ### Congruent in VPT
  540. ## relevel the model to VPT reference
  541. dat$Perspective <- factor(dat$Perspective,
  542. levels = c("SPJ", "VPT"))
  543. levels(dat$Perspective)
  544. dat_VPTref <- dat
  545. dat_VPTref$Perspective <- relevel(dat_VPTref$Perspective, ref = "VPT")
  546. m_rt_VPTref <- lmer(
  547. RT ~ Congruence * Perspective +
  548. (1 | ParticipantID),
  549. data = dat_VPTref,
  550. REML = FALSE
  551. )
  552. fixef(m_rt_VPTref)["CongruenceIncong"] <- 0.038
  553. powerSim(
  554. m_rt_VPTref,
  555. test = fixed("CongruenceIncong", "sa"),
  556. nsim = 1000
  557. )
  558. ### Perspective in Incongruent
  559. ## relevel the model to Incongruent reference
  560. dat$Perspective <- factor(dat$Perspective,
  561. levels = c("SPJ", "VPT"))
  562. dat$Congruence <- factor(dat$Congruence,
  563. levels = c("Cong", "Incong"))
  564. levels(dat$Congruence)
  565. levels(dat$Perspective)
  566. dat_IncongRef <- dat
  567. dat_IncongRef$Congruence <- relevel(dat_IncongRef$Congruence, ref = "Incong")
  568. m_rt_IncongRef <- lmer(
  569. RT ~ Congruence * Perspective +
  570. (1 | ParticipantID),
  571. data = dat_IncongRef,
  572. REML = FALSE
  573. )
  574. fixef(m_rt_IncongRef)["PerspectiveVPT"] <- 0.037
  575. powerSim(
  576. m_rt_IncongRef,
  577. test = fixed("PerspectiveVPT", "sa"),
  578. nsim = 1000
  579. )
  580. ## Sensitivity analysis to justify the sample size using t test and anova model
  581. # using t test
  582. library(pwr)
  583. pwr.t.test(
  584. n = 26, # number of participants
  585. sig.level = 0.05,
  586. power = 0.80,
  587. type = "paired"
  588. )
  589. ## using anova to test interaction terms
  590. pwr.anova.test(
  591. k = 4, # 2 (Congruence) × 2 (Perspective)
  592. n = 26,
  593. sig.level = 0.05,
  594. power = 0.80
  595. )

R code for Congruency Beh analysis to share.R, no license · at the source

Overview

Authors: Anna Gunia1,2,3, Adam Kalina4, Alena Javůrková4, Kamil Vlček1,2,4
  1. Institute of Physiology, The Czech Academy of Sciences,Prague, Czech Republic
  2. Institute of Psychology, The Czech Academy of Sciences,Prague, Czech Republic
  3. Third Faculty of Medicine, Charles University,Prague, Czech Republic
  4. Department of Neurology, Second Faculty of Medicine, Charles University, Motol University Hospital,Prague, Czech Republic
Institutions: Czech Academy of Sciences (Czechia); Charles University (Czechia)
Journal: Psychological research, volume 90, issue 4, article 134
Dates: received 25 September 2025; accepted 5 May 2026; published online 13 July 2026; in print 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1007/s00426-026-02311-8 · PMID 42439946 · PMCID PMC13364830 · OpenAlex W7168139286
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), cognitive (subfield)
Methods: Statistics, Physiology & signal measures
MeSH: Judgment*, Self Concept*, Social Perception*, Space Perception*, Temporal Lobe*, Visual Perception*, Adult, Female, Humans, Male, Parietal Lobe, Young Adult (* major topic)
Topic: Spatial Cognition and Navigation (Automotive Engineering, Engineering), according to OpenAlex
Funding: Grant Agency of Charles University (GAUK 254422); ERDF-Project Brain dynamics (CZ.02.01.01/00/22_008/0004643); Johannes Amos Comenius Programme (OP JAC) provided by MSMT (CZ.02.01.01/00/23_025/0008715); Czech Science Foundation (22-16874S)
Citations: not cited yet (Europe PMC); 70 references in the paper

Abstract

Daily, we make visuospatial self-perspective judgments from our actual perspective (SPJ). However, social contexts often require imagining another viewpoint—visuospatial perspective-taking (VPT). VPT is costlier than SPJ, and gets even costlier in autism, schizophrenia, and aging. One explanation is interference from self-related representations. This interference may reflect a mechanism that processes various self- and other-related representations, supported by the temporoparietal junction (TPJ). Moreover, reportedly other-related representations also influence SPJ, though this remains debated. An additional explanation for VPT difficulty in literature is the mental body-schema transformation needed to adopt another perspective at greater angular disparities between perspectives. However, studies often confounded angle with left/right representational incongruence between perspectives. In our previous iEEG study, we found robust TPJ activity during both SPJ and VPT, possibly reflecting the processing of self-other representations. To test whether self-other representations are processed during both perspective judgments, we analyzed behavioral data from the same participants. We categorized trials by an object’s left/right congruence between the perspectives. We hypothesized that if self-other representations are processed during both judgments, participants will show greater difficulty in incongruent vs. congruent scenarios during SPJ and VPT. Linear mixed model analysis confirmed this: for both SPJ and VPT, errors were higher on incongruent than congruent trials. These findings show that self-other representations are processed in both SPJ and VPT, and incongruent ones cause interference, highlight left/right congruence as a key factor in VPT studies, and motivate further research with a similar approach on TPJ’s role in processing multimodal self-other representations.

Supplementary Information: The online version contains supplementary material available at https://doi.org/10.1007/s00426-026-02311-8.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

OSF wuapg

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (1), R (1)
Size: 5 files, 2 scripts
Software Heritage: not checked
Found in: “Data availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: car (1 file), emmeans (1 file), ggplot2 (1 file), ggpubr (1 file), lme4 (1 file), lmerTest (1 file), nlme (1 file), rstatix (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
2 files
At the source: osf.io/wuapg/

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 2 scripts, each with its path and the digest of its content;
  • 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability

The data and code that support the findings of this study are available in the Open Science Framework at https://osf.io/wuapg/.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 2, 28 September 2026

  • Publisher: n/a → Springer Science+Business Media

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 12 MeSH terms, 4 funders, 62 references.

Cite

This paper

Gunia, A., Kalina, A., Javůrková, A., & Vlček, K. (2026). The behavioral evidence of processing congruences and incongruences between Self- and Other-perspective-related representations during both perspective judgments. Psychological research, 90(4), 134. https://doi.org/10.1007/s00426-026-02311-8

BibTeX

@article{gunia2026behavioral,
author = {Gunia, Anna and Kalina, Adam and Javůrková, Alena and Vlček, Kamil},
title = {{The behavioral evidence of processing congruences and incongruences between Self- and Other-perspective-related representations during both perspective judgments}},
journal = {Psychological research},
year = {2026},
month = jul,
volume = {90},
number = {4},
pages = {134},
publisher = {Springer Science+Business Media},
issn = {0340-0727},
doi = {10.1007/s00426-026-02311-8},
url = {https://doi.org/10.1007/s00426-026-02311-8},
pmid = {42439946},
pmcid = {PMC13364830}
}

RIS

TY - JOUR
AU - Gunia, Anna
AU - Kalina, Adam
AU - Javůrková, Alena
AU - Vlček, Kamil
TI - The behavioral evidence of processing congruences and incongruences between Self- and Other-perspective-related representations during both perspective judgments
T2 - Psychological research
J2 - Psychol Res
PY - 2026
DA - 2026/07/13
VL - 90
IS - 4
SP - 134
SN - 0340-0727
PB - Springer Science+Business Media
DO - 10.1007/s00426-026-02311-8
UR - https://doi.org/10.1007/s00426-026-02311-8
LA - en
ER -

CSL-JSON

{
"id": "10.1007/s00426-026-02311-8",
"type": "article-journal",
"title": "The behavioral evidence of processing congruences and incongruences between Self- and Other-perspective-related representations during both perspective judgments",
"container-title": "Psychological research",
"author": [
{
"family": "Gunia",
"given": "Anna"
},
{
"family": "Kalina",
"given": "Adam"
},
{
"family": "Javůrková",
"given": "Alena"
},
{
"family": "Vlček",
"given": "Kamil"
}
],
"container-title-short": "Psychol Res",
"volume": "90",
"issue": "4",
"page": "134",
"DOI": "10.1007/s00426-026-02311-8",
"PMID": "42439946",
"PMCID": "PMC13364830",
"ISSN": "0340-0727",
"publisher": "Springer Science+Business Media",
"URL": "https://doi.org/10.1007/s00426-026-02311-8",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
13
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1111/psyp.70265 [code]
Neurocognitive Dynamics of Translating Information From a Spatial Map Into Action.
Journal: Psychophysiology
In common: nlme, car, emmeans, 5 other tools, cognitive, 5 references
[2] doi:10.1126/sciadv.aec9291 [code]
Computational mechanisms of perception in autism revealed using games inspired by rodent operant tasks.
Journal: Science advances
In common: nlme, rstatix, car, 5 other tools, cognitive
[3] doi:10.1016/j.neuroimage.2026.122115 [code]
Midfrontal theta power relates to response speeding following frustrative nonreward.
Journal: NeuroImage
In common: rstatix, car, emmeans, 5 other tools, cognitive
[4] doi:10.1038/s41467-026-73865-9 [code]
Histamine shapes the neurocomputational dynamics of human learning.
Journal: Nature communications
In common: rstatix, car, emmeans, 5 other tools, cognitive
[5] doi:10.1016/j.nicl.2026.104012 [code]
Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.
Journal: NeuroImage. Clinical
In common: nlme, rstatix, car, 5 other tools
[6] doi:10.1038/s41398-026-04010-9 [code]
Bullying victimization and brain development: a longitudinal structural magnetic resonance imaging study from adolescence to early adulthood.
Journal: Translational psychiatry
In common: nlme, rstatix, emmeans, 5 other tools
[7] doi:10.1073/pnas.2606871123 [code]
Oxytocin modulates the neurocomputational mechanisms engaged in learning rank relationships in social networks.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: nlme, car, emmeans, 5 other tools
[8] doi:10.1038/s41467-026-72934-3 [code]
Multi-focal ultrasound neuromodulation to the dorsal anterior cingulate cortex disrupts behavioural and neural pain processing.
Journal: Nature communications
In common: rstatix, car, emmeans, 5 other tools
[9] doi:10.3390/ijms27135713 [code]
Chronic Administration of Marinobufagenin in Mice Causes Hyperlocomotion and Decrease in Anxiety by Altering Monoamine Turnover Unaccompanied by Motor Deficits or Oxidative Stress.
Journal: International journal of molecular sciences
In common: rstatix, car, emmeans, 5 other tools
[10] doi:10.1126/sciadv.aeb8106 [code]
A thyroid hormone-mediated opsin switch initiates metamorphosis in a proto-vertebrate.
Journal: Science advances
In common: rstatix, car, emmeans, 5 other tools

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.