🤷♂️
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
a <- rnorm(50) # this is stationary | |
b <- cumsum(rnorm(50)) # this is not | |
spp_test <- function(x, lag_short = TRUE, n_sims = 1000, interpret = TRUE, | |
pp_stat = "tau") { | |
if (!pp_stat %in% c("tau", "rho") | length(pp_stat) > 1) { | |
stop("The only 'pp_stat' arguments that make sense in this context is 'tau' or 'rho'. Pick one of the two.") | |
} |
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
############################################################################################ | |
# This R function helps to interpret the output of the urca::ur.df function. | |
# The rules are based on https://stats.stackexchange.com/questions/24072/interpreting-rs-ur-df-dickey-fuller-unit-root-test-results | |
# | |
# urdf is the output of the urca::ur.df function | |
# level is one of c("1pct", "5pct", "10pct") | |
# | |
# Author: Hank Roark | |
# Date: October 2019 | |
############################################################################################ |
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
library(tidyverse) | |
library(stevemisc) | |
jenny() | |
num_nums <- tibble() | |
for (i in 1:100) { | |
tibble(x = runif(50), | |
runsum = cumsum(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
# I'm teaching myself some shit. Bear with me. | |
using RData, DataFrame | |
df = load("/home/steve/Dropbox/projects/stevemisc/data/strategic_rivalries.rda") | |
df # not what I want... | |
df2 = DataFrame(df)[:, 1] # what I want... |
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
--- | |
output: | |
stevetemplates::article: | |
fig_caption: true | |
keep_tex: TRUE | |
#bibliography: master.bib | |
biblio-style: apsr | |
title: "A Pandoc Markdown Article Starter and Template" | |
thanks: "Replication files are available on the author's Github account (http://github.com/svmiller). **Current version**: `r format(Sys.time(), '%B %d, %Y')`; **Corresponding author**: svmille@clemson.edu." | |
author: |
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
create_stateyears(system = 'gw') %>% | |
filter(year %in% c(1946:2019)) %>% | |
add_ucdp_acd(type=c("intrastate"), only_wars = TRUE) %>% | |
add_peace_years() %>% | |
add_democracy() %>% | |
add_creg_fractionalization() %>% | |
add_sdp_gdp() %>% | |
add_rugged_terrain() -> Data | |
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
library(tidyverse) | |
library(peacesciencer) | |
library(stevemisc) | |
# https://stackoverflow.com/questions/10893611/storing-tic-toc-values-in-r | |
library(tictoc) | |
tic.clearlog() | |
for (x in 1:100) { | |
# passing x to tic() makes it a label at time of the matching toc() call. |
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
set.seed(8675309) | |
tibble(age = round(runif(25,18,80)), | |
e = rnorm(25,0,5), | |
approval = round(1.25*age + e)) -> Dat | |
Dat %>% | |
ggplot(.,aes(age, approval)) + | |
geom_point() |
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
library(tidyverse) | |
library(stevedata) | |
library(brms) | |
# what follows is me being an idiot. Don't be Steve. Don't be an idiot. | |
?therms | |
# For anyone with a brain: the better you think of Obama, the worse you think of Trump (and vice-versa). |
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
# Let's load the packages and the data. ----- | |
# See this instead: http://svmiller.com/blog/2020/04/summarizing-ordinal-models-with-simulation-multivariate-normal/ | |
library(stevemisc) | |
library(post8000r) | |
library(tidyverse) | |
TV16 %>% | |
filter(racef == "White") %>% | |
filter(state %in% c("Indiana","Ohio","Pennsylvania","Wisconsin","Michigan")) %>% |
NewerOlder