1

I'm using the DCdensity function in the rdd package, which produces a plot of the density of a run variable in a regression discontinuity design, assuming the argument plot = TRUE.

The help page says "The user may wrap this function in additional graphical options to modify the plot."

I want to produce the default plot, but with larger axis title/tick font size, but I can't figure out how to do it. DCdensity doesn't accept additional arguments, and when I wrap the function call in plot() as shown below, I get good axes, but only a single point on the plot at (1, 1).

plot(
    DCdensity(
        runvar      = data$xvar,
        cutpoint    = 0,
        bw          = 1.2,
        plot        = TRUE),
        xlab        = 'Assignment Variable',
        ylab        = 'Density',
        cex.axis    = 1.5,
        cex.lab     = 1.5)

I haven't been able to find an example that implements what the help page is talking about in terms of "wrap the function in additional graphical options" - does anyone know how to do this?

MDe
  • 2,478
  • 3
  • 22
  • 27
  • See also answer to this very similar question: https://stackoverflow.com/questions/52334725/how-to-wrap-dcdensity-in-additional-graphical-options-to-modify-the-plot-rd?noredirect=1&lq=1 – bill999 Sep 19 '18 at 15:22

1 Answers1

0

My best answer so far is to change the options globally before the plot, add the titles, and then change the options back afterwards. Happy to see if anyone else has other solutions though!

par(cex.axis = 1.5, cex.lab = 1.5)

DCdensity(
    runvar      = data$xvar,
    cutpoint    = 0,
    bw          = 1.2,
    plot        = TRUE)

title(xlab = 'Assignment Variable', ylab = 'Density')
MDe
  • 2,478
  • 3
  • 22
  • 27