plotCurveEstimate {bfp} | R Documentation |
Generic function for plotting a fractional polynomial curve estimate
Description
Plot a fractional polynomial curve estimate for either a single model
or a Bayesian model average over BayesMfp
objects. Optionally,
credible intervals and / or bands can be added to the plot.
Usage
plotCurveEstimate(model, termName, plevel = 0.95, slevel = plevel,
plot = TRUE, legendPos = "topleft", rug = FALSE, partialResids=TRUE,
hpd=TRUE,..., main = NULL)
Arguments
model |
an object of class |
termName |
string denoting an FP term, as written by the
|
plevel |
credible level for pointwise intervals, and |
slevel |
credible level for simultaneous credible band (SCB),
|
plot |
if |
legendPos |
position of coefficient estimates (for |
rug |
add a rug to the plot? (default: |
partialResids |
add partial residuals to the plot? (default:
|
hpd |
use HPD intervals ( |
... |
further arguments in case of a |
main |
optional main argument for the plot |
Details
Further arguments for application on a BayesMfp
object:
- grid
vector of unscaled abscissae, default is a length
gridSize
grid over the observed range specified by providing the argumentNULL
.- post
list with posterior parameters of the model, which may be provided manually to accelerate plotting in a loop
- gridSize
default number of grid points used when no
grid
is supplied (default is 201)- numSim
number of simulations for estimation of the SCB (default is 500)
Value
a list of various plotting information:
original |
grid on the original covariate scale |
grid |
grid on the transformed scale |
mode |
mode curve values, only for |
mean |
pointwise mean curve values, only for
|
median |
pointwise median curve values, only for
|
plower |
lower boundaries for pointwise intervals |
pupper |
upper boundaries for pointwise intervals |
slower |
lower boundaries for SCB |
supper |
upper boundaries for SCB |
obsVals |
observed values of the covariate on the original scale |
sampleSize |
sample size underlying the curve estimate, only for
|
partialResids |
partial residuals |
transform |
vector of shift and scale parameter |
See Also
Examples
## construct a BayesMfp object
set.seed(19)
x1 <- rnorm (n=15)
x2 <- rbinom (n=15, size=20, prob=0.5)
x3 <- rexp (n=15)
y <- rt (n=15, df=2)
test <- BayesMfp (y ~ bfp (x2, max = 4) + uc (x1 + x3), nModels = 100,
method="exhaustive")
## plot the x2 curve estimate for the 20-th best model
p1 <- plotCurveEstimate (test[20], "x2")
## look at the returned list
str(p1)
## plot the BMA curve estimate for the same covariate
testBma <- BmaSamples (test)
p2 <- plotCurveEstimate (testBma, "x2")
## look at the returned list
str(p2)
## try the new options:
plotCurveEstimate (testBma, "x2", partialResids=FALSE, hpd=FALSE)