neModel-methods: Methods for natural effect models

neModel-methodsR Documentation

Methods for natural effect models

Description

Extractor functions, confidence intervals, residual plots and statistical tests for natural effect models.

Usage

## S3 method for class 'neModel'
coef(object, ...)

## S3 method for class 'neModelBoot'
confint(object, parm, level = 0.95, type = "norm", ...)

## S3 method for class 'neModel'
confint(object, parm, level = 0.95, ...)

## S3 method for class 'neModel'
residualPlot(model, ...)

## S3 method for class 'neModel'
residualPlots(model, ...)

## S3 method for class 'neModel'
summary(object, ...)

## S3 method for class 'neModel'
vcov(object, ...)

## S3 method for class 'neModel'
weights(object, ...)

Arguments

object

a fitted natural effect model object.

...

additional arguments.

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

the confidence level required.

type

the type of bootstrap intervals required. The default "norm" returns normal approximation bootstrap confidence intervals. Currently, "norm", "basic", "perc" and "bca" are supported (see boot.ci).

model

a fitted natural effect model object (for use with residualPlot and residualPlots).

Details

confint yields bootstrap confidence intervals or confidence intervals based on the sandwich estimator (depending on the type of standard errors requested when fitting the neModel object). Bootstrap confidence intervals are internally called via the boot.ci function from the boot package. Confidence intervals based on the sandwich estimator are internally called via confint.default. The default confidence level specified in level (which corresponds to the conf argument in boot.ci) is 0.95 and the default type of bootstrap confidence interval, "norm", is based on the normal approximation. Bias-corrected and accelerated ("bca") bootstrap confidence intervals require a sufficiently large number of bootstrap replicates (for more details see boot.ci).

A summary table with large sample tests, similar to that for glm output, can be obtained using summary.

vcov returns either the bootstrap variance-covariance matrix (calculated from the bootstrap samples stored in
object$bootRes; see neModel) or the robust variance-covariance matrix (which is a diagonal block matrix of the original sandwich covariance matrix).

weights returns a vector containing the regression weights used to fit the natural effect model. These weights can be based on

  1. ratio-of-mediator probability (density) weights (only if the weighting-based approach is used)

  2. inverse probability of treatment (exposure) weights (only if xFit was specified in neModel)

residualPlot and residualPlots are convenience functions from the car package. These can be used to assess model adequacy.

Note

For the bootstrap, z-values in the summary table are calculated by dividing the parameter estimate by its corresponding bootstrap standard error. Corresponding p-values in the summary table are indicative, since the null distribution for each statistic is assumed to be approximately standard normal. Therefore, whenever possible, it is recommended to focus mainly on bootstrap confidence intervals for inference, rather than the provided p-values.

See Also

neModel, plot.neModel, residualPlot, residualPlots, weights

Examples

data(UPBdata)

weightData <- neWeight(negaff ~ att + educ + gender + age,
                       data = UPBdata)
neMod <- neModel(UPB ~ att0 * att1 + educ + gender + age, 
                 family = binomial, expData = weightData, se = "robust")

## extract coefficients
coef(neMod)

## extract variance-covariance matrix
vcov(neMod)

## extract regression weights
w <- weights(neMod)
head(w)

## obtain bootstrap confidence intervals
confint(neMod)
confint(neMod, parm = c("att0"))
confint(neMod, type = "perc", level = 0.90)

## summary table
summary(neMod)

## residual plots
library(car)
residualPlots(neMod)

medflex documentation built on July 10, 2023, 2 a.m.