Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/literate/explanations/b2b_why.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ using UnfoldSim
using UnfoldDecode
using DataFrames
using Statistics
include("../../example_rename_events.jl")
include("../../../example_rename_events.jl")

#
# # [Motivation for BacktoBack](@id explainer-b2b)
# ## Introduction

# “Back-to-Back” regression (B2B) is an approach to estimate the decoding performance from a set of correlated factors.
# Why do we need this? Let's have a look at a simple example:
# ![My Image](pic/dog_and_cat.png)
# ![My Image](assets/dog_and_cat.png)
#
# Imagine we record EEG data from an eyetracking experiment, and investigate each fixation (a resting period of the eye) as an event for an ERP.
# Imagine, we have both cats and dogs, but that we also make large and small eye-movements.
Expand All @@ -27,10 +27,10 @@ evts = example_rename_events(evts)
# To make the example more impressive, let's add an orthogonal variable `vegetable`. But this variable is special:
# It is correlated with the covariate `eye_movement_size`.
evts.vegetable .=
["tomato", "carrot"][1 .+ (evts.eye_movement_size.+10 .* rand(size(evts, 1)).>7.5)];
["tomato", "carrot"][1 .+ (evts.eye_movement_size .+ 10 .* rand(size(evts, 1)) .> 7.5)];
cor(evts.eye_movement_size, evts.vegetable .== "carrot")

# ![My Image](pic/dog_and_cat_and_vegetable.png)
# ![My Image](assets/dog_and_cat_and_vegetable.png)

# Summarized, we have three independent variables: `animal`, `eye_movement_size`, and `vegetable`, with the latter two being correlated.

Expand All @@ -57,7 +57,7 @@ function run_b2b(f)

results = coeftable(m)
results.estimate = abs.(results.estimate)
results = results[results.coefname.!="(Intercept)", :]
results = results[results.coefname .!= "(Intercept)", :]
results.formula .= string(f)
return results
end;
Expand Down
Loading