You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix vignette data handling and strengthen connectivity validation
benchmark_datasets: use bind_rows to build comparison data frame correctly.
functional_connectivity: rebuild dataset after injecting network signal,
use name-based column lookup for seed stats, and add stricter recovery
assertions (significance rates, top-rank enrichment).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
With the model fitted, we can now extract the connectivity statistics. The t-statistic for the seed regressor at each voxel tells us how strongly that voxel's activity relates to the seed after accounting for drift.
158
163
159
164
```{r extract-connectivity-stats}
160
-
# Find the seed coefficient in our design matrix
161
-
design_mat <- design_matrix(fmodel)
162
-
seed_cols <- grep("seed", colnames(design_mat), value = TRUE)
165
+
# Extract connectivity statistics using the estimate output itself
166
+
all_stats <- as.matrix(stats(fit, type = "estimates"))
167
+
seed_cols <- grep("seed", colnames(all_stats), value = TRUE)
163
168
if (length(seed_cols) == 0) {
164
-
stop("No seed column found in design matrix")
169
+
stop("No seed estimate found in fitted model output")
all_stats <- as.matrix(stats(fit, type = "estimates"))
171
-
t_seed <- as.numeric(all_stats[, seed_col_idx])
172
+
t_seed <- as.numeric(all_stats[, seed_col_name])
172
173
173
174
# Also get p-values for significance testing
174
175
all_pvals <- as.matrix(p_values(fit, type = "estimates"))
175
-
p_seed <- as.numeric(all_pvals[, seed_col_idx])
176
+
p_seed <- as.numeric(all_pvals[, seed_col_name])
176
177
177
178
# Check the distribution of our connectivity map
178
179
summary(t_seed)
179
180
```
180
181
181
182
## Validating the Results
182
183
183
-
Since we know which voxels belong to our simulated network, we can check whether our connectivity analysis successfully recovered them. Voxels in the network should show significantly higher connectivity statistics than background voxels.
184
+
Since we know which voxels belong to our simulated network, we can check whether our connectivity analysis successfully recovered them. Voxels in the network should have much larger t-statistics than background voxels and should dominate the top-ranked discoveries.
The network voxels show substantially stronger connectivity with the seed, confirming that our method successfully identifies functionally connected regions.
216
+
The network voxels dominate the top-ranked statistics and are significant far more often than background voxels, confirming that the fitted model recovers the injected connectivity pattern rather than a diffuse background effect.
0 commit comments