View dumb-resid
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
f1 = formula(log(cost) ~ date) | |
lm1 = lm(f1,data=nuclear) | |
stat = lm1$coeff[2] | |
resid = lm1$residuals | |
fit = lm1$fitted.values | |
n = dim(nuclear)[1] | |
B = 500 | |
stat0 = rep(0,B) |
View jhudsl.R
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(png) | |
library(ggforce) | |
library(animation) | |
library(tweenr) | |
jhu_png = readPNG("jhudsl.png") | |
x = rep(1:510,each=555) | |
y = rep(1:555,510) | |
val = jhu_png[,,3] | |
val = round(val) |
View forsean.R
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
plot_net = function(nodes_per_layer, layer_shape, connection_type, stride_length){ | |
total_nodes = sum(nodes_per_layer) | |
adjacency = matrix(0,nrow=total_nodes,ncol=total_nodes) | |
for(i in seq_along(connection_type)){ | |
source_nodes = 1:nodes_per_layer[i] + (i-1 > 0)*sum(nodes_per_layer[1:(i-1)]) | |
sink_nodes = 1:nodes_per_layer[(i+1)] + (i > 0)*sum(nodes_per_layer[1:i]) | |
nsource = length(source_nodes) |
View plot_net.R
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(ggnet) | |
#library(RkittleBrewer) | |
#library(network) | |
plot_net = function(nodes_per_layer, | |
layer_shape, | |
connection_type, | |
stride_length, | |
layer_color, | |
node_values, |
View close.Rmd
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
--- | |
title: "Tabset Column" | |
runtime: shiny | |
output: flexdashboard::flex_dashboard | |
--- | |
```{r setup, include=FALSE} | |
library(flexdashboard) |
View gist:4369771
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
# Make the canvas | |
plot(1:10,1:10,xlim=c(-5,5),ylim=c(0,10),type="n",xlab="",ylab="",xaxt="n",yaxt="n") | |
# Make the branches | |
rect(-1,0,1,2,col="tan3",border="tan4",lwd=3) | |
polygon(c(-5,0,5),c(2,4,2),col="palegreen3",border="palegreen4",lwd=3) | |
polygon(c(-4,0,4),c(3.5,5.5,3.5),col="palegreen4",border="palegreen3",lwd=3) | |
polygon(c(-3,0,3),c(5,6.5,5),col="palegreen3",border="palegreen4",lwd=3) | |
polygon(c(-2,0,2),c(6.25,7.5,6.25),col="palegreen4",border="palegreen3",lwd=3) |
View simple-example.R
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 simulate some data very simply | |
## Load libraries | |
library(ggplot2) | |
library(dplyr) | |
library(gam) | |
library(patchwork) | |
# Set parameters | |
n_sample = 100 |
View plots-for-postpi.R
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(hextri) | |
library(tidyr) | |
noco = readRDS("/cloud/project/postpi/noco.rds") | |
truth = readRDS("/cloud/project/postpi/truth.rds") | |
par = readRDS("/cloud/project/postpi/par_postpi.rds") | |
nonpar = readRDS("/cloud/project/postpi/nonpar_postpi.rds") | |
nbins = 20 |
View nhanes-flexdashboard.Rmd
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
--- | |
title: "How does your BMI measure up?" | |
output: flexdashboard::flex_dashboard | |
runtime: shiny | |
--- | |
Inputs {.sidebar} | |
------------------------------------- | |
```{r} |
View google-scraper.R
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(XML) | |
library(dplyr) | |
library(RCurl) | |
## Get the results for a specific term | |
scrape_term = function(search_term,npages){ | |
base_url = "http://scholar.google.com/scholar?" | |
search_string = paste0("q=",paste0(strsplit(search_term," ")[[1]],collapse="+")) | |
dat = data.frame(NA,nrow=10*npages,ncol=3) |
OlderNewer