predict {causalSLSE}R Documentation

Outcome Prediction

Description

The method computes the predicted outcome for each group with standard errors and confidence intervals.

Usage


## S3 method for class 'cslseFit'
predict(object, interval=c("none","confidence"),
                       se.fit=FALSE, newdata=NULL, level=0.95,
                       vcov.=vcovHC, ...)
## S3 method for class 'slseFit'
predict(object, interval=c("none","confidence"),
                       se.fit=FALSE, newdata=NULL, level=0.95,
                       vcov.=vcovHC, ...)

Arguments

object

Object of class cslseFit or slseFit created by estSLSE.

interval

If set to "confidence", it returns the predicted values along with the lower and upper bounds of the confidence interval.

se.fit

Should the function return the standard errors of the predicted values?

level

The confidence interval level if interval is set to "confidence".

newdata

A data.frame of new data. It must include values for all covariates, and for the treatment indicator in the case of cslseFit objects.

vcov.

An alternative function to compute the covariance matrix of the least squares estimates. The default is the vcovHC.

...

Additional argument to pass to the vcov. function.

Value

For slseFit objects, it returns the predicted outcome if se.fit is FALSE or a list of the following two elements otherwise:

fit

The predicted outcome.

se.fit

The standard errors of the predicted outcomes.

If the argument confidence is set to "interval", the predicted outcome is a matrix with the predicted outcome, and the lower and upper bounds of the confidence intervals.

For objects of class 'cslseFit', the same is returned for each treatment group in a list. The elements of the list are treated and nontreated (until the package allows for more than one treatment).

Examples

data(simDat3)
mod <- cslseModel(Y ~ Z | ~ X1 + X2, data = simDat3)
fit <- causalSLSE(mod)

## Predicting outcome for all observations

pr <- predict(fit, interval = "confidence")

## Predicting outcome with new data

ndat <- data.frame(X1 = c(-2, 1, 2, 3), X2 = c(-4, -2, 0, 1),
                   Z = c(1, 1, 0, 0))
predict(fit, newdata = ndat)


[Package causalSLSE version 0.3-1 Index]