p<-c("tidyverse", "mgcv", "gamm4", "itsadug")
lapply(p, library, character.only= T)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag(): dplyr, stats
## Loading required package: nlme
##
## Attaching package: 'nlme'
## The following object is masked from 'package:dplyr':
##
## collapse
## This is mgcv 1.8-12. For overview type 'help("mgcv-package")'.
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
##
## expand
## Loading required package: lme4
##
## Attaching package: 'lme4'
## The following object is masked from 'package:nlme':
##
## lmList
## This is gamm4 0.2-4
## Loading required package: plotfunctions
##
## Attaching package: 'plotfunctions'
## The following object is masked from 'package:ggplot2':
##
## alpha
## Loaded package itsadug 2.2 (see 'help("itsadug")' ).
## [[1]]
## [1] "dplyr" "purrr" "readr" "tidyr" "tibble"
## [6] "ggplot2" "tidyverse" "stats" "graphics" "grDevices"
## [11] "utils" "datasets" "methods" "base"
##
## [[2]]
## [1] "mgcv" "nlme" "dplyr" "purrr" "readr"
## [6] "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [11] "graphics" "grDevices" "utils" "datasets" "methods"
## [16] "base"
##
## [[3]]
## [1] "gamm4" "lme4" "Matrix" "mgcv" "nlme"
## [6] "dplyr" "purrr" "readr" "tidyr" "tibble"
## [11] "ggplot2" "tidyverse" "stats" "graphics" "grDevices"
## [16] "utils" "datasets" "methods" "base"
##
## [[4]]
## [1] "itsadug" "plotfunctions" "gamm4" "lme4"
## [5] "Matrix" "mgcv" "nlme" "dplyr"
## [9] "purrr" "readr" "tidyr" "tibble"
## [13] "ggplot2" "tidyverse" "stats" "graphics"
## [17] "grDevices" "utils" "datasets" "methods"
## [21] "base"
#data
dta<- read.csv("GSR_2Hz.csv", h=T)
# wide to long format
dtaL <- gather(dta, Time, GSR, T01:T24, na.rm= TRUE)
dtaL<-dtaL[-which(dtaL$Emotion == "Positive"),]
dtaL<-dtaL[-which(dtaL$Emotion == "Neutral"),]
#刪除drop數太多的受試者
dtaL<-dtaL[-which(dtaL$Subject == "3"),]
dtaL<-dtaL[-which(dtaL$Subject == "9"),]
dtaL<-dtaL[-which(dtaL$Subject == "10"),]
dtaL<-dtaL[-which(dtaL$Subject == "15"),]
dtaL<-dtaL[-which(dtaL$Subject == "19"),]
#新增秒數
dtaL$Times <- ifelse(dtaL$Time == "T01", "-1.5",
ifelse(dtaL$Time == "T02", "-1.0",
ifelse(dtaL$Time == "T03", "-0.5",
ifelse(dtaL$Time == "T04", "0",
ifelse(dtaL$Time == "T05", "0.5",
ifelse(dtaL$Time == "T06", "1.0",
ifelse(dtaL$Time == "T07", "1.5",
ifelse(dtaL$Time == "T08", "2.0",
ifelse(dtaL$Time == "T09", "2.5",
ifelse(dtaL$Time == "T10", "3.0",
ifelse(dtaL$Time == "T11", "3.5",
ifelse(dtaL$Time == "T12", "4.0",
ifelse(dtaL$Time == "T13", "4.5",
ifelse(dtaL$Time == "T14", "5.0",
ifelse(dtaL$Time == "T15", "5.5",
ifelse(dtaL$Time == "T16", "6.0",
ifelse(dtaL$Time == "T17", "6.5",
ifelse(dtaL$Time == "T18", "7.0",
ifelse(dtaL$Time == "T19", "7.5",
ifelse(dtaL$Time == "T20", "8.0",
ifelse(dtaL$Time == "T21", "8.5",
ifelse(dtaL$Time == "T22", "9.0",
ifelse(dtaL$Time == "T23", "9.5",
ifelse(dtaL$Time == "T24", "10.0", "X"))))))))))))))))))))))))
dtaL$Subject<- factor(dtaL$Subject)
dtaL$Times<- as.numeric(dtaL$Times)
dtaL_dis<- dtaL[which(dtaL$Emotion=="Disgust"),]
dtaL_fear<- dtaL[which(dtaL$Emotion=="Fear"),]
dtaL_sad<- dtaL[which(dtaL$Emotion=="Sad"),]
head(dtaL)
Subject Strategy Emotion Time GSR Times
1 22 Control Sad T01 6.1566267 -1.5
2 2 Reapp Fear T01 -1.7034267 -1.5
7 2 Suppr Fear T01 0.0316400 -1.5
8 22 Reapp Disgust T01 0.3666067 -1.5
13 2 Distr Disgust T01 4.0856733 -1.5
18 2 Control Fear T01 3.5803867 -1.5
str(dtaL)
'data.frame': 17208 obs. of 6 variables:
$ Subject : Factor w/ 20 levels "1","2","4","5",..: 17 2 2 17 2 2 4 9 17 2 ...
$ Strategy: Factor w/ 4 levels "Control","Distr",..: 1 3 4 3 2 1 3 1 1 1 ...
$ Emotion : Factor w/ 5 levels "Disgust","Fear",..: 5 2 2 1 1 2 5 5 1 1 ...
$ Time : chr "T01" "T01" "T01" "T01" ...
$ GSR : num 6.1566 -1.7034 0.0316 0.3666 4.0857 ...
$ Times : num -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 ...
ot <- theme_set(theme_bw())
ggplot(dtaL, aes(Times, GSR, group = Strategy, color = Strategy))+
facet_grid(.~Emotion)+
stat_summary(fun.y = mean, geom = "point", alpha = .5)+
stat_summary(fun.y = mean, geom = "line", alpha = .5)+
stat_smooth(aes(group = Strategy), method = "gam", formula = y ~ s(x, bs="fs", m=1),
se = F, lwd = .8) +
labs(x = "Time", y = "GSR") +
guides(col = guide_legend(reverse = TRUE)) +
theme(legend.position = c(.9, .8))

#fitting the data
m0 <- bam(GSR ~ Emotion +Strategy+ Times + s(Times) +
s(Subject, bs="re")+
s(Subject, Strategy, bs="re")+
s(Subject, Emotion, bs="re"),
correlation = corAR1(form = ~ 1|Times),
data = dtaL, method = "ML")
summary(m0)
Family: gaussian
Link function: identity
Formula:
GSR ~ Emotion + Strategy + Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re")
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.00000 0.00000 NA NA
EmotionFear -0.24716 0.15997 -1.545 0.1224
EmotionSad -0.35716 0.15998 -2.233 0.0256 *
StrategyDistr -0.12763 0.18466 -0.691 0.4895
StrategyReapp -0.20646 0.18464 -1.118 0.2635
StrategySuppr -0.02903 0.18462 -0.157 0.8751
Times 0.02945 0.04800 0.614 0.5395
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Times) 2.559 3.186 3.634 0.00995 **
s(Subject) 11.543 19.000 941.603 9.67e-05 ***
s(Subject,Strategy) 57.024 76.000 58.299 0.05146 .
s(Subject,Emotion) 39.222 57.000 74.263 0.06999 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rank: 175/176
R-sq.(adj) = 0.158 Deviance explained = 16.3%
-ML = 37744 Scale est. = 4.6063 n = 17208
acf(resid(m0), main="Residual autocorrelation")

m1 <- bam(GSR ~ Emotion *Strategy* Times + s(Times) +
s(Subject, bs="re")+
s(Subject, Strategy, bs="re")+
s(Subject, Emotion, bs="re"),
correlation = corAR1(form = ~ 1|Times),
data = dtaL, method = "ML")
summary(m1)
Family: gaussian
Link function: identity
Formula:
GSR ~ Emotion * Strategy * Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re")
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.000000 0.000000 NA NA
EmotionFear 0.096474 0.199620 0.483 0.628897
EmotionSad -0.040122 0.199620 -0.201 0.840707
StrategyDistr 0.121482 0.219182 0.554 0.579414
StrategyReapp 0.337299 0.219182 1.539 0.123846
StrategySuppr 0.068779 0.218852 0.314 0.753319
Times 0.024827 0.048864 0.508 0.611400
EmotionFear:StrategyDistr -0.290635 0.178791 -1.626 0.104063
EmotionSad:StrategyDistr -0.015764 0.179197 -0.088 0.929903
EmotionFear:StrategyReapp -0.469645 0.178791 -2.627 0.008628 **
EmotionSad:StrategyReapp -0.359164 0.178791 -2.009 0.044570 *
EmotionFear:StrategySuppr -0.079797 0.178387 -0.447 0.654645
EmotionSad:StrategySuppr -0.037363 0.178387 -0.209 0.834101
EmotionFear:Times -0.007176 0.023014 -0.312 0.755173
EmotionSad:Times -0.132315 0.023014 -5.749 9.11e-09 ***
StrategyDistr:Times -0.057214 0.023111 -2.476 0.013311 *
StrategyReapp:Times -0.095902 0.023111 -4.150 3.35e-05 ***
StrategySuppr:Times -0.034731 0.023014 -1.509 0.131274
EmotionFear:StrategyDistr:Times -0.042616 0.032615 -1.307 0.191359
EmotionSad:StrategyDistr:Times 0.111327 0.032684 3.406 0.000660 ***
EmotionFear:StrategyReapp:Times -0.011301 0.032615 -0.346 0.728985
EmotionSad:StrategyReapp:Times 0.110713 0.032615 3.395 0.000689 ***
EmotionFear:StrategySuppr:Times -0.043575 0.032546 -1.339 0.180631
EmotionSad:StrategySuppr:Times 0.106298 0.032546 3.266 0.001093 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Times) 2.57 3.2 3.041 0.0228 *
s(Subject) 11.54 19.0 954.968 9.47e-05 ***
s(Subject,Strategy) 57.06 76.0 59.330 0.0503 .
s(Subject,Emotion) 39.23 57.0 75.239 0.0687 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rank: 192/193
R-sq.(adj) = 0.165 Deviance explained = 17.1%
-ML = 37664 Scale est. = 4.568 n = 17208
acf(resid(m1), main="Residual autocorrelation")

m2 <- bam(GSR ~ Emotion *Strategy* Times + s(Times) +
s(Subject, bs="re")+
s(Subject, Strategy, bs="re")+
s(Subject, Emotion, bs="re")+
s(Subject, Times, bs="re")+
s(Times, Subject, bs="fs", m=1),
correlation = corAR1(form = ~ 1|Times),
data = dtaL, method = "ML")
summary(m2)
Family: gaussian
Link function: identity
Formula:
GSR ~ Emotion * Strategy * Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re") +
s(Subject, Times, bs = "re") + s(Times, Subject, bs = "fs",
m = 1)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.000000 0.000000 NA NA
EmotionFear 0.096474 0.191528 0.504 0.614474
EmotionSad -0.040122 0.191528 -0.209 0.834073
StrategyDistr 0.122064 0.212204 0.575 0.565151
StrategyReapp 0.346909 0.212204 1.635 0.102111
StrategySuppr 0.068779 0.211877 0.325 0.745474
Times 0.011512 0.044984 0.256 0.798024
EmotionFear:StrategyDistr -0.291217 0.173905 -1.675 0.094036 .
EmotionSad:StrategyDistr -0.012830 0.174305 -0.074 0.941324
EmotionFear:StrategyReapp -0.479254 0.173905 -2.756 0.005860 **
EmotionSad:StrategyReapp -0.368774 0.173905 -2.121 0.033974 *
EmotionFear:StrategySuppr -0.079797 0.173506 -0.460 0.645586
EmotionSad:StrategySuppr -0.037363 0.173506 -0.215 0.829505
EmotionFear:Times -0.007176 0.022384 -0.321 0.748515
EmotionSad:Times -0.132315 0.022384 -5.911 3.46e-09 ***
StrategyDistr:Times -0.057340 0.022481 -2.551 0.010763 *
StrategyReapp:Times -0.098179 0.022481 -4.367 1.27e-05 ***
StrategySuppr:Times -0.034731 0.022384 -1.552 0.120771
EmotionFear:StrategyDistr:Times -0.042490 0.031724 -1.339 0.180480
EmotionSad:StrategyDistr:Times 0.110667 0.031793 3.481 0.000501 ***
EmotionFear:StrategyReapp:Times -0.009023 0.031724 -0.284 0.776087
EmotionSad:StrategyReapp:Times 0.112990 0.031724 3.562 0.000370 ***
EmotionFear:StrategySuppr:Times -0.043575 0.031656 -1.377 0.168674
EmotionSad:StrategySuppr:Times 0.106298 0.031656 3.358 0.000787 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Times) 1.36279 1.452 0.160 0.671
s(Subject) 0.02733 19.000 0.001 0.980
s(Subject,Strategy) 59.38241 76.000 12.740 <2e-16 ***
s(Subject,Emotion) 41.30409 57.000 11.354 <2e-16 ***
s(Subject,Times) 12.38960 19.000 6.558 <2e-16 ***
s(Times,Subject) 77.50362 179.000 119.031 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rank: 392/393
R-sq.(adj) = 0.21 Deviance explained = 22%
-ML = 37265 Scale est. = 4.3215 n = 17208
acf(resid(m2), main="Residual autocorrelation")

#model comparison
compareML(m0,m1)
m0: GSR ~ Emotion + Strategy + Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re")
m1: GSR ~ Emotion * Strategy * Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re")
Chi-square test of ML scores
-----
Model Score Edf Chisq Df p.value Sig.
1 m0 37743.54 12
2 m1 37663.75 29 79.786 17.000 < 2e-16 ***
AIC difference: 126.99, model m1 has lower AIC.
compareML(m1,m2)
m1: GSR ~ Emotion * Strategy * Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re")
m2: GSR ~ Emotion * Strategy * Times + s(Times) + s(Subject, bs = "re") +
s(Subject, Strategy, bs = "re") + s(Subject, Emotion, bs = "re") +
s(Subject, Times, bs = "re") + s(Times, Subject, bs = "fs",
m = 1)
Chi-square test of ML scores
-----
Model Score Edf Chisq Df p.value Sig.
1 m1 37663.75 29
2 m2 37264.72 32 399.036 3.000 < 2e-16 ***
AIC difference: 865.83, model m2 has lower AIC.
#fitting plot_ sad
par(mfrow=c(1,4))
plot_smooth(m2, view="Times", cond=list(Emotion="Sad", Strategy= "Control"),ylim = c(-1.5,1.0), main = "Sad(Control)")
Summary:
* Emotion : factor; set to the value(s): Sad.
* Strategy : factor; set to the value(s): Control.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Sad", Strategy= "Suppr"),ylim = c(-1.5,1.0), main = "Sad(Suppression)")
Summary:
* Emotion : factor; set to the value(s): Sad.
* Strategy : factor; set to the value(s): Suppr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Sad", Strategy= "Reapp"),ylim = c(-1.5,1.0), main = "Sad(Reappraisal)")
Summary:
* Emotion : factor; set to the value(s): Sad.
* Strategy : factor; set to the value(s): Reapp.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Sad", Strategy= "Distr"),ylim = c(-1.5,1.0), main = "Sad(Distraction)")
Summary:
* Emotion : factor; set to the value(s): Sad.
* Strategy : factor; set to the value(s): Distr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.

#fitting plot_Disgust
par(mfrow=c(1,4))
plot_smooth(m2, view="Times", cond=list(Emotion="Disgust", Strategy= "Control"),ylim = c(-1.0,0.5), main = "Disgust(Control)")
Summary:
* Emotion : factor; set to the value(s): Disgust.
* Strategy : factor; set to the value(s): Control.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Disgust", Strategy= "Suppr"),ylim = c(-1.0,0.5), main = "Disgust(Suppression)")
Summary:
* Emotion : factor; set to the value(s): Disgust.
* Strategy : factor; set to the value(s): Suppr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Disgust", Strategy= "Reapp"),ylim = c(-1.0,0.5), main = "Disgust(Reappraisal)")
Summary:
* Emotion : factor; set to the value(s): Disgust.
* Strategy : factor; set to the value(s): Reapp.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Disgust", Strategy= "Distr"),ylim = c(-1.0,0.5), main = "Disgust(Distraction)")
Summary:
* Emotion : factor; set to the value(s): Disgust.
* Strategy : factor; set to the value(s): Distr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.

#fitting plot_Fear
par(mfrow=c(1,4))
plot_smooth(m2, view="Times", cond=list(Emotion="Fear", Strategy= "Control"),ylim = c(-1.5,1.0), main = "Fear(Control)")
Summary:
* Emotion : factor; set to the value(s): Fear.
* Strategy : factor; set to the value(s): Control.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Fear", Strategy= "Suppr"),ylim = c(-1.5,1.0), main = "Fear(Suppression)")
Summary:
* Emotion : factor; set to the value(s): Fear.
* Strategy : factor; set to the value(s): Suppr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Fear", Strategy= "Reapp"),ylim = c(-1.5,1.0), main = "Fear(Reappraisal)")
Summary:
* Emotion : factor; set to the value(s): Fear.
* Strategy : factor; set to the value(s): Reapp.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m2, view="Times", cond=list(Emotion="Fear", Strategy= "Distr"),ylim = c(-1.5,1.0), main = "Fear(Distraction)")
Summary:
* Emotion : factor; set to the value(s): Fear.
* Strategy : factor; set to the value(s): Distr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.

#sad
m_sad <- bam(GSR ~ Strategy* Times + s(Times) +
s(Subject, bs="re")+
s(Subject, Strategy, bs="re")+
s(Subject, Times, bs="re")+
s(Times, Subject, bs="fs", m=1),
correlation = corAR1(form = ~ 1|Times),
data = dtaL_sad, method = "ML")
summary(m_sad)
Family: gaussian
Link function: identity
Formula:
GSR ~ Strategy * Times + s(Times) + s(Subject, bs = "re") + s(Subject,
Strategy, bs = "re") + s(Subject, Times, bs = "re") + s(Times,
Subject, bs = "fs", m = 1)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.00000 0.00000 NA NA
StrategyDistr 0.14151 0.26234 0.539 0.589629
StrategyReapp -0.02186 0.26214 -0.083 0.933530
StrategySuppr 0.03142 0.26214 0.120 0.904609
Times -0.11556 0.04873 -2.372 0.017743 *
StrategyDistr:Times 0.05029 0.01872 2.686 0.007242 **
StrategyReapp:Times 0.01481 0.01864 0.795 0.426772
StrategySuppr:Times 0.07157 0.01864 3.840 0.000124 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Times) 1.000084 1 0.179 0.673
s(Subject) 0.004192 19 0.000 0.999
s(Subject,Strategy) 65.155468 76 13.123 < 2e-16 ***
s(Subject,Times) 15.200160 19 13.008 < 2e-16 ***
s(Times,Subject) 36.887433 179 10.245 5.4e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rank: 316/317
R-sq.(adj) = 0.29 Deviance explained = 30.6%
-ML = 11443 Scale est. = 2.9954 n = 5736
#disgust
m_dis <- bam(GSR ~ Strategy* Times + s(Times) +
s(Subject, bs="re")+
s(Subject, Strategy, bs="re")+
s(Subject, Times, bs="re")+
s(Times, Subject, bs="fs", m=1),
correlation = corAR1(form = ~ 1|Times),
data = dtaL_dis, method = "ML")
summary(m_dis)
Family: gaussian
Link function: identity
Formula:
GSR ~ Strategy * Times + s(Times) + s(Subject, bs = "re") + s(Subject,
Strategy, bs = "re") + s(Subject, Times, bs = "re") + s(Times,
Subject, bs = "fs", m = 1)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.00000 0.00000 NA NA
StrategyDistr 0.13260 0.31311 0.424 0.67194
StrategyReapp 0.35412 0.31311 1.131 0.25811
StrategySuppr 0.06878 0.31290 0.220 0.82603
Times 0.01492 0.05574 0.268 0.78890
StrategyDistr:Times -0.05835 0.02067 -2.823 0.00477 **
StrategyReapp:Times -0.09811 0.02067 -4.747 2.12e-06 ***
StrategySuppr:Times -0.03473 0.02058 -1.688 0.09146 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Times) 2.318e+00 2.632 1.313 0.173
s(Subject) 1.492e-04 19.000 0.000 0.943
s(Subject,Strategy) 6.531e+01 76.000 15.182 < 2e-16 ***
s(Subject,Times) 9.588e+00 19.000 2.497 3.32e-09 ***
s(Times,Subject) 6.952e+01 179.000 39.419 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rank: 316/317
R-sq.(adj) = 0.319 Deviance explained = 33.7%
-ML = 11994 Scale est. = 3.6513 n = 5712
#fear
m_fear <- bam(GSR ~ Strategy* Times + s(Times) +
s(Subject, bs="re")+
s(Subject, Strategy, bs="re")+
s(Subject, Times, bs="re")+
s(Times, Subject, bs="fs", m=1),
correlation = corAR1(form = ~ 1|Times),
data = dtaL_fear, method = "ML")
summary(m_fear)
Family: gaussian
Link function: identity
Formula:
GSR ~ Strategy * Times + s(Times) + s(Subject, bs = "re") + s(Subject,
Strategy, bs = "re") + s(Subject, Times, bs = "re") + s(Times,
Subject, bs = "fs", m = 1)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.00000 0.00000 NA NA
StrategyDistr -0.16915 0.29985 -0.564 0.57270
StrategyReapp -0.13235 0.29985 -0.441 0.65897
StrategySuppr -0.01102 0.29985 -0.037 0.97069
Times 0.02906 0.05508 0.528 0.59776
StrategyDistr:Times -0.09983 0.02414 -4.136 3.59e-05 ***
StrategyReapp:Times -0.10720 0.02414 -4.441 9.11e-06 ***
StrategySuppr:Times -0.07831 0.02414 -3.244 0.00118 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Approximate significance of smooth terms:
edf Ref.df F p-value
s(Times) 1.000162 1 0.007 0.934
s(Subject) 0.006482 19 0.000 0.966
s(Subject,Strategy) 61.975130 76 9.433 < 2e-16 ***
s(Subject,Times) 13.669471 19 6.923 < 2e-16 ***
s(Times,Subject) 49.039647 179 16.701 1.7e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rank: 316/317
R-sq.(adj) = 0.256 Deviance explained = 27.3%
-ML = 12977 Scale est. = 5.0251 n = 5760
#fitting plot_ sad
par(mfrow=c(1,4))
plot_smooth(m_sad, view="Times", cond=list(Strategy= "Control"), ylim = c(-1.5,1.0), main = "Sad(Control)")
Summary:
* Strategy : factor; set to the value(s): Control.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_sad, view="Times", cond=list(Strategy= "Suppr"), ylim = c(-1.5,1.0), main = "Sad(Suppression)")
Summary:
* Strategy : factor; set to the value(s): Suppr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_sad, view="Times", cond=list(Strategy= "Reapp"), ylim = c(-1.5,1.0), main = "Sad(Reappraisal)")
Summary:
* Strategy : factor; set to the value(s): Reapp.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_sad, view="Times", cond=list(Strategy= "Distr"), ylim = c(-1.5,1.0), main = "Sad(Distraction)")
Summary:
* Strategy : factor; set to the value(s): Distr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.

#fitting plot_Disgust
par(mfrow=c(1,4))
plot_smooth(m_dis, view="Times", cond=list(Strategy= "Control"), ylim = c(-1.5,1.0), main = "Disgust(Control)")
Summary:
* Strategy : factor; set to the value(s): Control.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_dis, view="Times", cond=list(Strategy= "Suppr"), ylim = c(-1.5,1.0), main = "Disgust(Suppression)")
Summary:
* Strategy : factor; set to the value(s): Suppr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_dis, view="Times", cond=list(Strategy= "Reapp"), ylim = c(-1.5,1.0), main = "Disgust(Reappraisal)")
Summary:
* Strategy : factor; set to the value(s): Reapp.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_dis, view="Times", cond=list(Strategy= "Distr"), ylim = c(-1.5,1.0), main = "Disgust(Distraction)")
Summary:
* Strategy : factor; set to the value(s): Distr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.

#fitting plot_Fear
par(mfrow=c(1,4))
plot_smooth(m_fear, view="Times", cond=list(Strategy= "Control"), ylim = c(-2.5,1), main = "Fear(Control)")
Summary:
* Strategy : factor; set to the value(s): Control.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_fear, view="Times", cond=list(Strategy= "Suppr"), ylim = c(-2.5,1), main = "Fear(Suppression)")
Summary:
* Strategy : factor; set to the value(s): Suppr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_fear, view="Times", cond=list(Strategy= "Reapp"), ylim = c(-2.5,1), main = "Fear(Reappraisal)")
Summary:
* Strategy : factor; set to the value(s): Reapp.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
plot_smooth(m_fear, view="Times", cond=list(Strategy= "Distr"), ylim = c(-2.5,1), main = "Fear(Distraction)")
Summary:
* Strategy : factor; set to the value(s): Distr.
* Times : numeric predictor; with 30 values ranging from -1.500000 to 10.000000.
* Subject : factor; set to the value(s): 1.
