# Data analysis

## Using WeightIt R package for causal inference analyses

I recently discovered WeightIt R package and was very happy with its functionality and performance. I “delegated” my code computing IPTW to WeightIt and it was faster while producing the same results, as expected.

## Iterative visualizations with ggplot2: no more copy-pasting

Are you tired of copy-pasting some chunks of your code over and over again? I am, too. Let’s dig into how we can improve our workflow with a bit of tidy evaluation and writing our own functions to avoid copy-pasting.

A story of how I started using R, struggled, and ultimately found my way and motivation to keep learning and using Rstats

## Data simulation and propensity score estimation

In this post, I will play around with simulated data. The things I’ll be doing: Simulating my own dataset with null associations between two different exposures (x1 and x2) and outcomes y1 and y2 for each of exposures (4 exposure-outcome pairs) Computing propensity scores (PS) for each exposure, trimming non-overlapping areas of PS distribution between exposed and unexposed Running several logistic regression models Crude Conventionally adjusted Adjusted with standardized mortality ratio (SMR) weighting using PS Calculating how biased the the estimates are compared with the true (null) effect Data simulation First, I simulate the data for 10 confounders c1-c10, 2 exposures x1 and x2 (with 7% and 20% prevalences, respectively), 2 outcomes (y1 and y2), two exposure predictors c11-c12, and 2 predictors of the outcome c13-c14.

## Bootstrapping and plotting 95% confidence bands: 'Causal Inference: What If' Causal Survival Analysis. Parametric g-formula

In this post, I explore parametric g-formula fitting in the causal survival analysis context. I use the machinery of the tidyverse throughout the post and finish with plotting the 95% confidence band around the g-formula fitted survival curve for smokers vs non-smokers (see Chapter 17, Hernán MA, Robins JM (2020).

## Bootstrapping and plotting 95% confidence bands: 'Causal Inference: What If' Causal Survival Analysis

In this post, I have a look inside the Chapter 17 on Causal Survival Analysis of the “Causal Inference: What If” book by M. Hernan and J. Robins. I explore IPTW fitting following the chapter’s narrative and use the machinery of the tidyverse throughout.

## Using R & tidyverse with publically available Nordic databases

Case study of using R & tidyverse to wrangle and graphically describe publicly available Nordic datasets

## Migraine medication use in Danish and Swedish women

In this post I will explore the use of medications, which are indicated to stop migraine episodes or to prevent them. I will use publicly available aggregated data on prescribed medication in Denmark between 1996 and 2019.

## Antidepressants use in Sweden

Data Several months have passed since I uploaded Swedish drug utilization data and the structure has changed since then. This time I will focus on antidepressants use in Sweden in more detail 🤓

## Drug utilization in Sweden and Denmark

In this post (Part II), I will look into the Danish national trends on of sedatives, antidepressants, anti-psychotics and anxiolytics utilization in women. Then I’d like to compare Danish national trends with Swedish national trends from Part I.