This file contains hidden or 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) | |
library(broom) | |
library(gridExtra) | |
reg_return <- function(N) { | |
# Choose effect size | |
fx <- .05 | |
df <- tibble(x = runif(N) > .5) %>% |
This file contains hidden or 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
# The package for this function isn't quite ready yet, but you may find it handy nonetheless! | |
# Eventually this will be part of a package. | |
#' factorPull | |
#' | |
#' This function takes any estimated regression compatible with \code{broom::tidy()} that contains a factor variable, or a factor variable interacted with something else. It will pull out those coefficients and line them up with the original data so you can store them as a variable. | |
#' | |
#' If multiple coefficients related to the factor are dropped from the model, be sure to check the result. | |
#' | |
#' @param model A model object compatible with \code{broom::tidy()}. |
This file contains hidden or 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) | |
library(Hmisc) | |
library(gganimate) | |
library(tweenr) | |
curve_intersect <- function(c1x, c1y, c2x, c2y, empirical=TRUE, domain=NULL) { | |
curve1 <- data.frame(x = c1x, y = c1y) | |
curve2 <- data.frame(x = c2x, y = c2y) | |
if (!empirical & missing(domain)) { |
NewerOlder