This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# DDM simulation function | |
sim_ddm <- function(drift_rate, boundary_separation, bias, ndt, n_sims, seed = NULL) { | |
set.seed(seed) | |
sim_df = NULL | |
for (sim in 1:n_sims){ | |
step = 1 | |
value = bias | |
n = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task_comp_plot <- task_comp %>% | |
mutate(., phon = fct_recode(phon, "/b/" = "b", "/d/" = "d", "/g/" = "g", | |
"/p/" = "p", "/t/" = "t", "/k/" = "k"), | |
phon = fct_relevel(phon, '/b/', '/d/', '/g/', | |
'/p/', '/t/', '/k/')) %>% | |
ggplot(., aes(x = phon, y = vot_scaled, group = task_sum)) + | |
geom_hline(yintercept = 0, lty = 3) + | |
stat_interval(aes(y = .prediction), data = task_preds, | |
position = position_dodge(0.5)) + | |
stat_pointinterval(aes(y = .value, fill = factor(task_sum)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% !TEX encoding = UTF-8 Unicode | |
\documentclass[convert={density=400,size=500x500,outext=.png}]{standalone} | |
\usepackage{tikz} | |
\usetikzlibrary{backgrounds} | |
% \usepackage[active,tightpage,psfixbb]{preview} | |
\usepackage{tipa} | |
% \PreviewEnvironment{pgfpicture} | |
% \setlength\PreviewBorder{2pt} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_pm %>% | |
mutate(., grade = fct_relevel(grade, "pk3", "pk4", "kin", "1st")) %>% | |
ggplot(., aes(x = grade, y = response, color = group)) + | |
facet_grid(. ~ language) + | |
stat_summary(fun.data = mean_cl_boot, geom = 'pointrange', size = 1.5, | |
position = position_dodge(0.5), pch = 21, fill = "white") + | |
ylim(0, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GAM analysis ----------------------------------------------------------------- | |
# | |
# Resources: | |
# - https://arxiv.org/abs/1703.05339 | |
# - https://github.com/soskuthy/gamm_intro | |
# set modality to ordered variable and relevel so production is reference | |
prodShadow_gamm <- prodShadow %>% | |
filter(., group == 'midd', picName == 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load libraries | |
library("tidyverse") | |
library("TOSTER") | |
# Set seed for reproducibility | |
set.seed(10) | |
# Working memory means for 3 groups | |
wm_n <- rnorm(mean = 8.67, sd = 1.15, n = 12) | |
wm_nin <- rnorm(mean = 9.04, sd = 2.11, n = 26) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot vowel formants | |
# - Include elipses, | |
# - group/vowel means | |
# - greyscale | |
# Load tidyverse and phonR package (I choose this because you said you | |
# had alrady used it) | |
library(phonR) | |
library(tidyverse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
euc.dist <- function(x1, x2){ | |
x <- sqrt(sum((x1 - x2)^2)) | |
return(x) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################### | |
# Functions for linguistic research # | |
# Joseph V. Casillas # | |
# Last update: 12-10-2014 # | |
##################################### | |
# Calculate d prime in discrimination experiments. | |
# Takes a df with the columns: | |
# - stimDiff (actual stimuli are different) | |
# - stimSame (actual stimuli are the same) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot Spectrum Proportion | |
my_data$group <- factor(my_data$group, levels = c("EL", "NE", "LL")) | |
df<-with(my_data, aggregate(fpro, list(group=group, fstim=fstim), mean)) | |
df$se<-with(my_data, aggregate(fpro, list(group=group, fstim=fstim), function(x) sd(x)/sqrt(10)))[,3] | |
gp<-ggplot(df, aes(x=fstim, y=x, colour=group, ymin=x-se, ymax=x+se)) | |
gp +geom_line(aes(linetype=group), size = .4) + | |
geom_point(aes(shape=group)) + | |
geom_ribbon(alpha = 0.15, linetype=0) + | |
#geom_errorbar(aes(ymax=x+se, ymin=x-se)) + | |
ylim(0, 1) + |
NewerOlder