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
|
---|---|---|---|---|---|
1,001 | Linear mixed effect model (RTs) with ART_English | Nword_LME_AR = lmer(-1000/RT ~ primec*AR_English + (1|item) + (1+primec|subject), data = nbyTrial, contrasts = list(primec = cc1), control=lmerControl(optimizer="bobyqa", optCtrl=list(maxfun=2e5))) summary(Nword_LME_AR) plot(allEffects(Nword_LME_AR), x.var = "AR_English") | Statistical Modeling | https://osf.io/gztxa/ | Vowel_Harmony_LDT_Naming.R |
1,002 | exclude features with zero or nearzero variance | exclude_zero.var = nearZeroVar(data[, which(!colnames(data) %in% no.features)], freqCut = 95/5, uniqueCut = 10, saveMetrics = FALSE, allowParallel = TRUE) length(exclude_zero.var) exclude_zero.var = colnames(data[, which(!colnames(data) %in% no.features)])[exclude_zero.var] data = data %>% dplyr::select(-all_of(exclude_zero.var)) | Data Variable | https://osf.io/b7krz/ | ML_target_independent_preprocessing.R |
1,003 | Add the posterior_samples values as a column in the dataframe. Repeat it as many times as there are cell in the factorial design, namely 2. factor estimates | post.data$b_GramGender2 <- rep(posterior_samples(model.study2)[['b_GramGender2']], 2) | Data Variable | https://osf.io/5xdbu/ | study2-rscript.R |
1,004 | create dataset with only correct trials and only trials above 100 ms | data.3SD <- data[data$corr == 1, ] data.3SD <- data.3SD[data.3SD$min2000 == 1, ] data.3SD <- data.3SD[data.3SD$plus100 == 1, ] | Data Variable | https://osf.io/5yvnb/ | analyse_final_Exp6_OSF.R |
1,005 | Function for showing parameter estimats with pvalues for polr models | showCoefWithPValue <- function(model) { coef <- coef(summary(model)) pvalue <- pnorm(abs(coef[, "t value"]), lower.tail = FALSE) * 2 coef <- cbind(coef, "pvalue" = pvalue) return(round(coef, 4)) } | Statistical Modeling | https://osf.io/aczx5/ | 220423_FinalModelEstimation.R |
1,006 | Correlation between bulletin user type and avalanche awareness training | cor.test(as.numeric(PartBkgr$BullUseType), as.numeric(PartBkgr$BackgrAvTraining), method = "spearman") | Data Variable | https://osf.io/aczx5/ | 220423_FinalModelEstimation.R |
1,007 | This additional analysis test the influence of trialbytrial blink duration on response error by computing individual Bayes factors the Bayes factor is calculated by examining the residuals of a null model and how they correlate with blinkdurations the procedure use a 'default' prior for calculating bayes factors for correlations code here: | source("BF_correlations.R") bf_null <- rep(NA, length(unique(d$Subject))) dur_slope <- rep(NA, length(unique(d$Subject))) for(i in 1:length(bf_null)){ d_i <- d[d$Subject==unique(d$Subject)[i] & d$cond1==1,] m0 <- lm(ResponseError~vel1, d_i) m1 <- lm(ResponseError~vel1 + cond1:bdur, d_i) dur_slope[i] <- coef(m1)[3] bf_null[i] <- 1/bf10JeffreysIntegrate(n=nrow(d_i), r=cor(residuals(m0), d_i$bdur)) } | Statistical Test | https://osf.io/f6qsk/ | analysis_exp1.R |
1,008 | median and range of BF supporting the null | round(median(bf_null[bf_null > 10^(1/2)]),digits=2) round(range(bf_null[bf_null > 10^(1/2)]),digits=2) | Statistical Test | https://osf.io/f6qsk/ | analysis_exp1.R |
1,009 | calculate number of days between symptoms | mutate( ill_where_n=ifelse(sym_temp==1, 1, 0), ill_where_n=cumsum(ill_where_n), ill_where_n=ifelse(sym_temp==1, ill_where_n, NA), prev_day_ill=lag(sym_temp, 1), day_lag=lag(day_date, 1), | Data Variable | https://osf.io/n7sep/ | code.R |
1,010 | recode illness vars as NA if no specific symptoms during episode | mutate_at(vars(ill_where_id, ill_where_n, ill_where_start, ill_where_end, ill_where_new), funs(ifelse(any_specif_sym==FALSE, NA,. ))) %>% | Data Variable | https://osf.io/n7sep/ | code.R |
1,011 | remove spaces, brackets, periods in column names | names(df) <- gsub("\\s+", "", names(df)) names(df) <- gsub("\\(|\\)", "", names(df)) names(df) <- gsub("\\.", "", names(df)) cat(" ðÂÂÂ
Column names fixed (no spaces, brackets, periods)\n") | Data Variable | https://osf.io/mp9td/ | preflight.r |
1,012 | initialization of the vectors with the names of the modueles/variables | names.modules.df.w <- names.var.modules <- NULL | Data Variable | https://osf.io/kgtx6/ | f_readRShare.R |
1,013 | list of the directories included in the datadir directory | my.dirlist <- list.dirs(path = datadir) if (length(my.dirlist) == 0) stop("There are no subdirectories in the directory that you selected.") | Data Variable | https://osf.io/kgtx6/ | f_readRShare.R |
1,014 | creates a list with the names of the variables included for each module | names.var.modules <- vector("list", num.waves) names(names.var.modules) <- paste("Wave", waves) if(verbose) cat("Reading data from the selected modules within the waves. \n") | Data Variable | https://osf.io/kgtx6/ | f_readRShare.R |
1,015 | check which of the specified variables are actually present in the downloaded data | which.var.ok <- variables.in.modules[[i.mod]] %in% names(new.data) if (any(!which.var.ok)) warning( "Some of the variables that you selected from module ", modules[i.mod], " in wave ", waves[i.wave], " are not included in the data set. \n The variables that could not be imported were: ", variables.in.modules[[i.mod]][!which.var.ok], ". Please check these variables, the other variables were exported. \n" ) new.data <- select(new.data, variables.in.modules[[i.mod]][which.var.ok]) } names(new.data)[-1] <- paste(names(new.data)[-1], modules[i.mod], sep = "...") | Data Variable | https://osf.io/kgtx6/ | f_readRShare.R |
1,016 | Trim outliers Perform winsorizing (replacefor each individual seperatelyvalues below 5th percentile and values above 95th percentile with 5th and 95th percentile values respectively) | for(i in min(all.df$person):max(all.df$person)){ all.df$zw.HR[all.df$person == i] <- Winsorize(all.df$z.HR[all.df$person==i]) } | Data Variable | https://osf.io/qj86m/ | 2_data_prep_merge.R |
1,017 | Create a lag variable the data is lag within person and within days | lag.Y = function(data){ Y_lag = rep(0,nrow(data)) subjno.i = unique(data$subjno) for (i in subjno.i){ n.i = which(data$subjno==i) Y_lag[n.i] = shift(data$Y[n.i],1) } return(Y_lag) } | Data Variable | https://osf.io/vguey/ | lag.Y.R |
1,018 | Personality models Extract standardized parameters and N from personality models | Values_Analysis1_Model1_Pers <- Values_Personality[which(Values_Personality$analysis == "analysis1" & ((Values_Personality$study %in% c("S1", "S2") & Values_Personality$DV == "well_being") | (Values_Personality$study == "S3" & Values_Personality$DV == "affect_balance")) & Values_Personality$output %in% c("standardized", "N")), ] Values_Analysis1_Model2_Pers <- Values_Personality[which(Values_Personality$analysis == "analysis2" & ((Values_Personality$study %in% c("S1", "S2") & Values_Personality$DV == "well_being") | (Values_Personality$study == "S3" & Values_Personality$DV == "affect_balance")) & Values_Personality$output %in% c("standardized", "N")), ] Values_Analysis1_Model3_Pers <- Values_Personality[which(Values_Personality$analysis == "analysis3" & ((Values_Personality$study %in% c("S1", "S2") & Values_Personality$DV == "well_being") | (Values_Personality$study == "S3" & Values_Personality$DV == "affect_balance")) & Values_Personality$output %in% c("standardized", "N")), ] | Data Variable | https://osf.io/nxyh3/ | MainTables.R |
1,019 | Extract withinperson variances of interactions with close peers, family, and weak ties from unstandardized models | variances <- Values_Base$est[which(Values_Base$analysis == "analysis3" & ((Values_Base$study %in% c("S1", "S2") & Values_Base$DV == "well_being") | (Values_Base$study == "S3" & Values_Base$DV == "affect_balance")) & Values_Base$output == "unstandardized" & Values_Base$paramHeader == "Variances" & Values_Base$param %in% c("PEERS", "FAMILY", "WEAK_TIES") & Values_Base$BetweenWithin == "Within")] rows <- which(Values_Analysis1_Model3$paramHeader %in% c("S1|WB.ON", "S2|WB.ON", "S3|WB.ON") & Values_Analysis1_Model3$param %in% c("PEERS", "FAMILY", "WEAK_TIES")) # within-person effects variances <- Values_Personality$est[which(Values_Personality$analysis == "analysis3" & ((Values_Personality$study %in% c("S1", "S2") & Values_Personality$DV == "well_being") | (Values_Personality$study == "S3" & Values_Personality$DV == "affect_balance")) & Values_Personality$output == "unstandardized" & Values_Personality$paramHeader == "Variances" & Values_Personality$param %in% c("PEERS", "FAMILY", "WEAK_TIES") & Values_Personality$BetweenWithin == "Within")] rows <- which(Values_Analysis1_Model3_Pers$paramHeader %in% c("S1|WB.ON", "S2|WB.ON", "S3|WB.ON") & Values_Analysis1_Model3_Pers$param %in% c("PEERS", "FAMILY", "WEAK_TIES")) # within-person effects | Statistical Modeling | https://osf.io/nxyh3/ | MainTables.R |
1,020 | Model selection for four data sets First find bestfitting random effect model, then test for fixed effect predictors Process is backward by elimintating weakest terms sequentially, starting with full model, until only significant effects remain Nested model comparisons (likelihood ratio tests using anova command) are used to select best fitting models _ Pair Experiment 1 Random effects: selecting empty model | pair1_rand_full <- lmer(distance ~ (1 | group) + (1 + session0 | pair), data = pair_data1) # full random model;; fails to converge pair1_rand_full <- lmer(distance ~ (1 | group) + (1 + session0 | pair), data = pair_data1, control = lmerControl(optimizer = "bobyqa")) # full random model;; uses bobyqa optimizer pair1_rand2 <- lmer(distance ~ (1 + session0 | pair), data = pair_data1) # drops group ran.intercept;; fails to converge pair1_rand2 <- lmer(distance ~ (1 + session0 | pair), data = pair_data1, control = lmerControl(optimizer = "bobyqa")) # drops group ran.intercept;; uses bobyqa optimizer;; BEST pair1_rand3 <- lmer(distance ~ (1 | pair), data = pair_data1) # drops random slope | Statistical Modeling | https://osf.io/67ncp/ | duque_etal_2020_rcode.R |
1,021 | Pearson's correlation calculation | calc_r <- function(model_vector, data_vector, S_0, D_0, M_0, E_0, filename) { sst_mean <- mean(data_vector) sst_vector <- (data_vector - sst_mean) ^ 2 sst <- sum(sst_vector) ssr_vector <- (data_vector - model_vector) ^ 2 ssr <- sum(ssr_vector) r_sq <- 1 - (ssr / sst) cat(r_sq, file = paste(format(Sys.time(),"%Y_%m_%d_%H_%M"), filename, "r_sq", "S", S_0, "D", D_0, "M", M_0, "E", E_0, ".txt", sep = "_")) return(r_sq) } r_sq <- calc_r(CO2_flux_ratios_hat_median, data_vector, S_0, D_0, M_0, E_0, filename) | Statistical Test | https://osf.io/7mey8/ | stan_AWB_adriana_pools5i_vary_mic.r |
1,022 | Data wrangling recode values for missing data (9, 1) in whole dataset as NA | data <- data %>% mutate_all(~na_if(., -9)) data <- data %>% mutate_all(~na_if(., -1)) | Data Variable | https://osf.io/r4wg2/ | elsa_analyses.R |
1,023 | age recode values of 99 as missing | data$indager.w2[data$indager.w2 == 99] <- NA data$age <- data$indager.w2 | Data Variable | https://osf.io/r4wg2/ | elsa_analyses.R |
1,024 | Fit models with trimmed weights Weighted regression model for SciPop Score (Goertz approach) | m3.scipopgoertz.trim.svyglm.fit <- svyglm(scipopgoertz ~ age + gender + education.comp + education.uni + sciprox.score + urbanity.log + languageregion.ger + languageregion.ita + polorientation + religiosity + interestscience + sciliteracy + trustscience + trustscientists, design = bar.design.scipopgoertz.trim, family = gaussian, na.action = na.omit) | Statistical Modeling | https://osf.io/qj4xr/ | 06_sensitivity-tests.R |
1,025 | for each row assign fixation probability (1 or 0) to each picture based on the activation !! need a better decision criteria when the activations are the same;; !! right now it assigns '1' to both | dt.act$max.act = apply(dt.act[,4:7], 1, max) dt.act = subset(dt.act, max.act != 0) | Data Variable | https://osf.io/fsbzw/ | plot.fix.e1.R |
1,026 | 4.4.4) Create data where u(x) is at sample means to get residuals based on rest of models to act as yobs Recall: columns 1 & 2 have y and u(x) in obs.data | data.xufixed =data.obs data.xufixed[,2]=mean(data.obs[,2]) #Note, the 1st predictor, 2nd columns, is always the one hypothesized to be u-shaped | Data Variable | https://osf.io/hu2n8/ | Simonsohn_twolines_tweaked.R |
1,027 | 6 RUN TWO LINE REGRESSIONS 6.1 First an interrupted regression at the midpoint of the flat region | rmid=reg2(f,xc=median(xflat),graph=0, axislabels=axislabels) | Statistical Modeling | https://osf.io/hu2n8/ | Simonsohn_twolines_tweaked.R |
1,028 | Pairwise comparison of optimism scores for each cue and table Wilcoxon signedrank test | cue_diff_wilcox_ts = wilcox.paired.multcomp( opt_score ~ cue | id, subset(jbt_all, jbt_all$cjb_test == "ts"), p.method = "holm") cue_diff_wilcox_tunnel = wilcox.paired.multcomp( opt_score ~ cue | id, subset(jbt_all, jbt_all$cjb_test == "tunnel"), p.method = "holm") | Statistical Test | https://osf.io/z6nm8/ | Stats_figures_JBT.R |
1,029 | round the numeric values (p that is not < 0.001) | cue_diff_wilcox_ts$p.value[numeric_values] <- round(as.numeric(cue_diff_wilcox_ts$p.value[numeric_values]), 3) names(cue_diff_wilcox_ts) <- c("Cues compared","p-value") | Data Variable | https://osf.io/z6nm8/ | Stats_figures_JBT.R |
1,030 | new tibble with IDs and emails | wos_emails <- tibble( "responseID" = wos$response_ID, "email" = wos$email ) aaas_emails <- tibble( "responseID" = aaas$response_ID, "email" = aaas$email ) | Data Variable | https://osf.io/3bn9u/ | 4_1_deidentification.R |
1,031 | drop rows with empty email fields | wos_emails <- drop_na( wos_emails, email ) aaas_emails <- drop_na( aaas_emails, email ) | Data Variable | https://osf.io/3bn9u/ | 4_1_deidentification.R |
1,032 | getmode() Get mode of a variable Input: numeric vector Output: single number | getmode <- function(v) { uniqv <- unique(v) uniqv[which.max(tabulate(match(v, uniqv)))] } | Data Variable | https://osf.io/8fzns/ | 2H_Recode_helper.R |
1,033 | For studyProgramme remove countries with only one programme | if(varname == "studyProgram" & length(lev) == 1){ return(NA) } | Data Variable | https://osf.io/8fzns/ | 2H_Recode_helper.R |
1,034 | Model for Frequency DV | mod1.1 <- lmer(frequency ~ ruleType + (1|sceneType) + (1|Participant), contrasts = my.contrasts, data = PD3a.Long) icc(mod1.1) summary(mod1.1) emmeans(mod1.1,list(pairwise~ruleType),adjust="satterthwaite") confint(mod1.1) | Data Variable | https://osf.io/dhmjx/ | ExperimentS1-Analyses.R |
1,035 | Define functions Means, SDs, and two sample ttests comparing Swiss census data and the panel sample | census.msd <- function(v) { v <- reformulate(v) cbind( as.data.frame(svyby(v, ~t, dslong_dsgn, svymean, na.rm = T))[-c(1,3)], # M (exclude SE) sqrt(as.data.frame(svyby(v, ~t, dslong_dsgn, svyvar, na.rm = T)[[2]]))) %>% # SD (with a workaround) set_colnames(c("M", "SD")) %>% set_rownames(c("2019 (census)", "2019 (panel)")) } | Statistical Test | https://osf.io/3hgpe/ | 02_analysis.R |
1,036 | RQ1: Examine predictors of change in SciPop Scores and subscale scores .. Visual inspection with Sankey plot Visualize withinsubject change in SciPop Score in Sankey plot | dslongpnl %>% group_by(t, scipopgoertz) %>% summarise(scipopgoertz_freq = n()) %>% merge(dslongpnl, by = c("scipopgoertz", "t")) %>% transform(scipopgoertz_lvls = factor(scipopgoertz, levels = c("5", "4.5", "4", "3.5", "3", "2.5", "2", "1.5", "1", "NA"))) %>% replace_na(list(scipopgoertz_lvls = "NA")) %>% ggplot(aes(x = t, stratum = scipopgoertz_lvls, alluvium = id, y = scipopgoertz_freq, fill = scipopgoertz_lvls, label = scipopgoertz_lvls)) + scale_x_discrete(expand = c(.1, .1)) + scale_fill_viridis_d() + geom_flow(width = .1) + geom_stratum(alpha = .5, width = .1) + geom_text(stat = "stratum", size = 4) + ggtitle("Sankey plot of within-subject change in SciPop Score") + theme_minimal() + theme(legend.position = "none", panel.grid = element_blank(), axis.text.y = element_blank(), axis.ticks.y = element_blank()) | Visualization | https://osf.io/3hgpe/ | 02_analysis.R |
1,037 | H1 analyses .. Descriptive analyses Plot means, SDs, skewness, kurtosis of alternative SciPop Scores | meantbl <- as.data.frame(matrix(0, nrow = 2)) groups <- quos(scipopgoertz, scipopbollenm, scipopbollencfa, scipopsartori75, scipopsartoricat) for (j in seq_along(groups)) { meantbl <- cbind(meantbl, group_by(dslongpnl, t) %>% summarise(mean = mean(!!groups[[j]], na.rm = T), sd = sd(!!groups[[j]], na.rm = T), skewness = skewness(!!groups[[j]], na.rm = T), kurtosis = kurtosis(!!groups[[j]], na.rm = T))) names(meantbl)[names(meantbl) == "mean"] <- paste0(quo_text(groups[[j]]), " (M)") names(meantbl)[names(meantbl) == "sd"] <- paste0(quo_text(groups[[j]]), " (SD)") names(meantbl)[names(meantbl) == "skewness"] <- paste0(quo_text(groups[[j]]), " (Skewness)") names(meantbl)[names(meantbl) == "kurtosis"] <- paste0(quo_text(groups[[j]]), " (Kurtosis)") meantbl <- select(meantbl, contains("scipop")) %>% set_rownames(c("2019", "2020")) } | Visualization | https://osf.io/3hgpe/ | 02_analysis.R |
1,038 | save means and compute their higher order terms | dfs$x.mean <- mean( dfs$x, na.rm = TRUE ) dfs$y.mean <- mean( dfs$y, na.rm = TRUE ) dfs$x2.mean <- dfs$x.mean^2 dfs$xy.mean <- dfs$x.mean*dfs$y.mean dfs$y2.mean <- dfs$y.mean^2 dfs } | Statistical Modeling | https://osf.io/jhyu9/ | PrepareData.R |
1,039 | add column indicating if individual gave birth during testing (this will help with age classification) | birthsanc <- read_excel("motherssanctuary.xlsx", col_types=c("text", "date")) bigdatasanctuary$Individual<-as.factor(bigdatasanctuary$Individual) birthsanc$Mother <- as.factor(birthsanc$Mother) bigdatasanctuary$mother <- ifelse(bigdatasanctuary$Individual %in% birthsanc$Mother, "yes", "no") bigdatasanctuary$birth <- birthsanc$Date[match(bigdatasanctuary$Individual, birthsanc$Mother)] bigdatasanctuary$birth <- as.Date(bigdatasanctuary$birth, format="YY-mm-dd") bigdatasanctuary$testbeforebirth <- ifelse(!is.na(bigdatasanctuary$birth) & bigdatasanctuary$birth > bigdatasanctuary$TestDate, "yes", "no") bigdatasanctuary$AgeAtTesting <- as.numeric(bigdatasanctuary$AgeAtTesting) | Data Variable | https://osf.io/p2xgq/ | Analyses for revision |
1,040 | Step 1 compare the rising ridge asymmetric congruence model (RRCA) and the full thirdorder model (cubic) | rrca_comp <- compare2(rrca_myrsa, "RRCA", "cubic") rrca_comp | Statistical Modeling | https://osf.io/drv3a/ | illustration.R |
1,041 | How much variance in the outcome can be explained by the full thirdorder polynomial model/the rising ridge leveldependent congruence model? | getPar(rrcl_myrsa, model="cubic", type="R2") getPar(rrcl_myrsa, model="RRCL", type="R2") | Statistical Modeling | https://osf.io/drv3a/ | illustration.R |
1,042 | get subsequent fixation index (+1) and retrieve row number using fi_pars and assign | scope_start[i] <- fi_pairs$fistart[scope_start_fis[i] + 1] } return(scope_start) } | Data Variable | https://osf.io/mp9td/ | get_first_free_fi.R |
1,043 | Exclude participants who completed less than 10 surveys | dat <- dat[-which(dat$N < 10), ] dim(dat) # 36074 assessments length(unique(dat$id)) # 1177 participants (1109 participants excluded) | Data Variable | https://osf.io/nxyh3/ | 01b_DataPrep_Study2.R |
1,044 | define function to compute colors and point sizes that yield 3d effect | points3d <- function(data, xname, yname, zname, cex.limit.close = 1.7, cex.limit.far = 1, col.limit.close = 0.1, col.limit.far = 0.8, adapted_eye = list(x=-12, y=-16, z=2) ){ | Visualization | https://osf.io/fbshg/ | ComF_helpers.R |
1,045 | for each row of the data, compute euclidean distance between the person's 3dim point and the plane | distance <- abs( (data[,xname] - a$x) * n$x + (data[,yname] - a$y) * n$y + (data[,zname] - a$z) * n$z ) / sqrt(n$x^2 + n$y^2 + n$z^2) | Data Variable | https://osf.io/fbshg/ | ComF_helpers.R |
1,046 | Calculate delta change in testosterone pivot data sets for delta values | hormones_wide <-hormones %>% pivot_wider(id_cols = c("id", "sex"), names_from = condition, values_from = t_conc_corr) %>% mutate(delta_t = back_home - baseline) delta_t <- left_join(hormones, hormones_wide) delta_t <- delta_t %>% filter(condition == "baseline")%>% filter(!is.na(delta_t)) | Data Variable | https://osf.io/3bpn6/ | af_testosterone_analysis.R |
1,047 | Plot sex and time point Boxplot for sex differences | t_condition <- hormones %>% ggplot(aes(x = condition, y = log(t_conc_corr), fill = sex)) + geom_boxplot(outlier.shape = NA, width = 0.7) + | Visualization | https://osf.io/3bpn6/ | af_testosterone_analysis.R |
1,048 | Network Estimation Ising Model (Binary Data) can be estimated via estimateNetwork variables automatically binarized at median estimate regularized logistic nodewise regression network define where to binarize variables eLASSO (LASSO with EBIC model selection) listwise deletion of missing values (pairwise not possible for regressions) | Ising_net <- estimateNetwork(data, default = "IsingFit", missing = "listwise", rule = "OR") | Statistical Modeling | https://osf.io/b4gc7/ | workshop_example.R |
1,049 | compare GGM and Ising model correlating weights matrices | cor.test(Wmat_GGM[upper.tri(Wmat_GGM)], Wmat_Ising[upper.tri(Wmat_Ising)]) #.80 | Statistical Modeling | https://osf.io/b4gc7/ | workshop_example.R |
1,050 | create a storage container (i.e. a empty lists) for all hit_names ... ... that track looking times over all trials (e.g., looking_times$left) | looking_times <- setNames(vector("list", length(hit_names)), hit_names) | Data Variable | https://osf.io/yfegm/ | getLooks.r |
1,051 | create a storage container for all looking frequencies (i.e., counting the number of looks within an AOI) | looking_frequencies <- setNames(vector("list", length(hit_names)), hit_names) | Data Variable | https://osf.io/yfegm/ | getLooks.r |
1,052 | init storage containers for looking frequencies | current_trial_total_looks <- setNames(vector("list", length(hit_names)), hit_names) for (hn in hit_names) { | Data Variable | https://osf.io/yfegm/ | getLooks.r |
1,053 | get first and last FixationIndex (remove NAs), which define the boundaries of a single trial | min_FixationIndex <- min(inter_trial_FixationIndexes, na.rm = TRUE) max_FixationIndex <- max(inter_trial_FixationIndexes, na.rm = TRUE) | Data Variable | https://osf.io/yfegm/ | getLooks.r |
1,054 | space between axis label and tick mark labels | my_settings$layout.widths$ylab.axis.padding <- 0.2 my_settings$layout.heights$axis.xlab.padding <- 0.2 my_settings$box.rectangle$col = 1 my_settings$box.umbrella$col = 1 my_settings$box.dot$col = 1 my_settings$plot.symbol$col = 1 | Visualization | https://osf.io/mc26t/ | my_utils.R |
1,055 | Overlay the basic grid with colourful grid corresponding to the limits of sensitive period rectangles. These colourful lines should start in the points indicating the change values. | cols<-colscale[sapply(result$p1,function(x){which.min(abs(x-scaleseq))})] cols<-colscale[sapply(result$p1.rand[,exrun],function(x){which.min(abs(x-scaleseq))})] | Visualization | https://osf.io/greqt/ | 06_extrapermut_comaprison_with_random.R |
1,056 | Skew effect | neg <- apply(chains[,c(1,3)], 1, sum) pos <- apply(chains[,c(1,2)], 1, sum) quantile(neg-pos, prob=c(.025, .975)) neg <- apply(chains[,c(1,3)], 1, sum) pos <- apply(chains[,c(1,2)], 1, sum) quantile(pos-neg, prob=c(.025, .975)) | Visualization | https://osf.io/8abj4/ | Exp1.R |
1,057 | Fit hierarchical Bayesian model | fit.HBM <- stan(file='CAM_full_1.stan', data=c('Nobs','Nind','stim','bias','RM','AS','B1','id','mid','stim_sizes','Nstim'), chains=4, iter=2500, cores=no_cores, control=list(adapt_delta=.90, max_treedepth=15)) fit.HBM sum(summary(fit.HBM)$summary[,'Rhat'] > 1.01) pars <- extract(fit.HBM) | Statistical Modeling | https://osf.io/8abj4/ | Exp1.R |
1,058 | Compute probabilities using MNL model | P[['choice']] = apollo_mnl(mnl_settings1, functionality) P[["indic_cost_tap"]] = apollo_mnl(mnl_settings2, functionality) P[["indic_na1"]] = apollo_mnl(mnl_settings3, functionality) P[["indic_na2"]] = apollo_mnl(mnl_settings4, functionality) P[["indic_na3"]] = apollo_mnl(mnl_settings5, functionality) P[["indic_cost_bottle"]] = apollo_ol(ol_settings5, functionality) P[["indic_bill"]]= apollo_normalDensity(normalDensity_settings1,functionality) P[["indic_qual"]] = apollo_ol(ol_settingsB1, functionality) P[["indic_qual_f"]] = apollo_ol(ol_settingsB3, functionality) P = apollo_combineModels(P, apollo_inputs, functionality) | Statistical Modeling | https://osf.io/6pq9e/ | Model.R |
1,059 | d) Ftest (Stephan Gries 2013, p. 218) [only for normally distributed variables!] use var.test() Output interpretation: 1) Is p > .05?;; 2) Does the CI include 1? | F.lextale <- var.test(pp.explicit.incidental$lextale~pp.explicit.incidental$learningtype);; F.lextale | Statistical Test | https://osf.io/938ye/ | Apriori_group_differences.R |
1,060 | c) Wilcoxon ranksum test ( MannWhitney U test) [Nonparametric alternative if normality is violated, or if you have ordinal data] Continuous variables: ratioscaled lextale | wilcox.lextale <- wilcox.test(lextale~learningtype, data=pp.explicit.incidental, paired=FALSE);; wilcox.lextale | Statistical Test | https://osf.io/938ye/ | Apriori_group_differences.R |
1,061 | Selfrated variables: ordinal proficiency_overall | wilcox.proficiency_overall <- wilcox.test(proficiency_overall~learningtype, data=pp.explicit.incidental, paired=FALSE);; wilcox.proficiency_overall | Data Variable | https://osf.io/938ye/ | Apriori_group_differences.R |
1,062 | Effect size (approximate) for Wilcoxon ranksum test Write the function (from Field, Miles & Fiels 2012, p.665) | rWilcox <- function(wilcoxModel, N){ z <- qnorm(wilcoxModel$p.value/2) r <- z/sqrt(N) cat(wilcoxModel$data.name, "Effect size, r = ", r) } | Statistical Modeling | https://osf.io/938ye/ | Apriori_group_differences.R |
1,063 | create new variable for the IRV intraindividual response variability | data$irv <- irv( dplyr::select( data, belonging, control, meaningful_existence, self_esteem ), na.rm = TRUE, split = FALSE) | Data Variable | https://osf.io/bhrwx/ | script_for_the_analysis_of_game_data.R |
1,064 | display the correlations as a histogram and heatmap | cor_matrix_half <- cor_matrix[upper.tri(cor_matrix)] mean(cor_matrix_half) sd(cor_matrix_half) hist(as.vector(cor_matrix_half), breaks=24, cex.axis=2) # Note: Novich et al. suppressed correlations of r<.4 in their visualisation heatmap(x = cor_matrix, symm = TRUE) | Visualization | https://osf.io/r24vb/ | clustering_syn_types.R |
1,065 | Create stringent dataset Exclude People with Strange Response Patterns These are identified as subclusters in the inclusive dendogram that group together | inclusive_data$weird_responses = inclusive_data$body_postures_shape + inclusive_data$punctuation_shape + inclusive_data$letter_shape + inclusive_data$number_shape + inclusive_data$people_name_shape + inclusive_data$english_word_shape + inclusive_data$foreign_word_shape + inclusive_data$tastes_taste + inclusive_data$smells_smell + inclusive_data$noises_noise + inclusive_data$music_music + inclusive_data$colour_colour + inclusive_data$shapes_shape + inclusive_data$smells_taste + inclusive_data$tastes_smell + inclusive_data$voices_noise + inclusive_data$voices_music + inclusive_data$noises_music + inclusive_data$music_noise hist(inclusive_data$weird_responses) table(inclusive_data$weird_responses) | Data Variable | https://osf.io/r24vb/ | clustering_syn_types.R |
1,066 | gives the prevalence of each cluster of data | colMeans(short_data) N_types <- matrix(apply(short_data[,1:i], 1, sum, na.rm=TRUE)) stringent_N_clusters <- cbind(stringent_N_clusters,N_types) } | Data Variable | https://osf.io/r24vb/ | clustering_syn_types.R |
1,067 | create a continuoius time metric (seconds since midnight of day0) | dat$sec_midnight.day0 <- dat$start.secmidnight + dat$day * 86400 | Data Variable | https://osf.io/6krj7/ | 01_addlagvars.R |
1,068 | create a variable indicating, if the current observation is the first observation of the day ("morning") this variable is 1, if the current observation was obtained on a different day than the previous observation | dat[!is.na(dat$lagday) & dat$day!=dat$lagday, "morning"] <- 1 dat[!is.na(dat$lagday) & dat$day==dat$lagday, "morning"] <- 0 | Data Variable | https://osf.io/6krj7/ | 01_addlagvars.R |
1,069 | create continuous time variable in hours and seconds | data$time_to_hours = lubridate::hour(data$timestamp.corrected) + lubridate::minute(data$timestamp.corrected)/60 + lubridate::second(data$timestamp.corrected)/3600 data$time_to_sec = data$time_to_hours*60*60 return(data) } | Data Variable | https://osf.io/b7krz/ | timestamp_correction.R |
1,070 | set font size for facet labels | strip.text.x = element_text(size = font_size_facets_x), strip.text.y = element_text(size = font_size_facets_y), strip.text.x = element_text(size = font_size_facets_x), strip.text.y = element_text(size = font_size_facets_y), | Visualization | https://osf.io/dpkyb/ | my_ggplot_themes.R |