-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathweight_propensity.model_fit.Rd
53 lines (47 loc) · 2.36 KB
/
weight_propensity.model_fit.Rd
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/weight_propensity.R
\name{weight_propensity.model_fit}
\alias{weight_propensity.model_fit}
\alias{weight_propensity}
\alias{weight_propensity.default}
\title{Helper for bridging two-stage causal fits}
\usage{
weight_propensity(object, wt_fn, ...)
\method{weight_propensity}{default}(object, wt_fn, ...)
\method{weight_propensity}{model_fit}(object, wt_fn, .treated = object$lvl[2], ..., data)
}
\arguments{
\item{object}{The object containing the model fit(s) that will generate
predictions used to calculate propensity weights. Currently, either a
\link[=fit.model_spec]{parsnip model fit}, fitted
\link[workflows:workflow]{workflow}, or
tuning results (\code{?tune::fit_resamples}) object. If a tuning result, the
object must have been generated with the control argument
(\code{?tune::control_resamples}) \code{extract = identity}.}
\item{wt_fn}{A function used to calculate the propensity weights. The first
argument gives the predicted probability of exposure, the true value for
which is provided in the second argument. See \code{?propensity::wt_ate()} for
an example.}
\item{...}{Additional arguments passed to \code{wt_fn}.}
\item{.treated}{The level of the exposure corresponding to the treatment, as
a string. Additionally passed as \code{.treated} to \code{wt_fn}.}
\item{data}{The data supplied as the \code{data} argument to \code{fit()} the \code{object}.
This argument is only required for the \code{model_fit} and \code{workflow} methods---the
needed data for the \code{tune_results} method lives inside of \code{object}.}
}
\value{
For \code{model_fit} and fitted \code{workflow} input, a modified version of the data
set supplied in \code{data} that contains a \code{.wts} column with class
\code{importance_weights}. For \code{tune_results} input, a modified version of the
resampling object underlying the tuning results containing a new \code{.wts} column
with propensity values corresponding to each element of the analysis set.
}
\description{
\code{weight_propensity()} is a helper function to more easily link the
propensity and outcome models in causal workflows. \strong{The main documentation
for this function lives in the tune package at} \code{?tune::weight_propensity}.
}
\references{
Barrett M & D'Agostino McGowan L (forthcoming).
\emph{Causal Inference in R}. \url{https://www.r-causal.org/}
}