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
GGally::ggpairs(upper = list(continuous = "points"), | |
lower = list(continuous = "cor")) |
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
# https://link.springer.com/article/10.1057/jma.2014.3#Tab2 | |
# using the exgaus distribution to model response time | |
library(tidyverse) | |
data.frame(x=c(0, 20)) %>% | |
ggplot(aes(x)) + | |
stat_function(fun=function(x) dexGAUS(x, mu=1, sigma=2, nu=3), | |
linetype = 1) + | |
stat_function(fun=function(x) dexGAUS(x, mu=4, sigma=0.04, nu=4), | |
linetype = 2) + |
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(purrr) | |
library(tidyverse) | |
# positive_round function | |
positive_round <- function(...) round(pmax(..., 0), 0) | |
# adstock function | |
adstock<-function(x,rate=0){ | |
return(as.numeric(stats::filter(x=x,filter=rate,method="recursive"))) |
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
```{r} | |
# load libraries | |
library(purrr) | |
library(tidyverse) | |
# positive_round function | |
positive_round <- function(...) round(pmax(..., 0), 0) | |
# adstock function | |
adstock<-function(x,rate=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
mutate(date = as.Date(paste(fiscal_year, fiscal_week_number, 1, sep="-"), "%Y-%U-%u")) %>% |
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
trans %>% | |
clean_names() %>% | |
group_by(rest_number) %>% | |
filter(!any(!complete.cases(comp_trans_ty_ty))) |
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
tq_mutate(select = usd,mutate_fun = rollapply,FUN = mean,width = 13, | |
col_rename = "roll13") %>% | |
tq_mutate(select = usd,mutate_fun = rollapply,FUN = mean,width = 2, | |
col_rename = "roll2") |
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 { | |
// the Hill function | |
real Hill(real t, real ec, real slope) { | |
return 1 / (1 + (t / ec)^(-slope)); | |
} | |
// the adstock transformation with a vector of weights | |
real Adstock(row_vector t, row_vector weights) { | |
return dot_product(t, weights) / sum(weights); | |
} | |
} |
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
mp <- plot(brms::marginal_effects(bfit), plot = F) | |
mp$x_promo_items + theme_ipsum() |
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
`%ni%` = Negate(`%in%`) |
OlderNewer