plot.stdf: Graphical check for standardized differences of covariates

Description Usage Arguments Details Author(s) See Also Examples

View source: R/plot.stdf.R

Description

Plot standardized differences of covariates

Usage

1
2
3
4
5
6
 ## S3 method for class 'stdf'
plot(x, sel = NULL, plot.alpha = TRUE,
  mymar = c(5,8,4,2), pch.p = c(1,5), col.p = c("black", "red"),
  colorspace = NULL, cex.p = 1.25, line.stdf = 1, line.alpha = 4,
  with.legend = TRUE, legend.label = c("before", "after"),
  legend.cex = 1, legend.xy = NULL, ...)

Arguments

x

an object of class 'bal.matched.data.frame', 'bal.matched.data.frames' or 'bal.matched.pscore'. The previous use of ps.balance(..., method='stand.diff', ...) is needed.

sel

a vector of strings indicating covariates to be checked. The default is NULL, i.e. all variables selected previously in ps.balance() are plotted.

plot.alpha

a logical value indicating whether a vertical line for the significance level chosen in ps.balance() should be plotted.

mymar

a graphical parameter, see par().

pch.p

a vector of two integers indicating the symbols.

col.p

a vector of two strings indicating symbol colors.

colorspace

a logical value indicating whether rainbow_hcl(20) (if TRUE) or grey.colors(20) (if FALSE) should be used (argument '20' indicate that 20 colors are pre-specified and can be selected using col.p). The default is NULL, i.e. argument col.p is used. The colors are randomly chosen when argument col.p contains strings and colorspace is set to TRUE.

cex.p

a numeric indicating the size of symbols.

line.stdf

an integer indicating the line type connecting the sympols.

line.alpha

an integer indicating the line type presenting the significance level.

with.legend

a logical value indicating whether the legend is given.

legend.label

a vector of two strings indicating the labels.

legend.cex

a numeric indicating the size of the legend font.

legend.xy

a vector of two integers indicating x- and y-coordinates for legend position.

...

further arguments for graphics.

Details

Standardized difference are proposed to check the balance of covariates after matching. The function plot.stdf() offers a graphical check of it presenting standardized differences of covariates between treatment groups before and after matching.

The usage of plot.stdf() requires the previous use of ps.balance(..., method='stand.diff', ...) and is only available when matching is done before via ps.match().

Author(s)

Susanne Stampf susanne.stampf@usb.ch

See Also

plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## STU1
data(stu1)
stu1.ps <- pscore(data    = stu1, 
                  formula = therapie~tgr+age)

stu1.match <- ps.match(object          = stu1.ps,
                       ratio           = 2,
                       caliper         = 0.5,
                       givenTmatchingC = FALSE,
                       matched.by      = "pscore",
                       setseed         = 38902)

stu1.bal.match <- ps.balance(object = stu1.match,
                             sel    = c("tgr","age"),
                             method = "stand.diff",
                             alpha  = 20)

plot.stdf(x          = stu1.bal.match,
          main       = "Stu1 study: Standardized differences",
          cex.axis   = 1.2,
          legend.cex = 1.3,
          cex.main   = 1.5,
          las        = 1,
          col.p      = c("black", "gray"))

Example output

Loading required package: lme4
Loading required package: Matrix
Argument 'givenTmatchingC'=FALSE: Treated elements were matched to each untreated element.

nonrandom documentation built on May 29, 2017, 11:41 p.m.