plot.densEstBayes {densEstBayes} | R Documentation |
Plot the Bayesian density estimate from a densEstBayes()
fit
Description
The estimated density function obtained via densEstBayes
is plotted.
Usage
## S3 method for class 'densEstBayes'
plot(x,plotIt=TRUE,credLev=0.95,gridSize=1001,varBand=TRUE,
shade=TRUE,estCol="darkgreen",varBandCol=NULL,
axisCol="slateblue",add=FALSE,lwd=2,xlab=NULL,ylab=NULL,...)
Arguments
x |
A |
plotIt |
Boolean flag: |
credLev |
The number between 0 and 1 such that the credible interval band has (100*credLev)% approximate pointwise coverage. The default value is 0.95. |
gridSize |
The number of grid points used to display the density estimate curve and the pointwise credible interval band. The default value is 1001. |
varBand |
Boolean flag: |
shade |
Boolean flag: |
estCol |
Colour of the density estimate curve. The default value is "darkgreen". |
varBandCol |
Colour of the pointwise credible interval variability band. If |
axisCol |
colour of the horizontal axis. The default value is "slateblue". |
add |
Boolean flag: |
lwd |
A positive integer indicating the line width of plotted curves. The default value is 2. |
xlab |
A character string spedifying the horizontal axis label. |
ylab |
A character string specifying the vertical axis label. |
... |
Place-holder for other graphical parameters. |
Value
If plotIt
=TRUE then a plot is produced on the current device and no numerical values are returned. If plotIt
=FALSE then a list is returned with the following components:
xg |
numerical vector of abscissae values |
densEstg |
numerical vector of ordinate values corresponding to the density estimate |
densLowg |
numerical vector of ordinate values corresponding to the lower limits of the pointwise approximate (100*credLev)% credible set variability band |
densUppg |
numerical vector of ordinate values corresponding to the upper limits of the pointwise approximate (100*credLev)% credible set variability band |
Author(s)
Matt P. Wand matt.wand@uts.edu.au
Examples
library(densEstBayes) ; data(OldFaithful2011)
# Obtain a density estimate for the `OldFaithful2011' data:
dest <- densEstBayes(OldFaithful2011,method = "SMFVB")
# Plot the density estimate using default settings:
plot(dest,xlab = "time interval between geyser eruptions (minutes)")
rug(jitter(OldFaithful2011,amount=0.2),col = "dodgerblue")
# Plot the density estimate with some user-specified settings:
plot(dest,credLev = 0.999,estCol = "purple",
varBandCol = "pink",axisCol = "navy",
xlab = "time interval between geyser eruptions (minutes)")
rug(jitter(OldFaithful2011,amount= 0.2),col = "darkkhaki")
# Plot the density estimate as a black and white line plot:
plot(dest,estCol = "black",shade = FALSE,axisCol = "black",
xlab = "time interval between geyser eruptions (minutes)")
rug(jitter(OldFaithful2011,amount = 0.2))