NB_avg %>%
mutate(cluster = dbscan::dbscan(cbind(accuracy,rts), eps = 0.5, minPts = 3)$cluster) %>%
ggplot(aes(targets, accuracy, color=factor(cluster))) +
ggtitle("targets (window = 8 trials)", "NOTE: each point is a single participant") +
geom_point(alpha=0.3) +
#geom_smooth(method='lm', se = F) +
facet_wrap(~condition)
NB_avg %>%
ggplot(aes(lures, accuracy, color=condition)) +
ggtitle("lures (window = 8 trials)", "NOTE: each point is a single participant") +
geom_point(alpha=0.3) +
geom_smooth(method='lm', se = F)
NB_avg %>%
ggplot(aes(skewness, accuracy, color=condition)) +
ggtitle("skewness (window = 8 trials)", "NOTE: each point is a single participant") +
geom_point(alpha=0.3) +
geom_smooth(method='lm', se = F)
NB_avg %>%
ggplot(aes(lumpiness, accuracy, color=condition)) +
ggtitle("lumpiness", "NOTE: each point is a single participant") +
geom_point(alpha=0.3) +
geom_smooth(method='lm', se = F)
NB_avg %>%
ggplot(aes(lumpiness, rts, color=condition)) +
ggtitle("lumpiness (window = 8 trials)", "NOTE: each point is a single participant") +
xlab("lumpiness") +
ylab("Average RT") +
geom_point(alpha=0.3) +
geom_smooth(method='lm', se = F)
nback <- NB_modified
nback %>%
mutate(block=as.factor(block)) %>%
mutate(trial=as.factor(trial)) %>%
mutate(condition=ifelse(condition=='2-back',2,3)) %>%
#filter(condition=='3-back') %>%
#mutate(correct=as.numeric(correct)) %>%
inspect_cor(show_plot = T)
averaged_nback <- NB_avg
averaged_nback %>%
mutate(condition=ifelse(condition=='2-back',2,3)) %>%
inspect_cor(show_plot = T)
base.df <- data.frame(x=100-base.roc$specificities,
y=base.roc$sensitivities,
auc = base.roc$auc[1],
model="base")
extd.df <- data.frame(x=100-extd.roc$specificities,
y=extd.roc$sensitivities,
auc = extd.roc$auc[1],
model="extended")
chance.df <- data.frame(x=1:100, y=1:100, model=" ", auc=50)
library(tidyverse)
library(ggrepel)
dats <- rbind(extd.df, base.df, chance.df)
to_auc_label <- function(model, auc) {
paste(model,
"\nAUC=",
format(auc, digits=3),
sep = ""
)
}
dats$label = NA
dats[174,]$label = to_auc_label("Extended Model", dats[174,]$auc)
dats[647,]$label = to_auc_label("Base Model", dats[647,]$auc)
dats %>%
ggplot(aes(x=x, y=y,
group=model,
color = model,
linetype = factor(model))) +
geom_path(size=0.8) +
geom_label_repel(aes(label=label), na.rm = TRUE, box.padding = 1) +
xlab("100% - Specificity") +
ylab("Sensitivity") +
theme_linedraw() +
#scale_x_continuous(labels = scales::percent) +
#scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Greens") +
scale_color_manual(values=c("black", "#808080", "gray")) +
theme(legend.position = "none", text=element_text(size=16,family="Helvetica Neue Light"))
#library(extrafont)
#font_import(pattern = "Helvet.*")
ggsave("fig1.png", plot = last_plot(), width = 4, height = 4)
#embed_fonts("fig1.pdf")
library(latex2exp)
tex_labels <- c(
TeX("Stimulus"),
TeX("Vocabulary Size ($x_v$)"),
TeX("Recent Lures Ratio"),
TeX("Skewness"),
TeX("Targets Ratio"),
TeX("Lures Ratio"),
TeX("$N$"),
TeX("Recent Skewness"),
TeX("Recent Lumpiness"),
TeX("Recent Vocabulary Size"),
TeX("Recent Targets Ratio")
)
feat_names <- c(
"Stimulus",
"Vocabulary Size",
"Recent Lures Ratio",
"Skewness",
"Targets Ratio",
"Lures Ratio",
"N",
"Recent Skewness",
"Recent Lumpiness",
"Recent Vocabulary Size",
"Recent Targets Ratio"
)
#attStats(boruta_result) %>%
# arrange(desc(meanImp)) %>%
boruta_scores %>%
mutate(feature = rev(feat_names)) %>%
# ggplot(aes(x=reorder(feature,meanImp,), y=meanImp, fill=decision, label=meanImp)) +
ggplot(aes(x=reorder(feature,meanImp,), y=meanImp, label=meanImp)) +
geom_bar(stat = "identity",width = 0.75) +
#geom_text(size = 3, position = position_stack(vjust = 1.2)) +
ylab("Relative Importance Score") +
xlab("Feature") +
theme_linedraw() +
scale_fill_manual(values=c("#303030","#a0a0a0")) +
labs(fill = "Feature Selection Decision") +
theme(
text=element_text(size=16),
axis.title.y = element_blank(),
axis.text.x = element_text(size = 14,colour = "#a0a0a0"),
axis.text.y = element_text(size = 22),
axis.title.x = element_text(size = 22),
legend.position = "none",
# legend.position = c(.95, .15),
legend.justification = c("right", "top"),
legend.box.just = "right",
legend.margin = margin(5, 5, 5, 5)
) +
coord_flip()
ggsave("fig2.png", plot = last_plot(), width = 9, height = 4.75)