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 |
interval |
If set to |
se.fit |
Should the function return the standard errors of the predicted values? |
level |
The confidence interval level if interval is set to
|
newdata |
A |
vcov. |
An alternative function to compute the covariance
matrix of the least squares estimates. The default is the
|
... |
Additional argument to pass to the |
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)