Skip to contents

Creates plots of Local Standardized Mean Difference (LSD) from an `lsd` object. The function provides visualization options:

  • Average LSD over all covariates (default), with an option to include box plots.

  • LSD for a specific covariate by name or column index.

Usage

# S3 method for class 'lsd'
plot(x, y = NULL, cov = "ALL", ...)

Arguments

x

An object of class `lsd` created using lsd.

y

Unused, included for compatibility with the plot generic.

cov

Character string or numeric index specifying the covariate to plot. Use `"ALL"` to average over all covariates (default), or specify a covariate name or column index.

...

Additional parameters for customizing the plot, including but not limited to:

`box.loc`

A numeric vector specifying locations for box plots when `cov = "ALL"`. Must be a subset of grid points `ck`. Default is `seq(0.1, 0.9, by = 0.2)`. Set to `NULL` to disable box plots.

`point.color`

Character string specifying the color of points in the plot. Default is `"#9467bd"`.

`point.size`

Numeric specifying the size of points in the plot. Default is `0.8`.

`line.size`

Numeric specifying the size of lines in the plot. Default is `0.5`.

`line.color`

Character string specifying the color of lines in the plot. Default is `"black"`.

`theme.size`

Numeric specifying the base font size for the theme. Default is `15`.

`boxplot.width`

Numeric specifying the width of the box plots. Default is `0.02`.

`outlier.shape`

Numeric specifying the shape of outliers in box plots. Default is `4`.

`outlier.size`

Numeric specifying the size of outliers in box plots. Default is `1`.

Value

A `ggplot2` object for further customization or direct display.

Details

This function provides flexible visualization for LSD results to evaluate the local balance of estimated propensity scores:

  • If `cov = "ALL"`, the plot shows the average LSD over all covariates. If `box.loc` is specified, box plots are added to show variability.

  • If a specific covariate is selected using `cov` (either by name or column index), the plot shows LSD for that covariate.

Box plots are only applicable when `cov = "ALL"` and `box.loc` is not `NULL`.

See also

lsd, getLBC, plot.lsd

Examples

if (FALSE) { # \dontrun{
# Basic plot using an lsd object
plot(lsd_fit)

# Plot average LSD across all covariates
plot(lsd_result, cov = "ALL")

# Plot LSD for a specific covariate
plot(lsd_result, cov = 1)
plot(lsd_result, cov = "Cov1")

# Plot LSD for all covariates with box plots
plot(lsd_fit, cov = "ALL", box.loc = seq(0.1, 0.9, by = 0.2))

# Customize the plot appearance
plot(lsd_fit, cov = "ALL", point.color = "red", point.size = 1, line.size = 1)
} # }