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
javascript:(function(){ var d=document.getElementsByClassName("docos-accept-suggestion"); d = Array.prototype.slice.call(d); var i=1; d.forEach(function(n){console.log("accepting"); var e = document.createEvent("MouseEvents"); e.initEvent("click", true, false); n.dispatchEvent(e,true); e = document.createEvent("MouseEvents"); e.initEvent("mousedown", true, false); n.dispatchEvent(e,true); e = document.createEvent("MouseEvents"); e.initEvent("mouseup", true, false); i++; i++; setTimeout( function(){ n.dispatchEvent(e,true); } , (i * 1000)); }); })(); |
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
# standard error function | |
stderr <- function(x) { | |
sqrt(var(x[!is.na(x)]) / length(x[!is.na(x)])) | |
} | |
# Then create a wrapper to *stderr* to make it compatible with *stat_summary* | |
my.stderr <- function(x) { | |
meany <- mean(x) | |
ymin <- mean(x) - stderr(x) | |
ymax <- mean(x) + stderr(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
result <- rawToChar(as.raw(sample(c(48:57,65:90,97:122),16,replace=T))) |
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
gg_marginal_effects <- function(model, effects, probs=c(0.25, 0.75)) { | |
me <- brms::marginal_effects(model, effects=effects, probs=probs) | |
plt.me <- plot(me, | |
effects=effects, | |
plot=FALSE, | |
rug=TRUE, | |
theme=ggplot2::theme_get() | |
)[[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
dfPlot <- (ggplot_build(plt))$data |
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
def stat_summary(x, quantiles=False): | |
import numpy as np | |
print "mean:", np.mean(x) | |
print "sd:", np.std(x) | |
print "max:", np.max(x) | |
print "min:", np.min(x) | |
print "count:", len(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
# author: Derek Powell | |
# created: 11-02-2017 | |
# last updated: 1/11/18, 5:19 PM | |
# Also available as gist: | |
# devtools::source_gist("8838d867daa4185c9c09187a6b02f96b", filename="crossValidate.R") | |
library(tidyverse) | |
library(multidplyr) | |
library(modelr) | |
library(purrr) |
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
theme(axis.text.x = element_text(angle = 90, hjust = 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
# Author: Derek Powell | |
# Date: 8/30/18, 4:49 PM | |
# --- | |
# Script to redact workerIds and ip addresses from qualtrics files. | |
# Script looks for "date_private/" directory, saves resulting data in "data" directory. | |
# Personal info is replaced with a "hash" using xxhash64, | |
# a super fast hash algo w/ short resulting hashes (confirmed appropriate for this use) | |
suppressMessages(library(tidyverse)) | |
suppressMessages(library(digest)) |
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
model_name <- brm( | |
DV ~ formula, | |
data = d, | |
family = normal(), # student(), #cumulative(), #bernoulli(), etc | |
control = list(adapt_delta = .80), | |
cores = parallel::detectCores(), | |
iter = 2000) |
OlderNewer