qgcompint: quantile g-computation with effect measure modification

Quick start

devtools::install_github("alexpkeil1/qgcompint")
library(qgcomp)
library(qgcompint)
 set.seed(40)
dat <- data.frame(y=runif(50),
                  x1=runif(50),
                  x2=runif(50),
                  z=rbinom(50,1,0.5),
                  r=rbinom(50,1,0.5))
 
 # quantile g-computation without effect measure modification
 qfit <- qgcomp.noboot(f=y ~ z + x1 + x2, 
           expnms = c('x1', 'x2'), 
           data=dat, q=2, 
           family=gaussian())
 # no output given here          
 
 # with effect measure modification by Z
 (qfitemm <- qgcomp.emm.noboot(f=y ~ z + x1 + x2,
           emmvar="z", 
           expnms = c('x1', 'x2'), 
           data=dat, q=2, 
           family=gaussian()))



> ## Qgcomp weights/partial effects at z = 0
> Scaled effect size (positive direction, sum of positive coefficients = 0)
> None

> Scaled effect size (negative direction, sum of negative coefficients = -0.278)
>    x2    x1 
> 0.662 0.338 

> ## Qgcomp weights/partial effects at z = 1
> Scaled effect size (positive direction, sum of positive effects = 0.0028)
> x1 
>  1 

> Scaled effect size (negative direction, sum of negative effects = -0.0128)
> x2 
>  1 

> Mixture slope parameters (Delta method CI):

>             Estimate Std. Error Lower CI Upper CI t value  Pr(>|t|)
> (Intercept)  0.58062    0.11142  0.36224  0.79900  5.2112 4.787e-06
> psi1        -0.27807    0.20757 -0.68490  0.12876 -1.3397    0.1872
> z           -0.10410    0.15683 -0.41148  0.20329 -0.6637    0.5103
> z:mixture    0.26811    0.26854 -0.25822  0.79444  0.9984    0.3235

> Estimate (CI), z=1: 
> -0.0099575 (-0.34389, 0.32398)

Current package capabilities/limitations

Interpretation