15 fMRI :: FIR ~ task
TODO
- load tsv
- concatenate
- per time column, calculate mean and variance
- plot
plot_timeseries_onefactor <- function(df, iv1, mean, error, xlab, ylab, ggtitle, color) {
n_points <- 100 # Number of points for interpolation
g <- ggplot(
data = df,
aes(
x = .data[[iv1]],
y = .data[[mean]],
group = 1,
color = color
),
cex.lab = 1.5,
cex.axis = 2,
cex.main = 1.5,
cex.sub = 1.5
) +
geom_errorbar(aes(
ymin = (.data[[mean]] - .data[[error]]),
ymax = (.data[[mean]] + .data[[error]]),
color = color
), width = .1, alpha=0.8) +
geom_line() +
geom_point(color=color) +
ggtitle(ggtitle) +
xlab(xlab) +
ylab(ylab) +
theme_classic() +
theme(aspect.ratio = .6) +
expand_limits(x = 3.25) +
scale_color_manual("",
values = color) +
# scale_fill_manual("",
# values = color) +
theme(
legend.position = c(.99, .99),
legend.justification = c("right", "top"),
legend.box.just = "right",
legend.margin = margin(6, 6, 6, 6)
) +
theme(legend.key = element_rect(fill = "white", colour = "white")) +
theme_bw()
return(g)
}
15.1 parameters {TODO: ignore}
# parameters
main_dir <- dirname(dirname(getwd()))
datadir <- file.path(main_dir, 'analysis/fmri/nilearn/glm/fir')
analysis_folder = paste0("model52_iv-6cond_dv-firglasserSPM_ttl2")
analysis_dir <-
file.path(main_dir,
"analysis",
"mixedeffect",
analysis_folder,
as.character(Sys.Date())) # nolint
dir.create(analysis_dir,
showWarnings = FALSE,
recursive = TRUE)
save_dir <- analysis_dir