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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<link rel="stylesheet" href="prodint.css"> | |
<title>Product integral</title> | |
</head> | |
<body> |
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
#data source: | |
# https://scb.se/om-scb/nyheter-och-pressmeddelanden/overdodligheten-fortsatter-att-sjunka-efter-toppen-i-april/ | |
library(readxl) | |
library(excessmort) | |
library(tidyr) | |
dset <- read_excel("2020-05-22-preliminar_statistik_over_doda_inkl_eng.xlsx", sheet = 2, | |
skip = 6) | |
dset2 <- dset[-nrow(dset),] |
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
ggplot(test, aes(x = group.long, y = est, ymin = low, ymax = high, alpha = factor(alpha))) + | |
geom_hline(yintercept = 1, color = "grey45", linetype = 2) + | |
geom_hline(yintercept = 0, color = "black") + | |
geom_text(aes(y = yev, label = ev, alpha = factor(alpha)), size = 3) + | |
geom_pointrange(shape = 18) + coord_flip() + facet_grid(~ type) + | |
scale_y_log10(limits = c(1e-3, max(test$high)), breaks = c(0.01, 1, 10), labels = c(0.01, 1, 10)) + | |
scale_x_discrete(labels = group.labs) + | |
theme(legend.position = "bottom") + | |
ylab("Adjusted hazard ratio versus matched general population") + |
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
X <- rnorm(n, 1) | |
Y <- -.5 + 1.5 * X + rnorm(n, sd = .5) | |
enns <- sample(ceiling(runif(n, 200, 2000))) | |
samp.indi.data <- function(i) { | |
Z <- rbinom(enns[i], 1, .5) | |
mu.S <- 2.5 + X[i] * Z | |
lambda.T <- -1 + Y[i] * Z | |
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
--- | |
title: "Untitled" | |
author: "Michael C Sachs" | |
date: "24 augusti 2016" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
library(knitr) |
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
env.copy <- new.env(parent = parent.env(environment(psdesign$likelihood))) | |
ps.copy <- psdesign | |
objs <- ls(environment(psdesign$likelihood)) | |
for(j in objs){ | |
assign(j, get(j, environment(psdesign$likelihood)), envir = env.copy) | |
} | |
assign("Y.trt", mixup(env.copy$Y.trt, env.copy$trtmat[, "Z"]), envir = env.copy) | |
assign("Y.untrt", mixup(env.copy$Y.untrt, env.copy$untrt.expand[, "Z"]), envir = env.copy) |
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
## Inside shinyServer(function(input, output, session) {}) | |
output$downloadData <- downloadHandler( | |
filename = function() { paste("NIH-percent-", input$yvar, ".xlsx", sep = "") }, | |
content = function(file) { | |
myStyles <- c(rep("textStyle", ifelse(is.null(byvar2()), 2, 3)), | |
ifelse(input$yvar == "investigators", "countStyle", | |
"moneyStyle"), "percStyle") | |
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(plotROC) | |
D <- rbinom(100, 1, .4) | |
fkd <- data.frame(D = D, Y = rnorm(100, mean = D, sd = .5)) | |
p1 <- ggplot(fkd, aes(d = D, m = Y)) + geom_roc(n.cuts = 0) | |
dat <- ggplot_build(p1)$data[[1]] | |
mycut.i <- c(10, 50, 90) # find the indices of the labels you want to plot in dat above | |
p1 + geom_point(data = dat[mycut.i, ], |
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
license: mit |
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
license: mit |
NewerOlder