plotMCEPcurve {pssmooth}R Documentation

Plotting of the Estimated Marginal Causal Effect Predictiveness Curve

Description

Plots point estimates and, if available, pointwise and simultaneous Wald-type bootstrap confidence intervals for the specified marginal causal effect predictiveness (mCEP) curve.

Usage

plotMCEPcurve(
  object,
  confLevel = 0.95,
  hingePoint = NULL,
  title = NULL,
  xLab = NULL,
  yLab = NULL,
  yLim = NULL,
  pType = c("l", "p")
)

Arguments

object

an object returned by summary.riskCurve

confLevel

the confidence level (0.95 by default) of pointwise and simultaneous confidence intervals

hingePoint

the hinge point estimate (NULL by default)

title

a character string specifying the plot title

xLab

a character string specifying the x-axis label (NULL by default)

yLab

a character string specifying the y-axis label (NULL by default)

yLim

a numeric vector of length 2 specifying the y-axis range (NULL by default)

pType

a character string specifying the type of plot. Possible options are "l" for lines (default) and "p" for points.

Value

None. The function is called solely for plot generation.

See Also

riskCurve, bootRiskCurve and summary.riskCurve

Examples

n <- 500
Z <- rep(0:1, each=n/2)
S <- MASS::mvrnorm(n, mu=c(2,2,3), Sigma=matrix(c(1,0.9,0.7,0.9,1,0.7,0.7,0.7,1), nrow=3))
p <- pnorm(drop(cbind(1,Z,(1-Z)*S[,2],Z*S[,3]) %*% c(-1.2,0.2,-0.02,-0.2)))
Y <- sapply(p, function(risk){ rbinom(1,1,risk) })
X <- rbinom(n,1,0.5)
# delete S(1) in placebo recipients
S[Z==0,3] <- NA
# delete S(0) in treatment recipients
S[Z==1,2] <- NA
# generate the indicator of being sampled into the phase 2 subset
phase2 <- rbinom(n,1,0.3)
# delete Sb, S(0) and S(1) in controls not included in the phase 2 subset
S[Y==0 & phase2==0,] <- c(NA,NA,NA)
# delete Sb in cases not included in the phase 2 subset
S[Y==1 & phase2==0,1] <- NA
data <- data.frame(X,Z,S[,1],ifelse(Z==0,S[,2],S[,3]),Y)
colnames(data) <- c("X","Z","Sb","S","Y")
qS <- quantile(data$S, probs=c(0.05,0.95), na.rm=TRUE)
grid <- seq(qS[1], qS[2], length.out=3)

out <- riskCurve(formula=Y ~ S + factor(X), bsm="Sb", tx="Z", data=data, psGrid=grid)
boot <- bootRiskCurve(formula=Y ~ S + factor(X), bsm="Sb", tx="Z", data=data,
                      psGrid=grid, iter=2, seed=10)
sout <- summary(out, boot, contrast="te")
plotMCEPcurve(sout)



[Package pssmooth version 1.0.3 Index]