From 5c938134b029e478fd02e63ae66428a052172329 Mon Sep 17 00:00:00 2001 From: Sophie Huebler Date: Thu, 17 Oct 2024 12:49:07 -0600 Subject: [PATCH] final commit for slides --- slides.html | 827 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 660 insertions(+), 167 deletions(-) diff --git a/slides.html b/slides.html index 6d89aa3..f469f24 100644 --- a/slides.html +++ b/slides.html @@ -1,12 +1,12 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return o}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),c=n.n(e);function a(t){try{return document.execCommand(t)}catch(t){return}}var f=function(t){t=c()(t);return a("cut"),t};var l=function(t){var e,n,o,r=1 - - - + + - - My fancy presentation + + Meta-Analsis for the Binomial Model with Normal Random Effects @@ -485,10 +484,75 @@ ul.task-list{list-style: none;} ul.task-list li input[type="checkbox"] { width: 0.8em; -margin: 0 0.8em 0.2em -1em; vertical-align: middle; +margin: 0 0.8em 0.2em -1.6em; +vertical-align: middle; } +pre > code.sourceCode { white-space: pre; position: relative; } +pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } +pre > code.sourceCode > span:empty { height: 1.2em; } +.sourceCode { overflow: visible; } +code.sourceCode > span { color: inherit; text-decoration: inherit; } +div.sourceCode { margin: 1em 0; } +pre.sourceCode { margin: 0; } +@media screen { +div.sourceCode { overflow: auto; } +} +@media print { +pre > code.sourceCode { white-space: pre-wrap; } +pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } +} +pre.numberSource code +{ counter-reset: source-line 0; } +pre.numberSource code > span +{ position: relative; left: -4em; counter-increment: source-line; } +pre.numberSource code > span > a:first-child::before +{ content: counter(source-line); +position: relative; left: -1em; text-align: right; vertical-align: baseline; +border: none; display: inline-block; +-webkit-touch-callout: none; -webkit-user-select: none; +-khtml-user-select: none; -moz-user-select: none; +-ms-user-select: none; user-select: none; +padding: 0 4px; width: 4em; +color: #aaaaaa; +} +pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } +div.sourceCode +{ color: #003b4f; background-color: #f1f3f5; } +@media screen { +pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } +} +code span { color: #003b4f; } +code span.al { color: #ad0000; } +code span.an { color: #5e5e5e; } +code span.at { color: #657422; } +code span.bn { color: #ad0000; } +code span.bu { } +code span.cf { color: #003b4f; } +code span.ch { color: #20794d; } +code span.cn { color: #8f5902; } +code span.co { color: #5e5e5e; } +code span.cv { color: #5e5e5e; font-style: italic; } +code span.do { color: #5e5e5e; font-style: italic; } +code span.dt { color: #ad0000; } +code span.dv { color: #ad0000; } +code span.er { color: #ad0000; } +code span.ex { } +code span.fl { color: #ad0000; } +code span.fu { color: #4758ab; } +code span.im { color: #00769e; } +code span.in { color: #5e5e5e; } +code span.kw { color: #003b4f; } +code span.op { color: #5e5e5e; } +code span.ot { color: #003b4f; } +code span.pp { color: #ad0000; } +code span.sc { color: #5e5e5e; } +code span.ss { color: #20794d; } +code span.st { color: #20794d; } +code span.va { color: #111111; } +code span.vs { color: #20794d; } +code span.wa { color: #5e5e5e; font-style: italic; } - + @@ -1136,6 +1198,231 @@ display: block; margin-left: auto; margin-right: 0; } + + + + @@ -1143,29 +1430,343 @@
-

My fancy presentation

-

For PHS 7045

+

Meta-Analsis for the Binomial Model with Normal Random Effects

+

Heirarchical and Empirical Bayesian Approaches

-John Doe +Sophie Huebler
-
-

Section 1

+
+

Section 1: Introduction to the Problem

-
-

Slide 1

-
-
+
+
+

Section 2: Solution Plan

+ +
+
+

Heirarchical Bayesian Approach

+
    +
  • Full conditionals:

    +
      +
    • Write in both R and c++
    • +
  • +
  • Wrapper for the full algorithm:

    +
      +
    • Rewrite with data table so that storage and manipulation is easier

    • +
    • Pre-allocate memory

    • +
  • +
  • Use microbenchmark to comapre efficiency to original code

  • +
+
+
+

Empirical Bayesian Approach

+
    +
  • Marignal likelihood

    +
      +
    • Use parallel programming for the R implementation that currently simulates average likelihood of the marginal likelihood

    • +
    • Write the full likelihood function in C++ and then use GNU scientific library for numeric integration

    • +
  • +
+
+
+
+

Section 3: Preliminary Results

+ +
+
+

Heirarchical Bayesian

+

Currently all posterior functions are written in modularized format in R and wrapped in a function that stores the results as a data table.

+
    +
  • Old function: 2 for loops, 4 lapply statements

  • +
  • New function: 1 for loop

  • +
+
+ +
+
+ +
+
+
+
              min   median  itr/sec mem_alloc  gc/sec n_itr n_gc total_time
+original 1.202172 1.202172 1.000000  1.582209 1.00000     1    6   3.135974
+updated  1.000000 1.000000 1.202172  1.000000 1.00181     1    5   2.608591
+
+
+
+
+

Marginal Likelihood

+

Original code:

+
+
mlik_func <- function(mu,
+                      tau2,
+                      Y, 
+                      #simulate
+                      sim = 1000
+                      ){
+  
+#Set up
+  #number of studies
+  k = nrow(Y)
+  #initialize 
+  lik <- 0 
+  #test <-  0
+  
+#Outer loop !!! This is where parallelization can be implemented
+  for(j in 2:sim){
+    #Simulate theta and gamma
+    #based on mu and tau2 to optimize and take average lik
+    theta <- rnorm(k, mean = mu, sd = sqrt(tau2))
+    gamma <- rnorm(k, mean = 0, sd = 10)
+    
+    #Calculate odds (expit scale)
+    eta_C <- gamma - theta/2
+    eta_T <- gamma + theta/2
+    
+    #Transform odds to probabilities (p scale)
+    p_C <- 1/(1+exp(-eta_C))
+    p_T <- 1/(1+exp(-eta_T))
+    
+    #Construct priors (on theta and gamma only)
+    #Use log scale for easier computation so
+    #addition instead of multiplication for
+    #likelihood and priors
+    
+    pi_theta <- dnorm(theta, mean = mu, sd = sqrt(tau2), log = T)
+    pi_gamma <- dnorm(gamma, mean = 0, sd = 10, log = T)
+    
+    #Construct likelihood for both control
+    #and treatments, because the likelihood 
+    #depends on the data (do not construct
+    #likelihood for the parameters being estimated
+    #or integrated out)
+    
+    #Use probabilities found above
+    
+    lik_C <- dbinom(Y[,"ric"], Y[,"nic"], p_C, log = T)
+    lik_T <- dbinom(Y[,"rit"], Y[,"nit"], p_T, log = T)
+    
+    #Need to tranform back to exp scale
+    lik<- lik + exp(lik_C+lik_T+pi_theta+pi_gamma)
+    
+  }#End outer loop
+  
+  #Find average log likelihood
+  log_lik <- log(lik/sim)
+
+  #Return negative log likelihood
+  ret <- -sum(log_lik)
+  ret
+
+}
+
+
@@ -1223,7 +1824,7 @@

Slide 1

divSourceCode.forEach((el) => { if (el.hasAttribute(kCodeLineNumbersAttr)) { const codeLineAttr = el.getAttribute(kCodeLineNumbersAttr); - el.removeAttribute(kCodeLineNumbersAttr); + el.removeAttribute("data-code-line-numbers"); if (handleLinesSelector(deck, codeLineAttr)) { // Only process if attr is a string to select lines to highlights // e.g "1|3,6|8-11" @@ -1350,9 +1951,9 @@

Slide 1

if (typeof highlight.last === "number") { spanToHighlight = [].slice.call( codeBlock.querySelectorAll( - ":scope > span:nth-of-type(n+" + + ":scope > span:nth-child(n+" + highlight.first + - "):nth-of-type(-n+" + + "):nth-child(-n+" + highlight.last + ")" ) @@ -1360,7 +1961,7 @@

Slide 1

} else if (typeof highlight.first === "number") { spanToHighlight = [].slice.call( codeBlock.querySelectorAll( - ":scope > span:nth-of-type(" + highlight.first + ")" + ":scope > span:nth-child(" + highlight.first + ")" ) ); } @@ -1638,9 +2239,6 @@

Slide 1

Reveal = _Reveal; install(); }; - Plugin.togglePdfExport = function () { - togglePdfExport(); - }; } return Plugin; @@ -1688,9 +2286,6 @@

Slide 1

downloadDrawings: revealMenuToolHandler(function () { RevealChalkboard.download(); }), - togglePdfExport: revealMenuToolHandler(function () { - PdfExport.togglePdfExport(); - }), };