Skip to content
View danlewer's full-sized avatar

Block or report danlewer

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse

Pinned Loading

  1. Bootstrap confidence interval for di... Bootstrap confidence interval for difference in means with paired data
    1
    # function
    2
    
                  
    3
    mbPaired <- function(x, y, B = 1000) {
    4
      lx <- length(x)
    5
      ly <- length(y)
  2. 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
    3
    
                  
    4
    #-----------------
    5
    # make sample data
  3. 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))
  4. 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
    4
    
                  
    5
    # -- function reporting incidence stratified by duration after cohort entry --
  5. covid_homeless covid_homeless Public

    R

  6. 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
    2
    
                  
    3
    montyHall <- function (n = 1e5) {
    4
      prize <- sample(1:3, n, replace = T)
    5
      firstChoice <- sample(1:3, n, replace = T)