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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
## 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(object, ...)
## S3 method for class 'neModel'
residualPlots(object, ...)
## S3 method for class 'neModel'
summary(object, ...)
## S3 method for class 'neModel'
vcov(object, ...)
## S3 method for class 'neModel'
weights(object, ...)
``` |

`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 |

`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

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

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.

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.

`neModel`

, `plot.neModel`

, `residualPlot`

, `residualPlots`

, `weights`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ```
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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.