plot.lmw_est: Plot diagnostics for an 'lmw_est' object

View source: R/plot.lmw_est.R

plot.lmw_estR Documentation

Plot diagnostics for an lmw_est object

Description

Produces plots to diagnose the regression model fit to estimate the treatment effect. These include an influence plot based on the sample influence curve (SIC) and the regression diagnostics plots available for lm objects in plot.lm().

Usage

## S3 method for class 'lmw_est'
plot(x, type = "influence", ...)

Arguments

x

an lmw_est object; the output of a call to lmw_est().

type

the type of plot to display. Allowable options include "influence" and "lm". See Details. Abbreviations allowed.

...

When type = "influence", the following are accepted:

outcome

the name of the outcome variable. Can be supplied as a string containing the name of the outcome variable or as the outcome variable itself. If not supplied, the outcome variable in the formula supplied to lmw(), if any, will be used.

data

an optional data frame containing the outcome variable named in outcome.

id.n

the number of points to be labelled in the plot, starting with the most extreme.

When type = "lm", any arguments passed to plot.lm() are accepted and passed directly to plot.lm.

Details

When type = "influence", plot.lmw_est() produces a plot of the scaled sample influence curve (SIC) for each unit by index. It does so by calling influence.lmw_est(), which extract the model residuals and computes the SIC as SIC = (N-1) * w * r / (1 - h), where N is the sample size, w are the units' implied regression weights, r are the residuals, and h are the hat values. SIC values are scaled to have a maximum of 1. Higher values indicate greater relative influence.

When type = "lm", plot.lmw_est() produces several plots displayed sequentially according to the arguments supplied to plot(). These plots are produced by plot.lm() to diagnose the distribution of residuals and other measures of leverage and influence.

Value

A plot is displayed, and x is invisibly returned.

See Also

lmw_est(), influence.lmw_est(), plot.lm()

Examples

data("lalonde")

# URI regression for ATT
lmw.out1 <- lmw(~ treat + age + education + race + married +
                   nodegree + re74 + re75, data = lalonde,
                estimand = "ATT", method = "URI",
                treat = "treat")

lmw.fit1 <- lmw_est(lmw.out1, outcome = "re78")
lmw.fit1

# Influence using SIC
plot(lmw.fit1, type = "influence")

# Usual regression diagnostics
plot(lmw.fit1, type = "lm", which = 1)

lmw documentation built on May 29, 2024, 6:53 a.m.