Hi Chris,
# Calculate Effect Size #
cohen <- vector('list', nrow(results_glm$con.mat))
subdata<- function(x){
graph_attr(x)[[measures[1]]]
}
y<-sapply(g.glm, subdata)
fit <- RcppEigen::fastLmPure(X, y, method=2)
for (i in seq_along(cohen)) {
resids <- fit$residuals
sigma.squared <- fit$s
gamma <- results_glm$DT[contrast == i, gamma]
cohen[[i]] <- gamma / sqrt(sigma.squared)
}
# Calculate Vertex effect size
cohen <- NULL
subdata<- function(x){
vertex_attr(x)[[measures[i]]]
}
y<-t(sapply(g.glm, subdata))
fit <- apply(y, 2, function(x) RcppEigen::fastLmPure(X, x, method=2))
for (j in seq(nrow(results_glm$con.mat))) {
resids <- sapply(fit,with, residuals)
sigma.squared <- sapply(fit,with,s)
gamma <- results_glm$DT[contrast == j,gamma]
cohen <- c(cohen, gamma / sqrt(sigma.squared)) #cohen[[j]] <- gamma / sqrt(sigma.squared)
}
results_glm$DT[,cohen:=cohen]
Since brainGraph has been updated to v3.0.1, these command lines should be changed appropriately.
Could you please help me revise the above command lines ?
Another question: In brainGraph 3.0.1, it seems that "g.glm" has been replaced by "g[[i]]" for brainGraph_GLM which was not specified in the new userguide. Am I right?