Publications by Daniel
Double Robust Estimators
Using sl3 with AIPW In detail please see the reference by Ashley I Naimi. library(AIPW) library(tmle3) library(sl3) library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.1 ✔ readr 2.1.4 ## ✔ forcats 1.0.0...
172 sym R (7972 sym/23 pcs) 2 img
SuperLearner
SuperLearner In detail please see the reference by Ashley I Naimi. library(nnls) #non-negative least squares library(earth) #Multivariate Adaptive Regression Splines ## Loading required package: Formula ## Loading required package: plotmo ## Loading required package: plotrix ## Loading required package: TeachingDemos library(gam) #A generalized ...
107 sym R (4381 sym/34 pcs)
Longitudinal targeted maximum likelihood estimation
LMTLE: A Brief Introduction This instruction (of causal inference) is for the complex longitudinal data. In detail please see the reference by Ashley I Naimi. Constructing stabilized IP weights library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 �...
394 sym R (8665 sym/55 pcs)
How to create advanced plots
How to create advanced plots Animated chart # Get data: library(gapminder) # load libraries: library(ggplot2) library(gganimate) # create text label gapminder$countrylabel <- ifelse(gapminder$country=="United States", 'US', ifelse(gapminder$country=="China", "CN", "")) # Make a ggplot, but add frame=year: one imag...
207 sym R (4188 sym/22 pcs) 4 img
How to use sas format
Use an Engine # knitr::opts_chunk$set(echo = TRUE) require(SASmarkdown) ## Loading required package: SASmarkdown ## sas, saslog, sashtml, and sashtmllog engines ## are now ready to use. saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sasopts <- "-nosplash -ls 75" knitr::opts_chunk$set(engine='sashtml', engine.path=saspath, ...
598 sym Python (10181 sym/25 pcs)
Common sas commands 2
Use an Engine # knitr::opts_chunk$set(echo = TRUE) require(SASmarkdown) ## Loading required package: SASmarkdown ## sas, saslog, sashtml, and sashtmllog engines ## are now ready to use. saspath <- "C:/Program Files/SASHome/SASFoundation/9.4/sas.exe" sasopts <- "-nosplash -ls 75" knitr::opts_chunk$set(engine='sashtml', engine.path=saspath, ...
343 sym Python (13216 sym/18 pcs)
Confounding and effect measure modification
How to analyze confounding and effect measure modification If there is only confounding: The stratum-specific measures of association will be similar to one another, but they will be different from the overall crude estimate by 10% or more. In this situation, one can use Mantel-Haenszel methods to calculate a pooled estimate (RR or OR) and p...
3678 sym R (8079 sym/27 pcs) 6 img 3 tbl
How to show explained variance in a multilevel model
In this post I will show one way to display explained variance using a line chart. There is no default plot for displaying the effect of each factor on deviance of the model, so this is a tentative proposal for my dissertation. The following values were obtained using multilevel models performed in R (thanks for nlme and lme4 packages). Basically...
3413 sym 2 img
Drawing maps using shapefiles and R
Sometimes a student may use a self explained chart, instead of a boring table for showing outcomes in a research paper. Yet, graphs are efficient in showing the broad picture of an issue and also for present results. In political science, you can getting into this topic reading Kastellec and Leoni (2007), for instance. I usually like draw maps to...
1094 sym 2 img
How can you do a smart job getting data from internet?
I’d like to explore more the capabilities of my statistical packages to get data online and allocate it in memory instead of download each dataset by hand. After all, I found this task is pretty easy, but got me out of bed for one night trying to find the most efficient way to loop across the files and store them in the right way. So, let’s s...
1660 sym