Public health researcher at Bradford Institute for Health Research and @UCL
-
University College London
- London
- https://iris.ucl.ac.uk/iris/browse/profile?upi=DLEWE01
- @danlewer
Pinned Loading
-
Bootstrap confidence interval for di...
Bootstrap confidence interval for difference in means with paired data 1# function
23mbPaired <- function(x, y, B = 1000) {
4lx <- length(x)
5ly <- length(y)
-
life_tables_mc.R
life_tables_mc.R 1# this code calculates a life table using mortality rates by single-year-of-age
2# confidence intervals are calculated assuming that each year-of-age is an independent sample
34#-----------------
5# make sample data
-
Last status in a vector equalling c(...
Last status in a vector equalling c(x, y, z) 1# 'a' is a vector
2# 'vals' is a vector
3# returns a vector of same lengths as 'a' showing the last value in 'a' equal to any value in 'vals'
4# 'fill' is the value given if none of the values in 'vals' has yet occurred in 'a'
5# 'excl' is a vector specifying values of 'vals' that are to be excluded. Best used when vals is not specified (and defaults to unique(a))
-
lewis_plots.R
lewis_plots.R 1# following the observation in Lewis et al (2005) https://onlinelibrary.wiley.com/doi/abs/10.1002/pds.1115
2# that incidence of various events is higher in the months after patients join an electronic database
3# this code provides a function for measuring incidence stratified by time after joining a cohort
45# -- function reporting incidence stratified by duration after cohort entry --
-
-
Simulate the Monty Hall problem
Simulate the Monty Hall problem 1# function runs the monty hall problem 'n' times and returns the proportions of 'wins' under sticking and switching strategies
23montyHall <- function (n = 1e5) {
4prize <- sample(1:3, n, replace = T)
5firstChoice <- sample(1:3, n, replace = T)
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.