The function OUTmethod_SW
is an internal function to estimate the potential outcomes given a specified model through formula.
It is built into function PSweight
, and is used for constructing the augmented estimators.
OUTmethod_SW(
out.formula = out.formula,
out.weights = NULL,
y = y,
out.method = "glm",
family = "gaussian",
datain = datain,
dataout = dataout,
out.control = list()
)
m.est
a vector of predicted outcome on the dataout
.
gamma.h
estimated coefficient of the outcome model when method = "glm"
.
an object of class formula
(or one that can be coerced to that class):
a symbolic description of the outcome model to be fitted.
A numeric vector of weights to be used in the weighted regression estimator. For the moment estimator(MOM) and clever covariates estimator(CVR), this parameter defaults to NULL; however, in the weighted regression estimator(WET) it should be set to the balancing weights used for the weighted outcome regression model.
a vector of the observed outcome in the training data (datain
).
a character to specify the method for estimating the outcome regression model. "glm"
is default, and "gbm"
and "SuperLearner"
are also allowed.
a description of the error distribution and link function to be used in the outcome model. Supported distributional families include
"gaussian" (link = identity)
, "binomial" (link = logit)
and "poisson" (link = log)
. Default is "gaussian"
.
The training data for the outcome model. In the context of PSweight
, it refers to the data observed for each treatment group.
The prediction data for the outcome model. In the context of PSweight
, it refers to the full data.
a list to specify additional options when out.method
is set to "gbm"
or "SuperLearner"
.
A typical form for out.formula
is y ~ terms
where y
is the outcome
variable and terms
is a series of terms which specifies linear predictors (on the link function scale). out.formula
by default specifies generalized
linear model given the gaussian error through the default arguments method = "glm"
and family = "gaussian"
. It fits the logistic regression when family = "binomal"
,and poisson
regression when family = "poisson"
. The argument out.method
allows user to choose
model other than glm to fit the outcome regression models for constructing the augmented estimator. We have included gbm
and SuperLearner
as alternative machine learning estimators.
Additional argument in them can be supplied through the ...
argument. Please refer to the user manual of the gbm
and SuperLearner
packages for all the
allowed arguments.
When out.weights
is provided, weighted regression is applied in all supported methods. In "glm"
,
weighted least squares is used for Gaussian outcomes, and weighted likelihood for binomial or Poisson outcomes.
If family = "poisson"
and non-integer outcomes are detected (due to continuous-valued responses or weighting effects),
the function automatically switches to "gaussian"
to ensure numerical stability. In "gbm"
, outcome
weights are passed via the weights
argument, and if non-integer outcomes exist under family = "poisson"
,
the model switches to "gaussian"
. For "SuperLearner"
, weighted estimation is supported through the
obsWeights
argument. Since "SuperLearner"
does not support Poisson regression, a warning is issued,
and the model defaults to "gaussian"
. These adjustments ensure compatibility and stability across different
estimation approaches.
data("psdata")
data("psdata_bin_prospective_fp")
data("psdata_bin_retrospective_fp")
#' the outcome model
out.formula <- Y~cov1+cov2+cov3+cov4+cov5+cov6
y <- psdata_bin_retrospective_fp$Y
#train on model with treatment group 1
datain <- psdata_bin_retrospective_fp[psdata_bin_retrospective_fp$trt==1, ]
outfit <- OUTmethod_SW(out.formula = out.formula, y=y, datain = datain,
dataout = psdata_bin_retrospective_fp)
Run the code above in your browser using DataLab