plot.subpop: Plot 2-dimensional projections of variables in interest.

View source: R/subpop.R

plot.subpopR Documentation

Plot 2-dimensional projections of variables in interest.

Description

Takes output from subpop command as inputs and plots 2-dimensional projection plots of two specified variables. If a variable in interest is of type factor, then the user must put it on the y-axis. If the variable on the y-coordinate is a factor, range of y-axis is set to be the factor level. Otherwise, users can use summary.subpop to know the ranges of variables in the two groups.

Usage

## S3 method for class 'subpop'
plot(
  x,
  varx,
  vary,
  xlim = NULL,
  ylim = NULL,
  main = NULL,
  sub = NULL,
  xlab = NULL,
  ylab = NULL,
  overlap = FALSE,
  ...
)

Arguments

x

Output of subpop command.

varx

The name of the variable to be plotted on the x-axis.

vary

The name of the variable name to be plotted on the y-axis.

xlim

The range of x-axis. Default is NULL.

ylim

The range of y-axis. Default is NULL. If the variable on the y-coordinate is a factor, the default will set it to be the factor level, and users don't need to specify ylim.

main

Main title of the plot. Default is NULL.

sub

Sub title of the plot. Default is NULL.

xlab

x-axis label. Default is NULL.

ylab

y-axis label. Default is NULL.

overlap

Whether user wants to allow observations included in both confidence sets. Default is FALSE, and the plot drops the overlapped observations.

...

Graphics parameters to be passed to the plotting routines.

Examples

data("mortgage")
### Regression Specification
fm <- deny ~ black + p_irat + hse_inc + ccred + mcred + pubrec +
   ltv_med + ltv_high + denpmi + selfemp + single + hischl
### Issue the subpop command
set_b <- subpop(fm, data = mortgage, method = "logit", var = "black",
u = 0.1, alpha = 0.1, b = 50)
### Plotting
plot(set_b, varx = mortgage$p_irat, vary = mortgage$hse_inc,
     xlim = c(0, 1.5), ylim = c(0, 1.5), xlab = "Debt/Income",
     ylab = "Housing expenses/Income", overlap = TRUE)

SortedEffects documentation built on March 22, 2022, 9:05 a.m.