ID
int64
1
1.07k
Comment
stringlengths
8
1.13k
Code
stringlengths
10
4.28k
Label
stringclasses
4 values
Source
stringlengths
21
21
File
stringlengths
4
82
901
one participant has a typing error in the age variable (stated he was 2). Set to NA.
mst1[which(mst1$age == 2), "age"] <- NA
Data Variable
https://osf.io/m6pb2/
Data_preparation_Sample_D.r
902
association between vote and ideology
ggplot(dat, aes(x = Ideology, y = Percent.Vote.Rep)) + geom_vline(xintercept = .50, color = "gray50", linetype = 2) + geom_hline(yintercept = .50, color = "gray50", linetype = 2) + stat_poly_line() + stat_correlation(label.x = "left", small.r = TRUE) + geom_point() + geom_text_repel(size = 3, aes(label = Group)) + labs(y = "Proportion Voting Republican", x = "Ideology") + coord_cartesian(xlim = c(0, 1), ylim = c(0, 1)) + theme_cowplot() ggsave("figures/predictor_scatter.pdf", width = 5.5, height = 5)
Data Variable
https://osf.io/hfxsb/
basic_mods.R
903
Make a dot and a line color column depending on the significance level Check significance level and if significant add respective color to new column
ageR = data.frame(dotCol = rep(ifelse(summary(lm(initLevel ~ age, data = id_df))$coefficients[2,4]< 0.05, "khaki3", "lightgrey"), length(unique(id_df$userCode))), lineCol = rep(ifelse(summary(lm(initLevel ~ age, data = id_df))$coefficients[2,4]< 0.05, "cyan4", "darkgrey"), length(unique(id_df$userCode)))) educR = data.frame(dotCol = rep(ifelse(summary(lm(initLevel ~ educ_y, data = id_df))$coefficients[2,4]< 0.05, "khaki3", "lightgrey"), length(unique(id_df$userCode))), lineCol = rep(ifelse(summary(lm(initLevel ~ educ_y, data = id_df))$coefficients[2,4]< 0.05, "cyan4", "darkgrey"), length(unique(id_df$userCode)))) blpR = data.frame(dotCol = rep(ifelse(summary(lm(initLevel ~ BLP, data = id_df))$coefficients[2,4]< 0.05, "khaki3", "lightgrey"), length(unique(id_df$userCode))), lineCol = rep(ifelse(summary(lm(initLevel ~ BLP, data = id_df))$coefficients[2,4]< 0.05, "cyan4", "darkgrey"), length(unique(id_df$userCode)))) actR = data.frame(dotCol = rep(ifelse(summary(lm(initLevel ~ Act_total, data = id_df))$coefficients[2,4]< 0.05, "khaki3", "lightgrey"), length(unique(id_df$userCode))), lineCol = rep(ifelse(summary(lm(initLevel ~ Act_total, data = id_df))$coefficients[2,4]< 0.05, "cyan4", "darkgrey"), length(unique(id_df$userCode)))) motivR = data.frame(dotCol = rep(ifelse(summary(lm(initLevel ~ socioAffect_init, data = id_df))$coefficients[2,4]< 0.05, "khaki3", "lightgrey"), length(unique(id_df$userCode))), lineCol = rep(ifelse(summary(lm(initLevel ~ socioAffect_init, data = id_df))$coefficients[2,4]< 0.05, "cyan4", "darkgrey"), length(unique(id_df$userCode)))) tmp = rbind.data.frame(ageR, educR, blpR, actR, motivR) corrDF = cbind(corrDF, tmp)
Visualization
https://osf.io/wcfj3/
2_idDiffs.R
904
Sample from those names 200 times, with replacement
animal <- sample(categories, 200, replace = TRUE)
Statistical Modeling
https://osf.io/eks6u/
demo_script_2018_10_02.R
905
Create random variables Use rnorm() with varying means and SDs
length <- rnorm(200, 30, 8) weight <- rnorm(200, 4, 2) happiness <- rnorm(200, 3.5, 1)
Data Variable
https://osf.io/eks6u/
demo_script_2018_10_02.R
906
Examine descriptive statistics Use the pipe, group_by(), and summarise() to get means, SDs, and medians for each category
animal_data %>% group_by(animal) %>% summarise( weight_mean = mean(weight), weight_sd = sd(weight), weight_median = median(weight) )
Data Variable
https://osf.io/eks6u/
demo_script_2018_10_02.R
907
Subset data to include only the first two categories Use filter() to select only rows that pass the given logical test
subset_1 <- animal_data %>% filter(animal == "puppy" | animal == "kitten")
Data Variable
https://osf.io/eks6u/
demo_script_2018_10_02.R
908
Use subset for ttest Welch's ttest
t.test(weight ~ animal, data = subset_1)
Statistical Test
https://osf.io/eks6u/
demo_script_2018_10_02.R
909
plot spaghettiplot for minute 1 and minute 5
df_1_5 <- rbind(df_min1, df_min5) df_1_5 <- df_1_5 %>% mutate(range=droplevels(range)) p <- ggplot(data = df_1_5, aes(x = range, y = count, group = pp)) p + geom_point() p + geom_line() p + geom_line() + facet_grid(. ~ condition) p <- ggplot(data = df_min, aes(x = range, y = count, group = pp)) p + geom_point() p + geom_line() p + geom_line() + facet_grid(. ~ condition)
Visualization
https://osf.io/xh36s/
behavior_analyses.R
910
do 3 way anova including the factor in which condition they are in
bfFull = anovaBF(count ~ condition + range + experiment + condition:range:experiment, data = df_b) bfFull[4]/bfFull[3] bfFull[18]/bfFull[17] bf1 = anovaBF(count ~ condition + range + experiment, data = df_b)
Statistical Test
https://osf.io/xh36s/
behavior_analyses.R
911
pc: critical pvalue Overview: Creates a vector of the same length as the number of tests submitted to pcurve, significant and not, and computes the proportion of pvalues expected to be smaller than {pc} given the d.f. and outputs the entire vector, with NA values where needed Ftests (& thus ttests)
prop=ifelse(family=="f" & p<.05,1-pf(qf(1-pc,df1=df1, df2=df2),df1=df1, df2=df2, ncp=ncp33),NA)
Statistical Test
https://osf.io/ptfye/
Analysis.R
912
Create vector that numbers studies 1 to N,includes n.s. studies
k=seq(from=1,to=length(raw))
Data Variable
https://osf.io/ptfye/
Analysis.R
913
1.2 Parse the entered text into usable statistical results 1.3 Create test type indicator
stat=substring(raw,1,1) #stat: t,f,z,c,r test=ifelse(stat=="r","t",stat) #test: t,f,z,c (r-->t)
Statistical Test
https://osf.io/ptfye/
Analysis.R
914
Make red dot at the estimate
points(hat,min(fit,na.rm=TRUE),pch=19,col="red",cex=2)
Visualization
https://osf.io/ptfye/
Analysis.R
915
This loop creates a vector, blue, with 5 elements, with the proportions of p.01,p.02...p.05
for (i in c(.01,.02,.03,.04,.05)) blue=c(blue,sum(ps==i,na.rm=TRUE)/ksig*100)
Data Variable
https://osf.io/ptfye/
Analysis.R
916
FIG 3: scree plot for parallel analysis
rscree<-as.data.frame(cbind(spar$fa.values, spar$fa.simr)) colnames(rscree)<-c("Actual","Resampled") rscree$item<-seq.int(1, 12, 1) refplot<-pivot_longer(rscree, cols=1:2, names_to="Method") refplot2<-refplot %>% filter(item<5) iscree<-as.data.frame(cbind(ipar$fa.values, ipar$fa.simr)) colnames(iscree)<-c("Actual","Resampled") iscree$item<-seq.int(1, 8, 1) insplot<-pivot_longer(iscree, cols=1:2, names_to="Method") insplot2<-insplot %>% filter(item<5) refeig<-ggline(refplot2, x="item", y="value", group = "Method", color="Method", size=1.1, palette = paletteer_d("palettetown::tangela", direction=-1), xlab="Factor", ylab="Eigenvalue", title="Self-reflection")+ theme_minimal_hgrid(font_size=12, font_family = "Fira Sans Medium") scree.a<-ggpar(refeig, ylim = c(0,6), yticks.by=1, legend = c(.7,.77), legend.title = "") scree.a inseig<-ggline(insplot2, x="item", y="value", group = "Method", color="Method", size=1.1, palette = paletteer_d("palettetown::tangela", direction=-1), xlab="Factor", ylab="", title="Insight")+ theme_minimal_hgrid(font_size=12, font_family = "Fira Sans Medium") scree.b<-ggpar(inseig, ylim = c(0, 6), yticks.by=1, legend = c(.7,.77), legend.title = "") scree.b
Visualization
https://osf.io/qsa5w/
SRIS,FullScaleIRTModelsandPlots.R
917
make sure data are in chronological order
pollenData <- pollenData[order(pollenData$age),] lakeData <- lakeData[order(lakeData$age),] charcoalData <- charcoalData[order(charcoalData$age),] tail(pollenData) tail(lakeData) tail(charcoalData)
Data Variable
https://osf.io/7h94n/
Malawi_interpolation.R
918
examine descriptives of newly created variables here we are combining the dplyr and summarytools packages to subset the data and then get descriptives
eid_dat %>% dplyr::select(swl_mean, meim_ex_mean, meim_co_mean) %>% summarytools::descr()
Data Variable
https://osf.io/9gq4a/
Getting Started With R - Script Key.R
919
step 6: multiple regression with exploration and commitment predicting SWL this function is in base R so no package to call
regression <- lm(swl_mean ~ meim_ex_mean + meim_co_mean, data=eid_dat) summary(regression) confint(regression)
Statistical Modeling
https://osf.io/9gq4a/
Getting Started With R - Script Key.R
920
step 7: create scattterplots using ggplot2 scatterplot of exploration with SWL there are many more options you can play with for customization. I just included some basics here
ex_swl_scatter <- ggplot2::ggplot(eid_dat, aes(meim_ex_mean, swl_mean)) + geom_point() + ggtitle("My Scatterplot") + xlab("Ethnic Identity Exploration (mean)") + ylab("Satisfaction with Life (mean)") + geom_smooth(method="lm") ex_swl_scatter
Visualization
https://osf.io/9gq4a/
Getting Started With R - Script Key.R
921
scatterplot of commitment with SWL
co_swl_scatter <- ggplot2::ggplot(eid_dat, aes(meim_co_mean, swl_mean)) + geom_point() + ggtitle("My Scatterplot") + xlab("Ethnic Identity Commitment (mean)") + ylab("Satisfaction with Life (mean)") + geom_smooth(method="lm") co_swl_scatter
Visualization
https://osf.io/9gq4a/
Getting Started With R - Script Key.R
922
step 8: indepedent samples ttests also in base R. note that Welch's ttest is the default this set is testing for mean differences by whether they were born in the U.S.
t.test(eid_dat$meim_ex_mean ~ eid_dat$usborn) t.test(eid_dat$meim_co_mean ~ eid_dat$usborn) t.test(eid_dat$swl_mean ~ eid_dat$usborn)
Statistical Test
https://osf.io/9gq4a/
Getting Started With R - Script Key.R
923
step 11: create a series of boxplots to go with the previous ANOVAs note that the code here is only slightly different from the one variable case you can/should add elements to format the plots, as you did previously
borngen_ex_boxplot <- ggplot2::ggplot(eid_dat, aes(usborn, meim_ex_mean, fill=firstgen)) + geom_boxplot(alpha = 0.5) borngen_ex_boxplot borngen_co_boxplot <- ggplot2::ggplot(eid_dat, aes(usborn, meim_co_mean, fill=firstgen)) + geom_boxplot(alpha = 0.5) borngen_co_boxplot borngen_swl_boxplot <- ggplot2::ggplot(eid_dat, aes(usborn, swl_mean, fill=firstgen)) + geom_boxplot(alpha = 0.5) borngen_swl_boxplot
Visualization
https://osf.io/9gq4a/
Getting Started With R - Script Key.R
924
Add a plotting function to get power curve
plot_power_extend <- function(object, target = .80, ...) { nsim <- object[[1]]$n df <- purrr::map_dfr(object, powerinterval, .id = "n", ...) df$n <- as.integer(df$n) ggplot(df, aes(x = n, y = mean, group = 1)) + geom_hline(yintercept = target) + geom_smooth(method = "glm", formula = cbind(y * nsim, (1 - y) * nsim) ~ x, method.args = list(family = binomial("probit"))) + geom_pointrange(aes(ymin = lower, ymax = upper)) + labs(y = "power") + ylim(0, 1) }
Visualization
https://osf.io/6ya5d/
Power_Analysis_OSF_22.R
925
check duplicate trials per participant (post)
xtabs(~subj+trial,data=rawdat.all) table(rawdat.all$subj)
Data Variable
https://osf.io/c93vs/
exp02_prep.R
926
remove duplicate species per file, and species level data
data2.5 <- data2[!data2$species == 'Certhia_sp.',] data2.6 <- data2.5[!data2.5$species == 'Regulus_sp.',] data3 <- data2.6 %>% group_by(Plot_no) %>% mutate(whichday = as.integer(factor(date))) data4 <- data3 %>% group_by(Plot_no, filename) %>% mutate(seq=cur_group_id())
Data Variable
https://osf.io/uq3cv/
4_Compute_beta_diversity_metrics.R
927
Show sample sizes per country
pa12_resp_s %>% group_by(CNT) %>% summarise(n = n())
Visualization
https://osf.io/8fzns/
0_Data-Prep.R
928
Gaze Duration Descriptive stats per ID
BFSGDesc <- BirdFSG %>% group_by(ID, Stimuli) %>% summarise (MGaze = mean(Gaze), sd=sd(Gaze), n=n(), se = sd/sqrt(n)) ;; BFSGDesc$Stimuli <- paste( BFSGDesc$Stimuli, "S", sep="") BFSGDesc BNADDesc <- BirdNAD %>% group_by(ID, Stimuli) %>% summarise (MGaze = mean(Gaze), sd=sd(Gaze), n=n(), se = sd/sqrt(n)) ;; BNADDesc$Stimuli <- paste( BNADDesc$Stimuli, "S", sep="") BFSGDesc <- as.data.frame(BFSGDesc);; BNADDesc <- as.data.frame(BNADDesc);; BFSGDesc$Stimuli <- as.factor(as.character(BFSGDesc$Stimuli)) BNADDesc$Stimuli <- as.factor(as.character(BNADDesc$Stimuli)) BFSGDesc
Data Variable
https://osf.io/mhgcx/
Figures for paper.R
929
p<.05 ONEWAY ANOVA let's say we're interested in investigating the relationship between three species (setosa, versicolor, virginica) outcome: sepal width run Levene's test to check assumption of homogeneity of variance by default centres variable using median library(car) leveneTest(Sepal.Width~Species, datairis,centermean) p>.05 therefore assumption met running oneway ANOVA
mod.a<-aov(Sepal.Width~Species, data=iris) summary(mod.a)
Statistical Test
https://osf.io/6g4js/
Analyses_Section_4.R
930
generate a random number between 1 and 1000 that functions as the index into an array of random numbers of size 1000
return(randNo[floor(runif(1)*1000)]) }
Data Variable
https://osf.io/fsbzw/
functions.R
931
print the simulation number after every 10% of the simulations
if(s%%(sims/10) == 0){ cat(paste(" ", s)) } if(verbose){ print("",quote=FALSE) print("",quote=FALSE) print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", quote=FALSE) print(paste(" Simulation", s, " "), quote=FALSE) print("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-", quote=FALSE) } for(i in c(1:stages)){ if(i==picCreStage){ add.time(par.dat) if(verbose){ print(paste("------ Adding picture chunks -------"), quote=FALSE) } p.knopf[["ctime"]] = currTime add.chunk(p.knopf) p.flasche[["ctime"]] = currTime add.chunk(p.flasche) if(EXPT1){ p.ballon[["ctime"]] = currTime add.chunk(p.ballon) p.blume[["ctime"]] = currTime add.chunk(p.blume) } martin[["ctime"]] = currTime add.chunk(martin) sarah[["ctime"]] = currTime add.chunk(sarah) } if(verbose){ print("",quote=FALSE) print(paste("=============== ", "Stage ", i, ":", input.stages[i], " ==============="), quote=FALSE) }
Data Variable
https://osf.io/fsbzw/
functions.R
932
mean level of transitive respondents per wave
aggregate(long_svo_multi$trans,list(long_svo_multi$wave_cat),FUN=mean,na.rm =T)
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
933
create variable with only NA values
long_svo_multi$vlengths = rep(NA, times = 2970)
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
934
calculate vector length per row
for (i in 1:2970) {long_svo_multi$vlengths[i]=calculate_vlength(mean_self[i], mean_other[i])}
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
935
criterion to select applicable cases select only rows with transitive and good vector length response profiles as well as respondents with NA values this criterion used to select applicable cases for data analyses and figures
data_criterion <- (long_svo_multi$trans == "TRUE" & long_svo_multi$trans_vlenght == "TRUE" | is.na(long_svo_multi$trans) | is.na(long_svo_multi$trans_vlenght))
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
936
KolmogorovSmirnov ksamples test for SVO angles
ks.test(dropouts$SVO_angle, stayers$SVO_angle) ks.test(dropouts$SVO_angle, stayers$SVO_angle) ks.test(dropouts$SVO_angle, stayers$SVO_angle) ks.test(dropouts$SVO_angle, stayers$SVO_angle) ks.test(dropouts$SVO_angle, stayers$SVO_angle)
Statistical Test
https://osf.io/tw8dq/
SVOSM_analyses_final.R
937
Fishersexact test for SVO types
fisher.test(table(dropouts$SVO_dicho_num),table( stayers$SVO_dicho_num)) fisher.test(table(dropouts$SVO_dicho_num),table( stayers$SVO_dicho_num)) fisher.test(table(dropouts$SVO_dicho_num),table( stayers$SVO_dicho_num)) fisher.test(table(dropouts$SVO_dicho_num),table( stayers$SVO_dicho_num)) fisher.test(table(dropouts$SVO_dicho_num),table( stayers$SVO_dicho_num))
Statistical Test
https://osf.io/tw8dq/
SVOSM_analyses_final.R
938
lagged variables of distance to 45 boundary in SVO
long_svo_multi$distance_45<-round(abs(45 - long_svo_multi$prior_SVO),digits = 2)
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
939
alter a variable to label dropouts as 1 and stayers as 0 for ML analysis and this variable as dependent variable
data_adjusted$stay_dropout <- data_adjusted$change_cat data_adjusted$stay_dropout <- ifelse(data_adjusted$stay_dropout == 1,0, ifelse(data_adjusted$stay_dropout == 0,0,1)) data_adjusted$stay_dropout <- replace_na(data_adjusted$stay_dropout,value = 1) data_adjusted_1 <- data_adjusted %>% filter(trans == "TRUE" & trans_vlenght == "TRUE" | is.na(trans) | is.na(trans_vlenght))
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
940
grid arrange to create figure with distribution of angles and SVO categories
get_legend<-function(myggplot){ tmp <- ggplot_gtable(ggplot_build(myggplot)) leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box") legend <- tmp$grobs[[leg]] return(legend)} bp <- theme(legend.position="none")
Visualization
https://osf.io/tw8dq/
SVOSM_analyses_final.R
941
Assessing minor longitudinal differences in SVO angles select applicable cases and variables
adjust <-dplyr::select(long_svo_multi,id,SVO_angle,wave_cat,trans,trans_vlenght) data_input <- na.omit(adjust) data_input$SVO_angle <- round(data_input$SVO_angle, digits = 2) data_input <- data_input %>% filter(trans == "TRUE" & trans_vlenght == "TRUE") data_wide_2 <- dcast(data_input, id ~ wave_cat, value.var="SVO_angle") data_wide_2 <- na.omit(data_wide_2)
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
942
cumulative change of difference in SVO angles wave per wave
data_wide_6$change_wave_1 <- data_wide_6$diff_w1 data_wide_6$change_wave_1_2 <- data_wide_6$diff_w1_w2 data_wide_6$change_wave_1_2_3 <- data_wide_6$change_wave_1_2 + data_wide_6$diff_w2_w3 data_wide_6$change_wave_1_2_3_4 <- data_wide_6$change_wave_1_2_3 + data_wide_6$diff_w3_w4 data_wide_6$change_wave_1_2_3_4_5 <- data_wide_6$change_wave_1_2_3_4 + data_wide_6$diff_w4_w5 data_wide_6$change_wave_1_2_3_4_5_6 <- data_wide_6$change_wave_1_2_3_4_5 + data_wide_6$diff_w5_w6 data_wide_7 <- data_wide_6[, c(1,8:13)] long_SVO_4 <- melt(data = data_wide_7, id.vars = c("id"), variable.name = "wave_compare", value.name = "cumulative_change_in_SVO")
Data Variable
https://osf.io/tw8dq/
SVOSM_analyses_final.R
943
Set up ERGM formula and constraints
if (substr(thresh, 1, 4) == 'prop') { ergm_formula <- y ~ gwesp(0.75, fixed=TRUE) + gwnsp(0.75, fixed=TRUE) constraints <- ~edges } else { ergm_formula <- y ~ edges + gwesp(0.75, fixed=TRUE) + gwnsp(0.75, fixed=TRUE) constraints <- ~. } ergm_fit <- ergm(ergm_formula, constraints = constraints) f <- paste0("Output/Singles/", thresh, "/ergmFit_", sprintf("%03d",i), ".RDS") dir.create(dirname(f), showWarnings = FALSE, recursive = TRUE) saveRDS(bergm_fit, f)
Statistical Modeling
https://osf.io/5nh94/
01b_fit_single_ergm.R
944
min and max age, mean and sd age, percentage of men and women
minAge = min(df_preQ$age) maxAge = max(df_preQ$age) meanAge = mean(df_preQ$age) sdAge = sd(df_preQ$age) females = length(which(df_preQ$gender == "female")) males = length(which(df_preQ$gender == "male")) other = length(which(df_preQ$gender == "other"))
Data Variable
https://osf.io/xh36s/
questionnaires_analyses.R
945
Check normality with QQ plot and ShapiroWilk test Build the linear model
model <- lm(FW ~ condition, data = df_postQ)
Statistical Test
https://osf.io/xh36s/
questionnaires_analyses.R
946
Visualize correlations Insignificant correlations are leaved blank
corrplot(res_cor$r, method = 'number', type="upper", order="hclust", p.mat = res_cor$P, sig.level = 0.05, insig = "blank")
Visualization
https://osf.io/xh36s/
questionnaires_analyses.R
947
plot a correlation matrix with all the different measures Create a dataframe with all the different measures of above
df_corM <- data.frame(df_postQ$FW, df_postQ$DU, df_postQ$arousal, df_postQ$valence, df_postQ$control, df_postQ$responsibility, df_diff$Diff) colnames(df_corM) <- c('FW', 'DU', 'arousal', 'valence', 'control', 'responsibility', 'Diff')
Visualization
https://osf.io/xh36s/
questionnaires_analyses.R
948
calculate posterior draws for regression lines
experiment_dat_virus <- dat[dat$material == material, ] print(experiment_dat_virus) experiment_dat_virus <- experiment_dat_virus %>% summarise(detection_limit = 10^first(detection_limit_log10_titer)) print(experiment_dat_virus) mat_dat <- dat[dat$material == material, ] if(material != "Aerosols") { scaling <- 1 ylab_expression <- expression("titer (TCID"[50] * "/mL media)") max_x <- mat_dat %>% group_by(trial_unique_id, replicate) %>% filter(log10_titer == detection_limit_log10_titer) %>% select(time, trial_unique_id, replicate) %>% summarise(min_time = min(time)) %>% ungroup() %>% select(min_time) %>% max() } else { scaling <- 10 / 3 ## convert to tcid50/L air ylab_expression <- expression("titer (TCID"[50] * "/L air)") max_x <- max(mat_dat$time) } print(max_x) plot_times <- dat %>% data_grid(time = seq_range(c(0, max_x), n = fineness)) print(material)
Statistical Modeling
https://osf.io/fb5tw/
figure_individual_fits.R
949
draw n_lines random regression lines
func_samples <- tidy_draws %>% group_by(trial_unique_id, replicate) %>% sample_n(n_lines) %>% ungroup() print(func_samples)
Visualization
https://osf.io/fb5tw/
figure_individual_fits.R
950
cross product decay_rates with x (time) values and calculate y (titer) values
to_plot <- func_samples %>% crossing(plot_times) to_plot <- to_plot %>% mutate(predicted_titer = scaling * 10^(intercept - decay_rate * time)) dat <- dat[dat$material == material, ] max_titer <- scaling * max(dat$titer)
Data Variable
https://osf.io/fb5tw/
figure_individual_fits.R
951
this function accepts a column containing hitnames, a target hitname to look for, and a ... starting and ending fixation index
is_hitname_in_range <- function(vec, hitname, fi_start, fi_end) { if (!"fi_pairs" %in% ls(envir = .GlobalEnv)) { fi_pairs <- get_fixationindex_pairs(df$FixationIndex)
Data Variable
https://osf.io/mp9td/
is_hitname_in_range.R
952
0 get sensing/location data for the specific user
sensing = dplyr::tbl(phonestudy, "ps_activity") %>% dplyr::filter(user_id %in% user) %>% dplyr::filter(!activityName %in% c("PHONESTUDY", "DNAPSOUND", "DNAPACCELEROMETER", "DNAPLIGHT", "DNAPPROXIMITY", "DNAPGYROSCOPE")) %>% dplyr::mutate(timestamp = as.character(timestamp), created_at = as.character(created_at), updated_at = as.character(updated_at)) %>% data.frame() sensing$user_id = as.character(sensing$user_id)
Data Variable
https://osf.io/b7krz/
Enrichment_GPS_POIs_HERE_API.R
953
Creates the variable 'distances', a 540 X 540 distance matrix between stimuli
coordinates = read.xlsx("540_coordinates.xlsx", colNames = TRUE) coordinates = as.matrix(unname(coordinates)) coordinates = coordinates[,2:9] distances = as.matrix(dist(coordinates))
Data Variable
https://osf.io/hrf5t/
runHierarchicalGCM.R
954
Number of subjects in each group Create a group variable according to each cluster condition
if (size == 1){ N.size = N/K n.group = unlist(lapply(1:K, function(k) rep(k,N.size))) } if (size == 2){ if (K == 2){ N.1 = 0.10*N N.2 = N - N.1 n.group = c(rep(1,N.1),rep(2,N.2)) } if (K == 4){ N.1 = 0.10*N N.rest = N - N.1 N.size = N.rest/(K-1) n.group = c(rep(1,N.1),rep(2,N.size),rep(3,N.size),rep(4,N.size)) }} if (size == 3){ if (K == 2){ N.1 = 0.6*N N.2 = N - N.1 n.group = c(rep(1,N.1),rep(2,N.2)) } if (K == 4){ if (N == 20){ N.1 = 0.6*N N.rest = N - N.1 N.size = floor(N.rest/(K-1)) n.group = c(rep(1,N.1),rep(2,N.size),rep(3,N.size+1),rep(4,N.size+1)) } else{ N.1 = 0.6*N N.rest = N - N.1 N.size = N.rest/(K-1) n.group = c(rep(1,N.1),rep(2,N.size),rep(3,N.size),rep(4,N.size)) }}}
Data Variable
https://osf.io/rs6un/
Data.Cluster.VAR.Fixed.R
955
make a blank output table to hold the derive stats, and fill it up
out.tbl <- data.frame(array(NA, c(800, 5)));; # just make it big for now colnames(out.tbl) <- c("load.type", "cat.type", "trial.type", "stat.name", "stat.value");; ctr <- 1;;
Data Variable
https://osf.io/p6msu/
create_output_behavioral.R
956
creating healthcare / containment variable
measures_new <- measures_new %>% mutate(measure_category = if_else(str_starts(measure,"H"), "Healthcare", "Containment"))
Data Variable
https://osf.io/scn62/
three countries plot.R
957
Number of subject in Group 0
N0.subject = 2*N0.dyad
Data Variable
https://osf.io/vtb9e/
Sim.Dyad.Model.3.R
958
Exclude data from students who changed class or school during the school year.
quop2$exclusion[quop2$change>0] <- 1
Data Variable
https://osf.io/vphyt/
Prepare_wst_data_OSF.R
959
create date variable for birthday
quop2$s_birth_date <- as.Date(quop2$s_birth, format = "%d.%m.%Y")
Data Variable
https://osf.io/vphyt/
Prepare_wst_data_OSF.R
960
set gavariables to NA if they have negative times where there are negative times recorded in the gqcvariables, use the corresponding gavariable value instead (hoping it is not negative) (!: ga also contains instruction pages) first and last item (one per page) between the instruction pages
js_start = c(2, 23, 37) js_end = c(21, 35, 49) for(i in 1:8){ for(j in 1:length(js_start)){ for(k in js_start[j]:js_end[j]){ eval(parse(text=paste0("quop_use$t",i,"_gqc",k-j,"<- ifelse(quop_use$t",i,"_gqc",k-j,"<=0,quop_use$t",i,"_ga",k,", quop_use$t",i,"_gqc",k-j,")"))) } } }
Data Variable
https://osf.io/vphyt/
Prepare_wst_data_OSF.R
961
Creat file paths for the raw data and the csv files that you get at the end
file_path = 'data_fullstudy1.txt' file_path2 = 'behavioral.csv' file_path3 = 'questionnaires.csv' file_path4 = 'boxes.csv'
Data Variable
https://osf.io/xh36s/
preprocessing.R
962
Create loop for every participant, put the relevant data into the dataframe
con <- file(file_path, open = "r") on.exit(close(con)) lines <- readLines(con) subjects_data <- list() game_data <- list() boxes_data <- list() subj <- 0 for (line in lines) { if (grepl("Enter your Prolific ID", line, fixed = TRUE)) { subj = subj + 1 metadata_beginning <- fromJSON(str_replace(line, "\\}\\{", ",")) subj_data <- ""
Data Variable
https://osf.io/xh36s/
preprocessing.R
963
Recode NAs to 0 for response frequency tables
recodeNAto0 <- function(var) { case_when(is.na(var) ~ 0, T ~ var) }
Data Variable
https://osf.io/w4gey/
03_descriptive-analysis.R
964
Compute response frequency table for recoded items
proptable <- function(var) { table(ds$country_name, var) %>% addmargins() %>% data.frame() %>% rename(country = 1, response = 2, prop = 3) %>% spread(response, prop) %>% mutate(`0` = `0`/Sum, `1` = `1`/Sum, `2` = `2`/Sum, `3` = `3`/Sum, `4` = `4`/Sum, `5` = `5`/Sum) }
Data Variable
https://osf.io/w4gey/
03_descriptive-analysis.R
965
Make density ridge plot
ggplot(data = brmsmeans_antisci_cntr_post, aes(x = antisci_mean, y = fct_reorder(country_name, antisci_mean, .fun = mean), fill = factor(continent))) + stat_density_ridges(inherit.aes = T, calc_ecdf = F, quantile_lines = T, quantiles = 2, alpha = 0.7, scale = 3.5) + stat_summary(aes(label = paste0(sprintf("%0.2f", round(..x.., 2)), " [", sprintf("%0.2f", round(brmsmeans_hdi_l, 2)), ", ", sprintf("%0.2f", round(brmsmeans_hdi_h, 2)), "]")), geom = "text", size = 3, hjust = 0, color = "black", position = position_nudge(x = 6.7 - brmsmeans_means)) + scale_fill_viridis_d(name = "Continent", option = "inferno", begin = 0.1, end = 0.9, direction = -1) + coord_cartesian(xlim = c(3.7, 6.3), clip = "off") + ggtitle(label = "Posterior probability distributions of anti-science attitudes across countries", subtitle = "Annotations provide distribution means and 89% HDIs") + xlab("Anti-science attitudes") + ylab("") + theme_minimal() + theme(plot.margin = unit(c(1, 10, 1, 1), "lines"), legend.position = "bottom")
Visualization
https://osf.io/w4gey/
03_descriptive-analysis.R
966
extract the head and convert it to image
extract_pdf_top <- function(pdf_path) { page_img <- image_read_pdf(pdf_path, page = 1, density = 72) width <- image_info(page_img)$width height <- image_info(page_img)$height left <- 0 top <- 75 height <- height / 4 image_crop(page_img, geometry = sprintf("%fx%f+%f+%f", width, height, left, top)) } dontcare <- first_page_paths %>% map(extract_pdf_top) %>% map2(png_paths, image_write)
Data Variable
https://osf.io/csy8q/
process_pdf.R
967
Figures function to create data summaries in figures calculating means and cis for the plot
ci <- function(x) (sd(x)/sqrt(length(x))*qt(0.975,df=length(x)-1) ) #function to compute size of confidence intervals data_summary <- function(x) { m <- mean(x) ymin <- m-ci(x) ymax <- m+ci(x) return(c(y=m,ymin=ymin,ymax=ymax)) }
Visualization
https://osf.io/mj5nh/
politicalknowledgeestimatecentralitydefaultsatleast6.R
968
median thickness of new snow
medianThicknessNewSnow <- sapply(avgSP$sets, function(set) { median(sapply(set, function(sp) { sum(sp$layers$thickness[findPWL(sp, pwl_gtype = c("PP", "DF"))]) })) }) lines(avgSP$meta$date, avgSP$meta$hs_median - medianThicknessNewSnow, lty = "dashed", lwd = 1) avgSP$avgs <- snowprofileSet(lapply(avgSP$avgs, function(avg) { avg$layers$percentage <- avg$layers$ppu_all avg })) plot(avgSP$avgs[avgSP$meta$date >= xdaterange[1] & avgSP$meta$date <= xdaterange[2]], ColParam = "percentage", add = TRUE, yaxis = FALSE, ylab = "") legend(as.Date("2018-09-23"), 190, c("<HS>", "<NEW>", "PP", "DF", "SH", "DH", "FC", "FCxr", "RG", "MF", "MFcr"), lty = c("solid", "dashed", rep(NA, 9)), lwd = 2, col = c(rep("black", 2), getColoursGrainType(c("PP", "DF", "SH", "DH", "FC", "FCxr", "RG", "MF", "MFcr"))), pch = c(NA, NA, rep(15, 9)), pt.cex = 2.5, density = c(rep(0, 11)), border = "transparent", horiz = FALSE, bty = "o", box.lwd = 0, cex = 1.4) dev.off()
Data Variable
https://osf.io/w7pjy/
figures_paper.R
969
Means and SDs of TOTAL LT TO THE SCREEN in the outcome phase (Okumura) Table 2 in the main manuscript: for mean.overall.data (analogously to the boxplots)
mean.overall.data %>% group_by(Condition) %>% summarise(mean=mean(LTScreenOut), sd=sd(LTScreenOut), na.rm = TRUE) %>% as.data.frame(.) %>% dplyr::mutate_if(is.numeric, round, 3)
Data Variable
https://osf.io/mp9td/
Stats_Third.R
970
checking disctribution of the dependent variable
hist(overall.data$LTScreenOut) hist(overall.data$LTObjectOut) hist(overall.data$FirstLookDurationObjectOut)
Data Variable
https://osf.io/mp9td/
Stats_Third.R
971
reduced model revealed a convergence warning, with high SDs for TrialRun and Concontext (random effects). model with simpler random effect structure revealed similar estimates suggesting that the warning can be ignored
red6_2 <- glmer(FirstLookDurationObjectOut ~ ConContext + Identity_change + Location_change + z.TrialRun + z.TrialCon + ObjectPosAct + (1 + z.TrialCon + ObjectPosAct | ID) , data=overall.data, family=Gamma(link=log), control=contr) summary(red6_2) summary(red6)
Statistical Modeling
https://osf.io/mp9td/
Stats_Third.R
972
Test the difference between correlations of the same skills vs. different skills based on multiple imputation
names(Data_Table2a)[4]<-"Bad_news" m <- 'Persuasion ~~ v1*Persuasion + s1*Unreasonable + d1*Crisis + d2*Bad_news + d3*Presentation + d4*Mistake Unreasonable ~~ v2*Unreasonable + d5*Crisis + d6*Bad_news + d7*Presentation + d8*Mistake Crisis ~~ v3*Crisis + s2*Bad_news + d9*Presentation + d10*Mistake Bad_news ~~ v4*Bad_news + d11*Presentation + d12*Mistake Presentation ~~ v5*Presentation + s3*Mistake Mistake ~~ v6*Mistake
Statistical Test
https://osf.io/jy5wd/
Code.R
973
compute boxplot characteristics
x <- boxplot(rep.int(yn, wn), plot = FALSE) top_vp <- viewport(layout = grid.layout(nrow = 2, ncol = 3, widths = unit(c(ylines, 1, 1), c("lines", "null", "lines")), heights = unit(c(1, 1), c("lines", "null"))), width = unit(1, "npc"), height = unit(1, "npc") - unit(2, "lines"), name = paste("node_boxplot", nid, sep = ""), gp = gp) pushViewport(top_vp) grid.rect(gp = gpar(fill = bg, col = 0)) top <- viewport(layout.pos.col = 2, layout.pos.row = 1) pushViewport(top) if (is.null(mainlab)) { mainlab <- if (id) { function(id, nobs) sprintf("[%s] nWKL = %s", # Node %s id, length(unique(VS_$wkl_uuid[fitted_node(obj$node, obj$data) == nid]))) # id, nobs
Visualization
https://osf.io/w7pjy/
node_violinplot.R
974
Calculate to and from percentages
from_id <- unique(AbbyLinks$from) for (i in 1:length(from_id)) { AbbyLinks$perc_from[AbbyLinks$from == from_id[i]] <- AbbyLinks$n[AbbyLinks$from == from_id[i]]/sum(AbbyLinks$n[AbbyLinks$from == from_id[i]]) } to_id <- unique(AbbyLinks$to) for (i in 1:length(to_id)) { AbbyLinks$perc_to[AbbyLinks$to == to_id[i]] <- AbbyLinks$n[AbbyLinks$to == to_id[i]]/sum(AbbyLinks$n[AbbyLinks$to == to_id[i]]) } rm(i, from_id, to_id) head(AbbyLinks, 10)
Data Variable
https://osf.io/rtmyx/
05_PerceptionAnalysis_AllClassSolutions_V230401.R
975
Generate Data Generate the outcome (y) and mediator (m) in the population with a correlation of b, variances of 1, and means of 0.
sigma <- rbind(c(1, b), c(b, 1)) mu <- c(0, 0) df <- as.data.frame(mvrnorm(n = n, mu = mu, Sigma = sigma)) names(df) <- c("y", "m")
Data Variable
https://osf.io/975k3/
med.validation.R
976
create a plot that illustrats: Accuracy, Kappa, AUROC and MCC
plot_3 <- methods_plot %>% filter(indices %in% c("Accuracy", "Kappa", "AUROC" , "MCC")) ggplot(plot_3,aes(x=variable,y=value,fill=reorder(indices,value))) + geom_bar(stat = "identity",position = "dodge",color="black") + xlab("") + ylab("in %") + ggtitle("") + scale_fill_brewer(palette = "Pastel1",name="") + theme_bw() + theme(legend.position="bottom") + theme(legend.title=element_blank()) + theme(plot.title = element_text(hjust = 0.5)) + scale_y_continuous(breaks = c(0,12.5,25,37.5,50,62.5,75,87.5,100),limits = c(0,95)) + theme(axis.text.x = element_text(angle=30, hjust = 1, vjust = 1, size = 12)) + theme(axis.text.y = element_text( size = 12)) + theme(axis.title.y = element_text( size = 12)) + theme(legend.title = element_text( size = 12 ))
Visualization
https://osf.io/cqsr8/
plots.R
977
round all numeric variables x: data frame digits: number of digits to round
numeric_columns <- sapply(x, class) == 'numeric' x[numeric_columns] <- round(x[numeric_columns], digits) x }
Data Variable
https://osf.io/7z3mk/
t1-stan-5.R
978
M, SD, range of key sociodemographic variables (across countries)
summstats(ds, age, country_name) %>% print(n = nrow(.)) summstats(ds, sex_rec, country_name) %>% print(n = nrow(.)) summstats(ds, edu_9cat, country_name) %>% print(n = nrow(.)) summstats(ds, income_10cat, country_name) %>% print(n = nrow(.))
Data Variable
https://osf.io/w4gey/
01_setup.R
979
plot 95% credible intervals
x<-plot(me, plot = FALSE)[[1]] + scale_color_grey() + scale_fill_grey() x+ylim(0,1)+ theme(panel.grid.major = element_line(colour="gray"), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_blank(),panel.grid.major.x = element_blank())+xlab("")+ylab("")
Visualization
https://osf.io/a8htx/
SSK_Cleaned.R
980
Calculating Bayes Factors for effects
bayes_factor(xfit1,xfit2) bayes_factor(xfit1,xfit3)
Statistical Test
https://osf.io/a8htx/
SSK_Cleaned.R
981
plot of abstractlevel rating averages Scatterplot with overlaid box
eval.plot <- ggplot(abstract.plot, aes(y=eval, x=target.f, color=target.f)) + geom_jitter(aes(colour=target.f)) + geom_boxplot(outlier.shape = NA, alpha=0.5) eval.plot <- eval.plot + theme_bw() + scale_colour_manual(values=c("#9E2E2E","royalblue4")) + scale_x_discrete( labels = c("Conservatives", "Liberals") ) + scale_y_continuous(limits = c(1, 7), expand = c(0,0)) + labs(y="Evaluative Rating", x="") + theme( text = element_text(size=16), panel.grid.major.x = element_blank(), legend.position = "none" ) explain.plot <- ggplot(abstract.plot, aes(y=explain, x=target.f, color=target.f)) + geom_jitter(aes(colour=target.f)) + geom_boxplot(outlier.shape = NA, alpha=0.5) explain.plot <- explain.plot + theme_bw() + scale_colour_manual(values=c("#9E2E2E","royalblue4")) + scale_x_discrete( labels = c("Conservatives", "Liberals") ) + scale_y_continuous(limits = c(1, 7), expand = c(0,0)) + labs(y="Explanatory Rating", x="") + theme( text = element_text(size=16), panel.grid.major.x = element_blank(), legend.position = "none" ) grid.arrange(eval.plot,explain.plot, nrow = 1)
Visualization
https://osf.io/zhf98/
abstract ratings analysis.r
982
plot the raw data and the 95% HPDI from m.arithmetic
d.gg.math <- d.math.agg d.gg.math$mean <- NA d.gg.math$low_ci <- NA d.gg.math$high_ci <- NA
Visualization
https://osf.io/7vbj9/
Analyses_Confirmatory.R
983
Linear mixedeffects model for reproduction bias
mod_full <- lmer(Prct_Bias ~ ContextC*(GMSI_Gen_Z + GroupC*OrderC*Distort) + (ContextC | Subject), data=dat2) summary(mod_full) Anova(mod_full, type=3, test='Chisq') # Wald tests
Statistical Modeling
https://osf.io/wxgm5/
Exp1_complete.R
984
Simple slopes: Model for testing effect of Context at high GMSI
mod_1 <- lmer(Prct_Bias ~ ContextC*(GMSI_Gen_hi + GroupC*OrderC*Distort) + (ContextC | Subject), data=dat2) summary(mod_1) Anova(mod_1, type=3, test='Chisq')
Statistical Modeling
https://osf.io/wxgm5/
Exp1_complete.R
985
Add informaiton on species + condition to each row of dplot
gramXspec <- as.factor(c(rep("Bird AD", 3), rep("Bird NAD", 3))) grammar <- as.factor(c(rep("AD", 3), rep("NAD", 3))) species <- as.factor(c(rep("Bird", 6))) dplot $ Condition <- as.factor(grammar) ;; dplot$Species <- as.factor(species) ;; dplot $ gramXspec <- as.factor(gramXspec) dplot
Visualization
https://osf.io/mhgcx/
Bird AGL - Outputs and plots.R
986
exclude App Spirituality features (are accidentally still created in the data set as empty variables)
sensing = sensing %>% dplyr::select(!matches("Spirituality"), -date)
Data Variable
https://osf.io/b7krz/
04_SOURCE_ExclusionCriteria.R
987
Porportion of trials missed within each block, for each subj
miss.blk <- with(data, tapply(trialError, list(subj, data$block), function(x) sum(x!="FALSE") / length(x)))
Data Variable
https://osf.io/tbczv/
02-exclCriteria.r
988
plot fit model marginal_effects( FIT ) compute marginal means and average marginal effects
mu_happy = rowMeans(getCAT_fitted_mean(FIT , 'emotion' , 'happy' )) mu_angry = rowMeans(getCAT_fitted_mean(FIT , 'emotion' , 'angry' )) mu_neutral = rowMeans(getCAT_fitted_mean(FIT , 'emotion' , 'neutral' )) contrast_mu_angry_neutral = mu_angry-mu_neutral contrast_mu_happy_neutral = mu_happy-mu_neutral contrast_mu_angry_happy = mu_angry - mu_happy
Visualization
https://osf.io/dkq3f/
eda_brms.R
989
Add column for centered logtransformed time series
habsos.ts$ctr <- habsos.ts$log10_CELLS - mean(habsos.ts$log10_CELLS) head( habsos.ts )
Data Variable
https://osf.io/ajf3h/
02generateKbrevistimeseries.R
990
Custom functions 1. Data management 1.1 Build mean indices from multiple variables
mean_index <- function (df, name, vars) { M1 <- dplyr::select(df, vars) M2 <- rowMeans(M1, na.rm = TRUE) M2 <- tibble::tibble(M2) colnames(M2) <- name df <- dplyr::bind_cols(df, M2) return(df) }
Data Variable
https://osf.io/w97h4/
Paper_functions.R
991
2. Stats 2.1 Calculate standard error (se_func)
se_func <- function(var) { sd <- sd(var) n <- length(var) se <- sd / sqrt(n) return(se) }
Statistical Test
https://osf.io/w97h4/
Paper_functions.R
992
Calculate confidence interval (upper bound)
upper_ci_func <- function(var) { m <- mean(var) sd <- sd(var) n <- length(var) se <- sd / sqrt(n) lower_ci <- m + qt(1 - (0.05 / 2), n - 1) * se return(lower_ci) }
Statistical Test
https://osf.io/w97h4/
Paper_functions.R
993
2.6 Bayes Factor paired ttest (func_ttest_paired_bf)
func_ttest_paired_bf <- function(pre = df_merge1_s3$paffect_pre, post = df_merge1_s3$paffect_post, dv = "paffect") {
Statistical Test
https://osf.io/w97h4/
Paper_functions.R
994
calculate pvalues from ttests
tee <- with(df, t.test(formula = dep_var ~ group_var, paired = FALSE, alternative = side)) return(tee) } tee <- with(df, t.test(x = var_pre, y = var_post, paired = TRUE, alternative = side)) } tee <- with(df, t.test(x = var_pre, y = var_post, paired = TRUE, alternative = side)) tee <- tee[["statistic"]][["t"]] effsize <- tee / sqrt(length(var_pre)) return(effsize) }
Statistical Test
https://osf.io/w97h4/
Paper_functions.R
995
impute missing values with the median of the respective variable
phonedata <- impute(phonedata, target = "Soci", classes = list(numeric = imputeMedian(), integer = imputeMedian()))$data
Data Variable
https://osf.io/9mc84/
preprocessing.R
996
Print percents of stuff (used for displaying study demographics)
print.percents <- function(x) { t <- as.data.frame(sort(table(as.character(x)), decreasing = T)) t$Percent <- round(t$Freq/sum(t$Freq)*100) colnames(t) <- c("", "n", "%") print(t) }
Visualization
https://osf.io/zh3f4/
misc.helpers.R
997
Linear mixed effect model (RTs) 1000/RT as preregistered
LDTword_LME = lmer(-1000/RT ~ primec + (1|item) + (1+primec|subject), data = byTrial, contrasts = list(primec = cc1), control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=2e5))) summary(LDTword_LME)
Statistical Modeling
https://osf.io/gztxa/
Vowel_Harmony_LDT_Naming.R
998
Exploratory: Linear mixed effect model (RTs) with AuthorTest_Finnish
LDTword_LME_ARF = lmer(-1000/RT ~ primec*AR_Finnish + (1|item) + (1|subject), data = byTrial, contrasts = list(primec = cc1), control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=2e5))) summary(LDTword_LME_ARF) plot(allEffects(LDTword_LME_ARF), x.var = "AR_Finnish")
Statistical Modeling
https://osf.io/gztxa/
Vowel_Harmony_LDT_Naming.R
999
Linear mixed effect model (RTs) nonwords
LDTword_LMEnw = lmer(-1000/RT ~ primec + (1|item) + (1+primec|subject), data = byTrialnw, contrasts = list(primec = cc1), control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=2e5))) summary(LDTword_LMEnw)
Statistical Modeling
https://osf.io/gztxa/
Vowel_Harmony_LDT_Naming.R
1,000
Linear mixed effect model (RTs)
Nword_LME = lmer(-1000/RT ~ primec + (1|item) + (1+primec|subject), data = nbyTrial, contrasts = list(primec = cc1), control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=2e5))) summary(Nword_LME)
Statistical Modeling
https://osf.io/gztxa/
Vowel_Harmony_LDT_Naming.R