PlotWeightBalance: Plotting balance.

Description Usage Arguments Examples

View source: R/Weight_balance_functions.R

Description

Plots balance of the covariates as a function of w and before matching.

Usage

1
2
3
4
PlotWeightBalance(balance, full_data = -3, weights, cutoff,
  axis_cex = 1, mar = c(4, 4, 2, 8), inset = -0.1, ylimit = NULL,
  leg_cex = 1, plot_title = "", title_cex = 1, cols = NULL,
  xlab = "weight (w)", ylab = "ASDM")

Arguments

balance

A 3-dimensional array including the SDM. First dimension is equal to length of weights, second dimension is equal to two corresponding to before and after matching, and third dimension is the covariates. Returned as an element of the list from the function CalcDAPSWeightBalance().

full_data

The value of the x axis where the full data balance will be plotted. Defaults to - 3.

weights

The vector of weights. Will be used to make the xlab.

cutoff

Vertical lines of cutoff used.

axis_cex

The size of the xaxis. Defaults to 1.

mar

Plot margins. Defaults to c(4, 4, 2, 8).

inset

Inset of the legend Defaults to - 0.1.

ylimit

The limit of the y axis.

leg_cex

The size of the legend. Defaults to 1.

plot_title

Overall plot title. Defaults to ”.

title_cex

Size of the title. Defaults to 1.

Examples

1
2
3
4
5
6
7
8
9
data(toyData)
toyData$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
                           data = toyData)$fitted.values
bal <- CalcDAPSWeightBalance(toyData, weights = seq(0, 1, length.out = 30),
                             cov.cols = 6:9, trt.col = 1,
                             coords.columns = c(4, 5), caliper = 0.3,
                             matching_algorithm = 'greedy')
PlotWeightBalance(bal$balance, weights = seq(0, 1, length.out = 30),
                  cutoff = 0.15)

gpapadog/DAPSm documentation built on May 17, 2019, 8 a.m.