# pointwisebound.boot: Estimating pointwise comparisons for qgcomp.boot objects In qgcomp: Quantile G-Computation

## Description

Calculates: expected outcome (on the link scale), mean difference (link scale) and the standard error of the mean difference (link scale) for pointwise comparisons

## Usage

 `1` ```pointwisebound.boot(x, pointwiseref = 1, alpha = 0.05) ```

## Arguments

 `x` "qgcompfit" object from `qgcomp.boot`, `pointwiseref` referent quantile (e.g. 1 uses the lowest joint-exposure category as the referent category for calculating all mean differences/standard deviations) `alpha` alpha level for confidence intervals

## Details

The comparison of interest following a qgcomp fit is often comparisons of model predictions at various values of the joint-exposures (e.g. expected outcome at all exposures at the 1st quartile vs. the 3rd quartile). The expected outcome at a given joint exposure, and marginalized over non-exposure covariates (W), is given as E(Y^s|S) = sum_w E_w(Y|S,W)Pr(W) = sum_i E(Y_i|S) where Pr(W) is the emprical distribution of W and S takes on integer values 0 to q-1. Thus, comparisons are of the type E_w(Y|S=s) - E_w(Y|S=s2) where s and s2 are two different values of the joint exposures (e.g. 0 and 2). This function yields E_w(Y|S) as well as E_w(Y|S=s) - E_w(Y|S=p) where s is any value of S and p is the value chosen via "pointwise ref" - e.g. for binomial variables this will equal the risk/ prevalence difference at all values of S, with the referent category S=p-1. The standard error of E(Y|S=s) - E(Y|S=p) is calculated from the bootstrap covariance matrix of E_w(Y|S), such that the standard error for E_w(Y|S=s) - E_w(Y|S=p) is given by

Var(E_w(Y|S=s)) + - Var(E_w(Y|S=p)) - 2*Cov(E_w(Y|S=p), - E_w(Y|S=s))

This is used to create pointwise confidence intervals. Note that this differs slightly from the `pointwisebound.noboot` function, which estimates the variance of the conditional regression line given by E(Y|S,W=w), where w is a vector of medians of W (i.e. predictions are made at the median value of all covariates).

## Value

A data frame containing

linpred:

The linear predictor from the marginal structural model

rr/or/mean.diff:

The canonical effect measure (risk ratio/odds ratio/mean difference) for the marginal structural model link

se....:

the stndard error of the effect measure

ul..../ll....:

Confidence bounds for the effect measure, and bounds centered at the linear predictor (for plotting purposes)

`qgcomp.boot`, `pointwisebound.noboot`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```set.seed(12) ## Not run: n=100 # non-linear model for continuous outcome dat <- data.frame(x1=(x1 <- runif(100)), x2=runif(100), x3=runif(100), z=runif(100), y=runif(100)+x1+x1^2) ft <- qgcomp.boot(y ~ z + x1 + x2 + x3, expnms=c('x1','x2','x3'), data=dat, q=10) pointwisebound.boot(ft, alpha=0.05, pointwiseref=3) ## End(Not run) ```